LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 10-13-2011, 05:21 PM   #1
elagano
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Rep: Reputation: Disabled
Question Constructing a Temporary System - Binutils - Pass 2 Question


I am playing with LFS (again), but not following the directions exaclty (playing with uClibc) and currently building Temporary System under /tools. The question that I have is why in binutils run 1 there is --target=$LFS_TGT parameter, while in binutils run 2 there is no such parameter.

The thing is that before running binutils run2 I have the following:
$ echo ${LFS_TGT}
x86_64-lfs-linux-uclibc
sources$ gcc-4.6.1/config.guess
x86_64-unknown-linux-gnu


and binutils is then installed into /tools/x86_64-unknown-linux-gnu

Here is how binutils run2 is configured:

CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../binutils-2.21.1/configure --prefix=/tools \
--disable-nls --with-lib-path=/tools/lib

the environment seems to be fine:

$ echo $LFS_TGT-gcc
x86_64-lfs-linux-uclibc-gcc
$ echo $LFS_TGT-ar
x86_64-lfs-linux-uclibc-ar
$ echo $LFS_TGT-ranlib
x86_64-lfs-linux-uclibc-ranlib




Which step in LFS book ensures that upon building binutils run2, config.guess returns ${LFS_TGT}?
 
Old 10-14-2011, 08:16 AM   #2
magiknight
Member
 
Registered: Oct 2003
Posts: 37

Rep: Reputation: 4
Quote:
Originally Posted by elagano View Post
I am playing with LFS (again), but not following the directions exaclty (playing with uClibc) and currently building Temporary System under /tools. The question that I have is why in binutils run 1 there is --target=$LFS_TGT parameter, while in binutils run 2 there is no such parameter.

The thing is that before running binutils run2 I have the following:
$ echo ${LFS_TGT}
x86_64-lfs-linux-uclibc
sources$ gcc-4.6.1/config.guess
x86_64-unknown-linux-gnu


and binutils is then installed into /tools/x86_64-unknown-linux-gnu

Here is how binutils run2 is configured:

CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../binutils-2.21.1/configure --prefix=/tools \
--disable-nls --with-lib-path=/tools/lib

the environment seems to be fine:

$ echo $LFS_TGT-gcc
x86_64-lfs-linux-uclibc-gcc
$ echo $LFS_TGT-ar
x86_64-lfs-linux-uclibc-ar
$ echo $LFS_TGT-ranlib
x86_64-lfs-linux-uclibc-ranlib




Which step in LFS book ensures that upon building binutils run2, config.guess returns ${LFS_TGT}?
None, straight from the book itself...
"CC="$LFS_TGT-gcc -B/tools/lib/" AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib
Because this is really a native build of Binutils, setting these variables ensures that the build system uses the cross-compiler and associated tools instead of the ones on the host system."

Binutils pass 1 was only ment to build the cross-compiler (not sure why you really need one since LFS only supports 1 arch).

What you are seeing is normal, you are building a NORMAL build of binutils with a cross-compiler.

Last edited by magiknight; 10-14-2011 at 08:24 AM.
 
Old 10-14-2011, 11:44 AM   #3
elagano
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks, I guess my subsequent GCC pass2 issue is unrelated to Binutils run2:


/mnt/lfs/sources/gcc-build/./gcc/xgcc -B/mnt/lfs/sources/gcc-build/./gcc/ -B/tools/x86_64-unknown-linux-gnu/bin/ -B/tools/x86_64-unknown-linux-gnu/lib/ -isystem /tools/x86_64-unknown-linux-gnu/include -isystem /tools/x86_64-unknown-linux-gnu/sys-include -O2 -g -O2 -DIN_GCC -fomit-frame-pointer -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/tools/x86_64-unknown-linux-gnu/bin/ranlib libgcc.a
/tools/x86_64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory

This is Linux From Scratch - Version SVN-20111013
 
Old 10-15-2011, 12:05 AM   #4
magiknight
Member
 
Registered: Oct 2003
Posts: 37

Rep: Reputation: 4
Quote:
Originally Posted by elagano View Post
Thanks, I guess my subsequent GCC pass2 issue is unrelated to Binutils run2:

/tools/x86_64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory

This is Linux From Scratch - Version SVN-20111013
Physically look for this file, does it exist?
if it does, then I have a workaround for ld not linking against crti.o, it has nothing to do with ld at all, it's gcc's fault, it cant access the the file directly because of the assumption that crti.o is living is /usr/lib

Can you make a symlink from /tools/lib64 to /tools/lib? then rebuild gcc and see if that helps?
 
Old 10-26-2011, 04:37 PM   #5
elagano
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by magiknight View Post
Physically look for this file, does it exist?
if it does, then I have a workaround for ld not linking against crti.o, it has nothing to do with ld at all, it's gcc's fault, it cant access the the file directly because of the assumption that crti.o is living is /usr/lib

Can you make a symlink from /tools/lib64 to /tools/lib? then rebuild gcc and see if that helps?
$ ls -l /tools
lrwxrwxrwx 1 root root 15 Oct 26 19:49 /tools -> /mnt/lfs/tools/

$ ls -l $LFS/tools/lib64
lrwxrwxrwx 1 lfs lfs 3 Oct 26 19:50 /mnt/lfs/tools/lib64 -> lib

$ ls -l $LFS/tools/lib64/crt*
-rw-r--r-- 1 lfs lfs 3637 Oct 26 21:07 /mnt/lfs/tools/lib64/crt1.o
-rw-r--r-- 1 lfs lfs 1512 Oct 26 21:07 /mnt/lfs/tools/lib64/crti.o
-rw-r--r-- 1 lfs lfs 1108 Oct 26 21:07 /mnt/lfs/tools/lib64/crtn.o

Still the same issue
Hope this helps
 
Old 10-26-2011, 05:52 PM   #6
magiknight
Member
 
Registered: Oct 2003
Posts: 37

Rep: Reputation: 4
Try removing the gcc-build and gcc-4.6.1 and starting over from there and append this to the top of the configure line.
Code:
 LDFLAGS="-Wl,-rpath,/tools/lib"
 
Old 10-27-2011, 09:05 AM   #7
elagano
LQ Newbie
 
Registered: Oct 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Never mind. I just found out that I forgot to apply gcc-4.6.1-startfiles_fix-1.patch
Sorry for the trouble and thank you for assistance.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
binutils 2.20/gcc-4.5.1 build pass 2 reverts to targeting the host system anakinwy Linux From Scratch 2 11-11-2010 03:21 PM
pass 2 of binutils giraf Linux From Scratch 2 07-18-2010 08:34 PM
5.3. Binutils-2.17 - Pass 1 willz06jw Linux From Scratch 5 09-24-2008 02:54 AM
questions on GCC-3.4.3 - Pass 2 and Binutils-2.15.94.0.2.2 - Pass 2 satimis Linux From Scratch 7 12-26-2005 09:23 PM
Binutils-pass 1 v. 6.1 microsoft/linux Linux From Scratch 10 09-04-2005 07:27 AM


All times are GMT -5. The time now is 02:21 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration