LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 09-07-2015, 03:18 PM   #1
thegoofeedude
Member
 
Registered: Aug 2004
Distribution: Slackware 13.37, 14.1
Posts: 75

Rep: Reputation: 17
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
$
The error above happens during the 'make' step of section 5.9 (Binutils pass 2)

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.

Thanks for your time!
 
Old 09-07-2015, 03:22 PM   #2
thegoofeedude
Member
 
Registered: Aug 2004
Distribution: Slackware 13.37, 14.1
Posts: 75

Original Poster
Rep: Reputation: 17
I also noticed the following:
Code:
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)
 
Old 09-07-2015, 06:29 PM   #3
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by thegoofeedude View Post
I also noticed the following:At this point in the build process, should I already have ld in $LFS/tools/bin? (/tools/bin is first in my PATH)
LD is Binutils, or technically part of it. Let me read the rest...
 
Old 09-07-2015, 06:37 PM   #4
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
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.

Last edited by Luridis; 09-07-2015 at 07:11 PM.
 
Old 09-07-2015, 07:30 PM   #5
anak_bawang
Member
 
Registered: Jun 2015
Location: Bandung Indonesia
Distribution: Debian, LFS/BLFS
Posts: 138

Rep: Reputation: 23
Quote:
Originally Posted by thegoofeedude View Post
Hi guys,
Code:
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 ?
 
Old 09-07-2015, 09:33 PM   #6
thegoofeedude
Member
 
Registered: Aug 2004
Distribution: Slackware 13.37, 14.1
Posts: 75

Original Poster
Rep: Reputation: 17
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
 
Old 09-07-2015, 11:01 PM   #7
thegoofeedude
Member
 
Registered: Aug 2004
Distribution: Slackware 13.37, 14.1
Posts: 75

Original Poster
Rep: Reputation: 17
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
 
Old 09-08-2015, 03:52 AM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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
 
Old 09-08-2015, 04:28 AM   #9
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by Keith Hedger View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LFS: Error during GCC-4.7.1-Pass 1 (LFS 7.2, Section 5.5) erkant Linux From Scratch 7 11-28-2012 06:03 AM
[SOLVED] LFS: Error during Binutils-2.22 - Pass 1 (Section 5.4, LFS 7.2) erkant Linux From Scratch 4 11-26-2012 01:26 PM
[SOLVED] lfs 6.7 book ch 5.4 binutils 2.20.1 pass 1 error:error: ppl_c.h: No such file or directory frank zhu Linux From Scratch 6 03-04-2011 11:23 AM
LFS binutils-build error : Pass 1 ramlnx Linux From Scratch 1 07-12-2006 07:06 AM
binutils first pass make install failure in LFS-6.0 dibyadeep Linux From Scratch 3 01-05-2005 03:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration