Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unable to run make menuconfig for kernel sources[solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1510

PostPosted: Sun Jan 23, 2022 2:26 pm    Post subject: Unable to run make menuconfig for kernel sources[solved] Reply with quote

I am trying to install gentoo on my sony xperia m mobile phone.
I have downloaded the stage3 archive and extracted, I have git cloned the sources from the following link:
https://github.com/icoolguy1995/sony-xperia-m-kernel

I cd into the directory and run make menuconfig to find the following error:
Code:
localhost ~/kernel/sony-xperia-m-kernel # make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: /lib/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.host:127: scripts/kconfig/mconf] Error 1
make: *** [Makefile:497: menuconfig] Error 2


any help would be appreciated


Last edited by Adel Ahmed on Sun Jan 30, 2022 6:04 am; edited 1 time in total
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3872

PostPosted: Sun Jan 23, 2022 4:56 pm    Post subject: Reply with quote

May be
https://github.com/samtools/samtools/issues/1149
Code:

./configure;make menuconfig

_________________
:)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Sun Jan 23, 2022 5:21 pm    Post subject: Re: Unable to run make menuconfig for kernel sources Reply with quote

Adel Ahmed wrote:
I cd into the directory and run make menuconfig to find the following error:
Code:
localhost ~/kernel/sony-xperia-m-kernel # make menuconfig
  HOSTLD  scripts/kconfig/mconf
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: /lib/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.host:127: scripts/kconfig/mconf] Error 1
make: *** [Makefile:497: menuconfig] Error 2
What is the full command line used to invoke the linker for this file? Typically, this error would indicate that you should have linked to an additional DSO, and did not. In this case, the second error even seems to point you in the right direction. Specifically, you should have linked to libtinfow.so.6 to get this symbol, and did not.
alamahant wrote:
May be
https://github.com/samtools/samtools/issues/1149
Code:
./configure;make menuconfig
Could you elaborate? The kernel normally doesn't have a configure script at all, so I don't see how to apply this advice. Also, if it did apply, shouldn't it be ./configure && make menuconfig? Usually, running make after configure fails will not be useful.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3872

PostPosted: Sun Jan 23, 2022 6:03 pm    Post subject: Reply with quote

Well the url refers to Gentoo with the same kind of error.
I should have known better the url case probably concerns some ordinary package whereas here we are dealing with a kernel.
Sorry Hu for my lapse of judgement.
_________________
:)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Sun Jan 23, 2022 9:19 pm    Post subject: Reply with quote

You meant well. Maybe next time, check locally whether the instructions make sense? :) New users might see your response, try it, and get confused or frustrated when it doesn't work, because they think they're doing it wrong, rather than that the advice is not applicable to the problem at hand.
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1510

PostPosted: Tue Jan 25, 2022 1:40 am    Post subject: Reply with quote

the kernel does not indeed have a configure script.
what do you mean by what is the linker command? how can I find this out?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1490
Location: South America

PostPosted: Tue Jan 25, 2022 11:16 am    Post subject: Reply with quote

Adel Ahmed wrote:
how can I find this out?

Use make V=1 menuconfig. The build should fail again, but this time it should print the full compiler / linker invocation instead of "HOSTLD scripts/kconfig/mconf".
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1510

PostPosted: Tue Jan 25, 2022 11:35 am    Post subject: Reply with quote

thanks for the clarification:
Code:
make -f scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
mkdir -p include/linux include/config
make -f scripts/Makefile.build obj=scripts/kconfig menuconfig
/bin/sh /root/kernel/sony-xperia-m-kernel/scripts/kconfig/lxdialog/check-lxdialog.sh -check gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DLOCALE  -lncursesw
  gcc  -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/yesno.o scripts/kconfig/lxdialog/menubox.o  -lncursesw
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: /lib/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.host:127: scripts/kconfig/mconf] Error 1
make: *** [Makefile:497: menuconfig] Error 2
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1490
Location: South America

PostPosted: Tue Jan 25, 2022 3:46 pm    Post subject: Reply with quote

The kernel for the Sony Xperia from the Git repository that you are using is based on a old upstream version (3.4.0), and the detection logic for the Ncurses libraries contained in its scripts/kconfig/lxdialog/check-lxdialog.sh script won't work. Newer kernels use a different script (scripts/kconfig/mconf-cfg.sh) with a detection logic based on the pkg-config program, which is more robust. If you really want to use that particular kernel, it looks like you'll have to modify check-lxdialog.sh's ldflags() function so that it returns -lncursesw -ltinfow.
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1510

PostPosted: Wed Jan 26, 2022 9:56 am    Post subject: Reply with quote

I have changed the ldflags function from :
Code:
ldflags()
{
        for ext in so a dylib ; do
                for lib in ncursesw ncurses curses ; do
                        $cc -print-file-name=lib${lib}.${ext} | grep -q /
                        if [ $? -eq 0 ]; then
                                echo "-l${lib}"
                                exit
                        fi
                done
        done
        exit 1
}


to
Code:
ldflags()
{
        for ext in so a dylib ; do
                for lib in 'ncursesw tinfow' 'ncurses tinfow' 'curses tinfow' ; do
                        $cc -print-file-name=lib${lib}.${ext} | grep -q /
                        if [ $? -eq 0 ]; then
                                echo "-l${lib}"
                                exit
                        fi
                done
        done
        exit 1
}


but now I'm getting:
Code:
localhost ~/kernel/sony-xperia-m-kernel # make V=1 menuconfig                      make -f scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
mkdir -p include/linux include/config
make -f scripts/Makefile.build obj=scripts/kconfig menuconfig
/bin/sh /root/kernel/sony-xperia-m-kernel/scripts/kconfig/lxdialog/check-lxdialog.sh -check gcc -I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>" -DLOCALE
  gcc  -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/yesno.o scripts/kconfig/lxdialog/menubox.o
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/mconf.o: in function `show_help':
mconf.c:(.text+0xadc): undefined reference to `stdscr'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/mconf.o: in function `main':
mconf.c:(.text.startup+0x88): undefined reference to `initscr'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: mconf.c:(.text.startup+0x180): undefined reference to `stdscr'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: scripts/kconfig/lxdialog/checklist.o: in function `print_arrows':
checklist.c:(.text+0x30): undefined reference to `wmove'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: checklist.c:(.text+0x60): undefined reference to `waddch'
/usr/lib/gcc/armv7a-unknown-linux-gnueabihf/11.2.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: checklist.c:(.text+0x74): undefined reference to `waddnstr'


I have not included the entire log as they are mostly undefined reference to errors.
is there any way to get around this without having to work around the errors 1 by 1?
I cannot use the latest gentoo-sources as this is a mobile phone and getting a working kernel that way will involve much more work(not just configuring and compiling, but porting the kernel to the phone).
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21431

PostPosted: Wed Jan 26, 2022 4:23 pm    Post subject: Reply with quote

Adel Ahmed wrote:
I have changed the ldflags function from :
to
Code:
ldflags()
{
        for ext in so a dylib ; do
                for lib in 'ncursesw tinfow' 'ncurses tinfow' 'curses tinfow' ; do
                        $cc -print-file-name=lib${lib}.${ext} | grep -q /
This change looks wrong to me. I doubt you have a file named libncurses tinfow.so, and even if you did, the $cc line isn't quoted properly to find it. You need the script to print -lncursesw -ltinfow or similar, depending on whether you want narrow or wide ncurses. Since you are already hacking up the build system, you could try replacing the entire function with just:
Code:
ldflags() {
   printf '%s ' -lncurses -ltinfo
}
Again, adjust the narrow/wide as appropriate.
Adel Ahmed wrote:
but now I'm getting:
Code:
  gcc  -o scripts/kconfig/mconf scripts/kconfig/mconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/lxdialog/checklist.o scripts/kconfig/lxdialog/util.o scripts/kconfig/lxdialog/inputbox.o scripts/kconfig/lxdialog/textbox.o scripts/kconfig/lxdialog/yesno.o scripts/kconfig/lxdialog/menubox.o
This line shows your change had no effect on the linker, or maybe even negative effect. Now it is not trying to link any ncurses or tinfo libraries at all. That will definitely cause the undefined reference errors you showed.
Adel Ahmed wrote:
is there any way to get around this without having to work around the errors 1 by 1?
Use a version where someone has already fixed this, or find and install an ancient toolchain that was current when this kernel was forked from mainline.
Adel Ahmed wrote:
I cannot use the latest gentoo-sources as this is a mobile phone and getting a working kernel that way will involve much more work(not just configuring and compiling, but porting the kernel to the phone).
The code for this phone was never merged to mainline?
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1510

PostPosted: Sun Jan 30, 2022 6:00 am    Post subject: Reply with quote

I have changed the function to :
Code:
ldflags() {
   printf '%s ' -lncurses -ltinfo
}

and it works now thank you.
unfortunately the code was never merged into the mainline :(.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum