[SOLVED] LFS 7.7 Section 5.9 (binutils second pass) error during make
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
LFS 7.7 Section 5.9 (binutils second pass) error during make
Hi guys,
I'm building LFS 7.7 on Ubuntu 14.04, and have run into my first compile error:
Code:
/bin/sh ../../binutils-2.25/binutils/../ylwrap ../../binutils-2.25/binutils/syslex.l lex.yy.c syslex.c -- /mnt/lfs/sources/binutils-2.25/missing flex
WARNING: `flex' is missing on your system. You should only need it if
you modified a `.l' file. You may need the `Flex' package
in order for those modifications to take effect. You can get
`Flex' from any GNU archive site.
x86_64-lfs-linux-gnu-gcc -c -I. -I../../binutils-2.25/binutils -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 ../../binutils-2.25/binutils/syslex_wrap.c
In file included from ../../binutils-2.25/binutils/syslex_wrap.c:25:0:
./syslex.c:1:1: warning: return type defaults to 'int' [-Wreturn-type]
main() { return 0; }
^
./syslex.c:1:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
x86_64-lfs-linux-gnu-gcc -g -O2 -o sysinfo sysinfo.o syslex_wrap.o
syslex_wrap.o: In function `main':
/mnt/lfs/sources/binutils-build/binutils/./syslex.c:1: multiple definition of `main'
sysinfo.o:/mnt/lfs/sources/binutils-build/binutils/sysinfo.y:409: first defined here
sysinfo.o: In function `yyparse':
/mnt/lfs/sources/binutils-build/binutils/sysinfo.c:1177: undefined reference to `yylex'
collect2: error: ld returned 1 exit status
make[2]: *** [sysinfo] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/binutils-build/binutils'
make[1]: *** [all-binutils] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/binutils-build'
make: *** [all] Error 2
Last command had exit code: 2 at 15:25
lfs@nathan-VirtualBox:/mnt/lfs/sources/binutils-build
$
I initially tried the build with 'make -j4', and when it failed, I cleaned up and tried again without the -j flag. The output above is from that second attempt.
I'm wondering if there is a dependency that isn't properly met on my host system; I have a /lot/ of details around this build at this GH gist, which I'm using as a scratchpad for notes as well as a potential article/series of articles on LFS for my blog.
lfs@nathan-VirtualBox:/mnt/lfs/sources/binutils-build
$ which ld
/usr/bin/ld
Last command had exit code: 0 at 16:20
lfs@nathan-VirtualBox:/mnt/lfs/sources/binutils-build
$
At this point in the build process, should I already have ld in $LFS/tools/bin? (/tools/bin is first in my PATH)
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
Did you build libstdc++ and install it... What did your version-check.sh report about your host system's installation of Bison and yacc link?
Just open a root console on your host and run this /usr/bin/yacc --version.
Other possible issues: What's in $PATH, $LFS and $LFS_TGT & $LC_ALL. Because this is easy to miss: source ~/.bash_profile at the end of setting up the user lfs.
EDIT: Just found your link, I didn't notice it at first. Couple of other things to try...
Stop using -j4. I stopped at least 3 LFS versions ago because it caused all sorts of sneakysht errors that cropped up without rhyme or reason ANYWHERE in the build. Additionally the only optimizations I use is -march=native -O2 and only during the final system build.
If it persists, try something other than a Debian based distro. My last two attempts on Debian systems resulted in chronic weirdness (strange test errors) and eventual failure to continue.
sysinfo.o:/mnt/lfs/sources/binutils-build/binutils/sysinfo.y:409: first defined here
sysinfo.o: In function `yyparse':
/mnt/lfs/sources/binutils-build/binutils/sysinfo.c:1177: undefined reference to `yylex'
collect2: error: ld returned 1 exit status
make[2]: *** [sysinfo] Error 1
$
From log above, I just curious, is there any Bison installed in tour host system.
Have you already run "version-check.sh", and pass all the requirements ?
Luridis: Thank you for your reply! I noticed that 'ld' isn't in tools/bin even after the first pass at Binutils. I bet that portion of the build failed and I didn't notice.
I'm going to start again, and this time pay very close attention to the first passes and their outputs. I'll also avoid using j4. If it fails again, then I'll go ahead and try with another host distro (probably Slackware, as I'm very familiar with it; do you have any recommendations?)
anak_bawang: Thank you for your reply! The github gist I linked in the first post has all the details about this system, including annotated output from version-check.sh: https://gist.github.com/nathanbw/36bcfb6cbf8770873c7d
I'm gonna have to call it a night today; I'll update this thread with progress as I make it :-D
I was headed to bed but couldn't resist one more stab at it. It turns out that binutils had failed to build on the first pass, due to flex not existing on the system. The correct version of Bison was installed and /usr/bin/yacc was the correct symlink (version-check.sh output showed that), but flex also needs to be installed on a system in order to build binutils (See this mailing list thread from the binutils mailing list: https://sourceware.org/ml/binutils/2.../msg00151.html )
Once I installed flex ('apt-get install flex' as root on my Ubuntu 14.04 host), I was able to successfully build the first and second passes of binutils. I'll hopefully continue with this build soon; for the moment, I'll have to focus on work during the day and my growing family in the evening :-p
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
If you want to run 'make' on multiple cores use
Code:
make -j3||make
This way if the make can't handle parallel builds it fails and tries 'make' which defaults to -j1, of course replace 'j3' with the number of cores you want to use, this gives you the best of both worlds, speedier builds on makefiles that support it, falling back to serial builds if it doesn't
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
Quote:
Originally Posted by Keith Hedger
If you want to run 'make' on multiple cores use
Code:
make -j3||make
This way if the make can't handle parallel builds it fails and tries 'make' which defaults to -j1, of course replace 'j3' with the number of cores you want to use, this gives you the best of both worlds, speedier builds on makefiles that support it, falling back to serial builds if it doesn't
Doesn't always fail... I've had bugs show up later, went back and rebuilt without parallel and it was fine. I find it the biggest issue in the temporary tools, where I don't run tests.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.