Skip to contentSkip to conversation

backports: fix mconf compilation on OpenSUSE factory

PATCH In review Luis R. Rodriguez 3 participants 6 messages Aug 9, 2014 – Sep 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: fix mconf compilation on OpenSUSE factory

From: "Luis R. Rodriguez" <[email protected]>

On OpenSUSE factory 'make menuconfig' fails to compile with:

cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2
-fomit-frame-pointer -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o
lxdialog/yesno.o lxdialog/yesno.c
cc -Wl,--no-as-needed -lncursesw mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o -o mconf
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
/lib64/libncursesw.so.5: undefined reference to symbol 'acs_map' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libtinfo.so:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

This is fixed by linking with -ltinfo. I've test builded this on Debian and OpenSUSE factory.

---
 backport/kconf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
backport/kconf/Makefile +1 -1
index dfd793a..c9c39a3 100644
@@ -3,7 +3,7 @@ CFLAGS=-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
 LXDIALOG := lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o
 
 conf: conf.o zconf.tab.o
-mconf: LDFLAGS = -Wl,--no-as-needed $(shell ./lxdialog/check-lxdialog.sh -ldflags $(CC))
+mconf: LDFLAGS = -Wl,--no-as-needed -ltinfo $(shell ./lxdialog/check-lxdialog.sh -ldflags $(CC))
 mconf: CFLAGS += -DCURSES_LOC="<ncurses.h>" -DLOCALE
 mconf: mconf.o zconf.tab.o $(LXDIALOG)
 
Signature · 1 line
2.0.3
#1 lore raw
Quoted 16 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

On OpenSUSE factory 'make menuconfig' fails to compile with:

cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2
-fomit-frame-pointer -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o
lxdialog/yesno.o lxdialog/yesno.c
cc -Wl,--no-as-needed -lncursesw mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o -o mconf
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
/lib64/libncursesw.so.5: undefined reference to symbol 'acs_map' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libtinfo.so:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Quoted 2 lines

This is fixed by linking with -ltinfo. I've test builded this on Debian and OpenSUSE factory.

I have a vague feeling that we used to have this and it broke somewhere else, and it was supposed to get added via check-lxdialog.sh...

Please look in the list archives for this, I'm not convinced this is right.

johannes

#2 lore raw
Quoted 2 lines · Johannes Berg

I have a vague feeling that we used to have this and it broke somewhere else, and it was supposed to get added via check-lxdialog.sh...

commit d58be321df286371d50ed54e835efeea087a9fac

Author: Johannes Berg <[email protected]>
Date:   Mon Jun 3 17:54:33 2013 +0200

backports: use check-lxdialog.sh

johannes

#3 lore raw
Quoted 10 lines · Johannes Berg
Quoted 2 lines · Johannes Berg

I have a vague feeling that we used to have this and it broke somewhere else, and it was supposed to get added via check-lxdialog.sh...

commit d58be321df286371d50ed54e835efeea087a9fac

Author: Johannes Berg <[email protected]>
Date:   Mon Jun 3 17:54:33 2013 +0200

backports: use check-lxdialog.sh

I've narrowed this down a bit further. The upstream check-lxdialog.sh has not changed but I noticed we also used a bit different strategy for linking and it seems there are some shortcomings with that that I guess could be a bug. This fixes it at least for me.

Thoughts?

Quoted 1 line

From 3d8941817e410a546ad6f3f71c1a1d09926c246e Mon Sep 17 00:00:00 2001

From: "Luis R. Rodriguez" <[email protected]>
Date: Sun, 14 Sep 2014 06:05:29 -0700
Subject: [PATCH] backports: fix mconf compilation library assumptions

On OpenSUSE factory 'make menuconfig' fails to compile with:

cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2
-fomit-frame-pointer -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o
lxdialog/yesno.o lxdialog/yesno.c
cc -Wl,--no-as-needed -lncursesw mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o -o mconf
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
/lib64/libncursesw.so.5: undefined reference to symbol 'acs_map' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libtinfo.so:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Although this can be fixed by linking with -ltinfo after a bit further investigation I've traced this issue down to how we speak to the linker and ask it to link and when. For instance if one were to compile and link mconf by specifying the linker requirements before the final object file things fail and if we ask for it after things work. For instance if we ask for the libraries before:

gcc -lncursesw -o
kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

Passing the linker requirements at the end makes the gcc happy:

gcc -o kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

It seems that using -Wl,--no-as-needed does not do what we wish with regards to the above requirements, this could be a bug but the kernel treats things a bit differently so we need to adopt, fix this by being explicit by using -Wl,--add-needed and letting it figure things out automagically.

This has been tested on Debian and OpenSUSE factory.

---
 backport/kconf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
backport/kconf/Makefile +1 -1
index dfd793a..b307c65 100644
@@ -3,7 +3,7 @@ CFLAGS=-Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
 LXDIALOG := lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o
 
 conf: conf.o zconf.tab.o
-mconf: LDFLAGS = -Wl,--no-as-needed $(shell ./lxdialog/check-lxdialog.sh -ldflags $(CC))
+mconf: LDFLAGS = -Wl,--add-needed $(shell ./lxdialog/check-lxdialog.sh -ldflags $(CC))
 mconf: CFLAGS += -DCURSES_LOC="<ncurses.h>" -DLOCALE
 mconf: mconf.o zconf.tab.o $(LXDIALOG)
 
Signature · 1 line
2.0.3
#4 lore raw
Quoted 68 lines · Luis R. Rodriguez
Quoted 10 lines · Johannes Berg
Quoted 2 lines · Johannes Berg

I have a vague feeling that we used to have this and it broke somewhere else, and it was supposed to get added via check-lxdialog.sh...

commit d58be321df286371d50ed54e835efeea087a9fac

Author: Johannes Berg <[email protected]>
Date:   Mon Jun 3 17:54:33 2013 +0200

backports: use check-lxdialog.sh

I've narrowed this down a bit further. The upstream check-lxdialog.sh has not changed but I noticed we also used a bit different strategy for linking and it seems there are some shortcomings with that that I guess could be a bug. This fixes it at least for me.

Thoughts?

From 3d8941817e410a546ad6f3f71c1a1d09926c246e Mon Sep 17 00:00:00 2001
From: "Luis R. Rodriguez" <[email protected]>
Date: Sun, 14 Sep 2014 06:05:29 -0700
Subject: [PATCH] backports: fix mconf compilation library assumptions

On OpenSUSE factory 'make menuconfig' fails to compile with:

cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2
-fomit-frame-pointer -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o
lxdialog/yesno.o lxdialog/yesno.c
cc -Wl,--no-as-needed -lncursesw mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o -o mconf
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
/lib64/libncursesw.so.5: undefined reference to symbol 'acs_map' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libtinfo.so:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Although this can be fixed by linking with -ltinfo after a bit further investigation I've traced this issue down to how we speak to the linker and ask it to link and when. For instance if one were to compile and link mconf by specifying the linker requirements before the final object file things fail and if we ask for it after things work. For instance if we ask for the libraries before:

gcc -lncursesw -o
kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

Passing the linker requirements at the end makes the gcc happy:

gcc -o kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

Quoted 6 lines

It seems that using -Wl,--no-as-needed does not do what we wish with regards to the above requirements, this could be a bug but the kernel treats things a bit differently so we need to adopt, fix this by being explicit by using -Wl,--add-needed and letting it figure things out automagically.

This has been tested on Debian and OpenSUSE factory.

I have no idea what's going on, but it works for me here. I don't remember which distro originally wanted this differently, but hey ... this at least doesn't unconditionally try to link something that's not there.

johannes

#5 lore raw
Quoted 74 lines · Johannes Berg
Quoted 73 lines · Luis R. Rodriguez
Quoted 10 lines · Johannes Berg
Quoted 2 lines · Johannes Berg

I have a vague feeling that we used to have this and it broke somewhere else, and it was supposed to get added via check-lxdialog.sh...

commit d58be321df286371d50ed54e835efeea087a9fac

Author: Johannes Berg <[email protected]>
Date:   Mon Jun 3 17:54:33 2013 +0200

backports: use check-lxdialog.sh

I've narrowed this down a bit further. The upstream check-lxdialog.sh has not changed but I noticed we also used a bit different strategy for linking and it seems there are some shortcomings with that that I guess could be a bug. This fixes it at least for me.

Thoughts?

From 3d8941817e410a546ad6f3f71c1a1d09926c246e Mon Sep 17 00:00:00 2001
From: "Luis R. Rodriguez" <[email protected]>
Date: Sun, 14 Sep 2014 06:05:29 -0700
Subject: [PATCH] backports: fix mconf compilation library assumptions

On OpenSUSE factory 'make menuconfig' fails to compile with:

cc -Wall -Wmissing-prototypes -Wstrict-prototypes -O2
-fomit-frame-pointer -DCURSES_LOC="<ncurses.h>" -DLOCALE -c -o
lxdialog/yesno.o lxdialog/yesno.c
cc -Wl,--no-as-needed -lncursesw mconf.o zconf.tab.o lxdialog/checklist.o lxdialog/inputbox.o lxdialog/menubox.o
lxdialog/textbox.o lxdialog/util.o lxdialog/yesno.o -o mconf
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
/lib64/libncursesw.so.5: undefined reference to symbol 'acs_map' /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libtinfo.so:
error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Although this can be fixed by linking with -ltinfo after a bit further investigation I've traced this issue down to how we speak to the linker and ask it to link and when. For instance if one were to compile and link mconf by specifying the linker requirements before the final object file things fail and if we ask for it after things work. For instance if we ask for the libraries before:

gcc -lncursesw -o
kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

Passing the linker requirements at the end makes the gcc happy:

gcc -o kconf/mconf
kconf/mconf.o
kconf/zconf.tab.o
kconf/lxdialog/checklist.o
kconf/lxdialog/util.o
kconf/lxdialog/inputbox.o
kconf/lxdialog/textbox.o
kconf/lxdialog/yesno.o
kconf/lxdialog/menubox.o -lncursesw

It seems that using -Wl,--no-as-needed does not do what we wish with regards to the above requirements, this could be a bug but the kernel treats things a bit differently so we need to adopt, fix this by being explicit by using -Wl,--add-needed and letting it figure things out automagically.

Quoted 6 lines
Quoted 1 line

This has been tested on Debian and OpenSUSE factory.

I have no idea what's going on, but it works for me here. I don't remember which distro originally wanted this differently, but hey ... this at least doesn't unconditionally try to link something that's not there.

OK pushed.

Luis