New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FS#2423 - make kernel_menuconfig fails #6139
Comments
chunkeey:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol ‘keypad’ /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfow.so.6: error adding symbols: DSO missing from command line
This seems related to this gentoo bug https://bugs.gentoo.org/457530 with the information at hand I found this "lovely" commit in linux 4:
kconfig: do not require pkg-config on make {menu,n}config
So, in order to get this fixed, you need to take this up with |
Pilatus: Looking into it, this is not an upstream issue. It's a toolchain bug, and there seem to be two related issues at play.
I haven't looked deeply enough yet to write a patch, but comment #1 is off the mark. The Gentoo bug is unrelated, and the kernel commit did not introduce a bug. |
ynezz: Can you please attach build.log.gz from the following command:
make target/linux/clean; make V=sc -j1 JOBS=1 kernel_menuconfig 2>&1 | tee build.log; gzip build.log
|
Pilatus: Please find build log here |
Pilatus: I could get the kconfig script to link by defining In the compile stage we see both the host's and the toolchain's include files read (-I/home/ta/openwrt/staging_dir/host/include -I/usr/include/ncursesw) but the configure script is linked only against the toolchain (-L/home/ta/openwrt/staging_dir/host/lib). Could this be a kernel issue after all? |
ynezz:
This is wrong as already explained in the email, this should be set properly already.
Why does it matter at all? Do you've any libncursesw in there?
objdump -T /lib64/libtinfow.so.6 | grep keypad
Or something with your system, who knows.
Maybe it's related to this? |
Pilatus:
But it isn't set. In a clean OpenWRT install, when the target/linux/Makefile is reached, STAGING_PREFIX isn't set. $ objdump -T /lib64/libtinfow.so.6 | grep keypad |
ynezz:
But why do you want it to be set? kernel_menuconfig target should be using your host compiler, includes and libraries, it shouldn't use the ones from OpenWrt, so you don't need those. Apparently kernel is using your host pkg-config, because it can find ncursesw correctly.
What does it return for you?
Ok, so then your host linker has some issues. |
Pilatus: It's not the host linker but the OpenWRT-supplied pkg-config wrapper. The pkg-config wrapper invokes pkg-config.real like so: pkg-config.real --define-variable=prefix= --define-variable=exec_prefix= --define-variable=bindir=/bin --libs ncursesw and since --define-variable fails (because $STAGING_PREFIX is not set), it returns an empty value, and the fallback values in the kernel config script are applied but those are off and the linking fails. When I used the host's pkg-config, kernel_menuconfig worked fine. $ pkg-config --libs ncursesw |
ynezz: Ok, so this is 4.14 which has broken pkg-config usage and it was fixed upstream in commits 1c5af5cf9308fff327f52c7efd2dfa732d370871 and fd65465b7016dc6d9fa5c2f39cc706c231c9a089 so 4.19 should work much better. So in order to fix it properly, you probably need to backport this patches or provide similar workaround to fix pkg-config usage within 4.14 kernel. |
Pilatus: Toolchain bug, not a kernel issue. See comment. |
Pilatus: Please find attached build log for 4.19 kernel. Also find attached build logs for 4.19 and 4.14 kernels with staging_dir/host/bin/pkg-config renamed to something else so that the kconfig script cannot find it and is forced to use the built-in ncurses detection logic. When OpenWRT's pkg-config is missing kernel_menuconfig works just fine, when it's there it fails to build. Please see comment from 09.08.2019 03:01. It's clear now that there is a problem with OpenWRT's pkg-config, in particular with the wrapper script. |
Pilatus: Attached is a build log with invocations of host pkg-config and the value of STAGING_PREFIX interspersed. All is fine, except for the targets in target/linux, where STAGING_PREFIX is undefined, and as a result, pkg-config fails and returns the empty string. For the kernel_menuconfig target you'd like to invoke the system's pkg-config instead. What is the correct thing to do? I'd suggest to check for undefined STAGING_PREFIX and when it is undefined, call /usr/bin/pkgconfig instead, so that the kernel config script can find ncurses on the host. Suggestion for a patch is attached. (Some Linux distributions split ncurses and tinfo. For those that don't, the present setup works fine, I believe.) |
ynezz:
No, this is wrong approach, don't try to hardcode the /usr/bin path, this is not portable.
It works for me here on Ubuntu 18.04.2 LTS:
objdump -T /lib/x86_64-linux-gnu/libtinfo.so.5 | grep keypad
00000000000107d0 g DF .text 0000000000000026 NCURSES_TINFO_5.0.19991023 keypad
and on Debian GNU/Linux 10 (buster) as well:
objdump -T /lib/x86_64-linux-gnu/libtinfo.so.5 | grep keypad
00000000000107d0 g DF .text 0000000000000026 NCURSES_TINFO_5.0.19991023 keypad
with the following linker command:
gcc -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/menubox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/yesno.o -lncurses
so as you can see, -lncurses is enough, no need to explicitly set -ltinfo as the linker is able to solve this dependency properly by itself. |
Pilatus: For portability we can save the location of system pkg-config early on, please see attached patch.
That's because Ubuntu has a linker file that pulls in libtinfo: For portability it's best to rely on the output of pkg-config, which insists on linking against libtinfo. |
ynezz:
Good, this looks better and might be acceptable, so please send the patch for the review https://openwrt.org/submitting-patches |
Pilatus:
On a recent Gentoo Linux installation, invoking make_kernel_menuconfig in the build system fails. make menuconfig works.
ncurses-6.1 is installed, installing ncurses-5.9 does not fix the issue.
Error message looks as follows:
ta@pythia ~/openwrt $ make kernel_menuconfig
...
make[3]: Entering directory '/home/ta/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.134'
HOSTCC scripts/kconfig/mconf.o
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTLD scripts/kconfig/mconf
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[4]: *** [scripts/Makefile.host:111: scripts/kconfig/mconf] Error 1
make[3]: *** [Makefile:525: menuconfig] Error 2
make[3]: Leaving directory '/home/ta/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.134'
...
FWIW, the following works:
ta@pythia ~/openwrt $ cd build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.134
ta@pythia ~/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.134 $ make menuconfig
This seems to be ncurses-related, but I would not know which makefile to look into to address the missing library.
The text was updated successfully, but these errors were encountered: