LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-15-2015, 08:06 AM   #1
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Rep: Reputation: Disabled
where are crt1.o, crti.o, ........


Hello

on page
http://www.linuxfromscratch.org/lfs/...r05/glibc.html

I did the glibc test. "$LFS_TGT-gcc dummy.c" breaks with the issue:
Code:
/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/bin/ld: cannot find -lc
/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
My LFS installed these missing files in
"/mnt/tools/lib/"
 
Old 03-15-2015, 11:31 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
"/mnt/tools/lib/"
It should have been installed in /tools/lib and because of symlink in /mnt/lfs/tools/lib.
 
Old 03-16-2015, 05:43 AM   #3
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Hello
Sorry I told the wrong path to you.

Quote:
Originally Posted by veerain View Post
It should have been installed in /tools/lib and because of symlink in /mnt/lfs/tools/lib.
This is my path too. But the problem does not disappear. I catched the issues of "$LFS_TGT-gcc dummy.c" by "strace"
Code:
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/i686-lfs-linux-gnu/4.9.1/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/i686-lfs-linux-gnu/4.9.1/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/crt1.o", R_OK)     = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/i686-lfs-linux-gnu/4.9.1/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/i686-lfs-linux-gnu/4.9.1/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/i686-lfs-linux-gnu/4.9.1/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/crti.o", R_OK)     = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/i686-lfs-linux-gnu/4.9.1/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/crti.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/crtbegin.o", R_OK) = 0
stat64("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/mnt/lfs/tools/bin/../lib/gcc/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/i686-lfs-linux-gnu/4.9.1/.", 0xbfc0f960) = -1 ENOENT (No such file or directory)
stat64("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/mnt/lfs/lib/i686-lfs-linux-gnu/4.9.1/.", 0xbfc0f960) = -1 ENOENT (No such file or directory)
stat64("/mnt/lfs/lib/.", 0xbfc0f960)    = -1 ENOENT (No such file or directory)
stat64("/mnt/lfs/usr/lib/i686-lfs-linux-gnu/4.9.1/.", 0xbfc0f960) = -1 ENOENT (No such file or directory)
stat64("/mnt/lfs/usr/lib/.", 0xbfc0f960) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/crtend.o", R_OK) = 0
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/i686-lfs-linux-gnu/4.9.1/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/tools/bin/../lib/gcc/i686-lfs-linux-gnu/4.9.1/../../../../i686-lfs-linux-gnu/lib/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/i686-lfs-linux-gnu/4.9.1/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/lib/crtn.o", R_OK)     = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/i686-lfs-linux-gnu/4.9.1/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/lfs/usr/lib/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
stat64("/mnt/lfs/tools/bin/../libexec/gcc/i686-lfs-linux-gnu/4.9.1/collect2", {st_mode=S_IFREG|0755, st_size=1621545, ...}) = 0
access("/mnt/lfs/tools/bin/../libexec/gcc/i686-lfs-linux-gnu/4.9.1/collect2", X_OK) = 0
It does not look to "/mnt/lfs/tools/lib/..". So I linked "/mnt/lfs/usr/lib" to "/mnt/lfs/tools/lib". Now all things works fine and I receive the message "[Requesting program interpreter: /tools/lib/ld-linux.so.2]"
This is not the way the LFS book describes it. Have you a hint to get out of this troubles?
 
Old 03-16-2015, 10:58 PM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Try finding the file in fs tree by:

Code:
find /tools -name "crt1.o"
Report where it is present. Have you setup your environment variables correct?
 
Old 03-18-2015, 05:16 AM   #5
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Hello

Quote:
Originally Posted by veerain View Post
Try finding the file in fs tree by:

Code:
find /tools -name "crt1.o"
Report where it is present. Have you setup your environment variables correct?
The answer of:
Code:
find -L /tools -name "crt1.o"
is
"/tools/lib/crtl.o"

"/home/lfs/.bashrc"
Code:
set +h
umask 022
LC_ALL=POSIX
LFS=/mnt/lfs
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LSF_TGT PATH
 
Old 03-18-2015, 10:27 AM   #6
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
What build commands have you used for building binutils and gcc pass1.
 
Old 03-20-2015, 05:45 AM   #7
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
What build commands have you used for building binutils and gcc pass1.
I cut this from "/home/lfs/.bash_history"

Code:
../binutils-2.24/configure --prefix=/tools  --with-sysroot=$LFS --with-lib-path=/lfs/tools/lib --target=$LFS_TGT --disable-nls --disable-werror
Code:
../gcc-4.9.1/configure --target=$LFS_TGT --prefix=/tools --with-sysroot=$LFS --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libitm --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libstdc++-v3 --enable-languages=c,c++
 
Old 03-20-2015, 07:53 AM   #8
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
--with-lib-path=/lfs/tools/lib
You have given a wrong path. This might be the cause of problem.
 
Old 03-21-2015, 03:40 PM   #9
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
You have given a wrong path. This might be the cause of problem.
Sorry, this is not the solution.

I am look for another trace. This Issue from above indicates this line:
Code:
access("/mnt/lfs/usr/lib/crtn.o", R_OK) = -1 ENOENT (No such file or directory)
ch_ld-gcc
The "usr" should be a "tools".

This is the page on LFS book
http://www.linuxfromscratch.org/lfs/...gcc-pass1.html
In this page there are words like this: "...while the second one replaces hard-coded instances of “/usr”." It deals of the sixth line in the following
file "ch_ld-gcc". Replacing "usr" by "tools".
Code:
for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do 
cp -uv $file{,.orig} 
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
    -e 's@/usr@/tools@g' $file.orig > $file 
echo '
#undef STANDART_STARTFILE_PREFIX_1
#undef STANDART_STARTFILE_PREFIX_2
#define STANDART_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDART_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
Maybe there is a mistake in this or the "sed" function does not work. Path is "/bin/ch_ld-gcc" in Debian. Activating this file it only shows the copies of the first, second and third line.
How can I check the performance of the last lines?
 
Old 03-22-2015, 12:40 AM   #10
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by michanux View Post
Sorry, this is not the solution.
How you know unless you test it.

The problems arises with use of 'ld' command; part of binutils. And you given wrong arguments while building it. Particulary the default library path it looks for.
 
Old 03-26-2015, 04:01 PM   #11
michanux
LQ Newbie
 
Registered: Jan 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Code:
for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do 
cp -uv $file{,.orig} 
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
    -e 's@/usr@/tools@g' $file.orig > $file 
echo '
#undef STANDART_STARTFILE_PREFIX_1
#undef STANDART_STARTFILE_PREFIX_2
#define STANDART_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDART_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
After the last line I add the command "done". So this troubles disappear!
 
  


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
Second pass gcc does not recognize crti.o michanux Linux From Scratch 1 02-14-2015 10:57 AM
crti.o & crt1.o are not working properly in my OEL 6 suresh dba Linux - Newbie 4 04-16-2013 09:41 AM
[SOLVED] No crti.o or crt1(l?).o after first pass of glibc. tfnc99 Linux From Scratch 2 11-18-2012 11:01 AM
command to make crt1.o from a crt1.S manoj7410 Linux - Embedded & Single-board computer 1 06-12-2012 03:12 AM

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

All times are GMT -5. The time now is 06:31 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