[SOLVED] Following LFS 7.4 instruction to build gcc,encountering problem during configuration.
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.
Following LFS 7.4 instruction to build gcc,encountering problem during configuration.
According to the instruction i extracted mpc,gmp and mpfr in gcc source directory and renamed them as instructed.
But i am getting following error
Code:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for gcc... x86_64-monty-linux-gnu-gcc
checking for C compiler default output file name...
configure: error: in `/mnt/monty/sources/gcc-build':
configure: error: C compiler cannot create executables
See `config.log' for more details.
To druuna,
Thanks for your reply and support,i really appreciate it.And yes,it is my first lfs build.
Now,regarding the topic, I did't thought that renaming would affect it, after all it was just a variable.
And i only changed the name 'lfs' up until now.I did not made any changes in configure or added any option anywhere,from what was given in the book.
But,i did change .bashrc file accordingly(where i renamed LFS_TGT to MONTY_TGT and any instances with word 'lfs' with it.)
But if it has so much adverse effect then i think, i can start again from the start.
Please also mention what you suggest i do.
Now,regarding the topic, I did't thought that renaming would affect it, after all it was just a variable.
And i only changed the name 'lfs' up until now.I did not made any changes in configure or added any option anywhere,from what was given in the book.
But,i did change .bashrc file accordingly(where i renamed LFS_TGT to MONTY_TGT and any instances with word 'lfs' with it.)
But if it has so much adverse effect then i think, i can start again from the start.
Please also mention what you suggest i do.
I would recommend starting from scratch. Don't change anything until you have a good idea what the impact might be.
Changing LFS=/mnt/lfs to LFS=/mnt/monty is probably harmless, but why do you want to do so? This directory won't even be part of the final LFS build.
Changing the variable name LFS_TGT to MONTY_TGT is not a smart move. The content of this variable is used in multiple chapters and you have to change all those chapters to accommodate the new variable name. Forget it once and you might have to start from scratch again.
Building and understanding LFS when doing this for the first time is hard enough as it is. Stick to the book.
I again started started from scratch and strictly followed the book,without changing anything.
Now,i have encountered new errors in gcc.
Before configuration of GCC we run the following code which is not showing any output
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 STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
done
I saw this step in a youtube LFS video and it is showing some processing and output, what is the problem here?
After this, i did the configure steps, which executed successfully without any errors.
But,when i ran make,it showed followings errors.
bgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && ln -s libgcc_s.so.1 32/libgcc_s.so
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find crti.o: No such file or directory
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find -lc
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make[4]: *** [libgcc_s.so] Error 1
make[4]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/32/libgcc'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgcc'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-lfs-linux-gnu/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2
I saw this step in a youtube LFS video and it is showing some processing and output, what is the problem here?
The bold part should produce output due to the -v option, the other parts don't show any output (assuming all went well).
Quote:
Originally Posted by AbhinavKumar
But,when i ran make,it showed followings errors.
bgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && ln -s libgcc_s.so.1 32/libgcc_s.so
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find crti.o: No such file or directory
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find -lc
/tools/bin/x86_64-lfs-linux-gnu-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
Three things come to mind:
1 - Did you clean up everything when you started again?
2 - Is the tools symlink set correctly? (ls -l /tools should output something like this: tools -> /mnt/lfs/tools/)
3 - crti.o and crtn.o are part of libc (glibc) and at this stage it must be provided by the host. You might need to install the dev version. I'm not an ubuntu user, but look for and install libc6-dev
BTW: You need to provide specific information in order for us to be able to help you.
- The version of the book being used, (I'm assuming LFS 7.4 stable)
- The host distribution being used, (I'm assuming Ubuntu, but which version) - The output from the Host System Requirements section,(already provided)
- The package and section the problem was encountered in, (I'm assuming 5.5. GCC-4.8.1 - Pass 1)
EDIT: I just noticed this isn't posted in the LFS sub-forum. I've ask a moderator to move it. This way you get the exposure it needs.
The bold part should produce output due to the -v option, the other parts don't show any output (assuming all went well).
Three things come to mind:
1 - Did you clean up everything when you started again?
2 - Is the tools symlink set correctly? (ls -l /tools should output something like this: tools -> /mnt/lfs/tools/)
3 - crti.o and crtn.o are part of libc (glibc) and at this stage it must be provided by the host. You might need to install the dev version. I'm not an ubuntu user, but look for and install libc6-dev
1.I formatted the entire lfs partition before starting again.
2.The tools symlink was broken after i had formatted the partition, but i unlinked it and then made a new symlink when it was required and its working.
3.I installed libc6-dev but there are many other libc6-dev packages like libc6-dev-amd64:i386, libc6-dev-1386, libc6-dev-x32, are those also neccessary?
Quote:
Originally Posted by druuna
BTW: You need to provide specific information in order for us to be able to help you.
- The version of the book being used, (I'm assuming LFS 7.4 stable)
- The host distribution being used, (I'm assuming Ubuntu, but which version) - The output from the Host System Requirements section,(already provided)
- The package and section the problem was encountered in, (I'm assuming 5.5. GCC-4.8.1 - Pass 1)
-Using LFS-7.4 stable
-Ubuntu 13.10
-output already provided
-5.5. GCC-4.8.1 - Pass 1, 5.5.1. Installation of Cross GCC(just after unpacking and renaming).
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' \
makes a backup copy of every file named linux64.h or linux.h or sysv4.h in the gcc-4.8.1/gcc/config directory, adding .orig to the end of the filename. Then it scans each of the original files (the ones without the .orig extension) and wherever it finds the strings "lib/ld" or "lib64/ld" or "lib32/ld" it replaces it with "tools". So it should be easy for you to look and see if this has happened.
Note that you must be in the gcc-4.8.1 directory when you run that command.
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' \
makes a backup copy of every file named linux64.h or linux.h or sysv4.h in the gcc-4.8.1/gcc/config directory, adding .orig to the end of the filename. Then it scans each of the original files (the ones without the .orig extension) and wherever it finds the strings "lib/ld" or "lib64/ld" or "lib32/ld" it replaces it with "tools". So it should be easy for you to look and see if this has happened.
Note that you must be in the gcc-4.8.1 directory when you run that command.
I understand the meaning of the command and i checked linx.h had orig extension but when i checked its content, "lib/ld" or or "lib64/ld" or "lib32/ld" wasn't replaced with "tools".
Also, i checked the subdirectories for files named linux.h and linux64.h, but they didn't had ".orig" extension, only the linux.h in the immediate directory i.e in gcc/config was affected, please clarify that the subdirectory in gcc/config should be affected or not?
Please suggest a solution.
Thanks in advance.
Actually I explained that incorrectly. It doesn't replace the path with "tools". Instead, it adds "/tools" to the beginning of each path. So for example, /lib/ld becomes /tools/lib/ld, /lib64/ld becomes /tools/lib64/ld, and so on.
Then the next line replaces "/usr" with "/tools" in a couple of these files.
This command definitely affects files in the subdirectories under gcc/config. This is the output you should get, listing all of the files that are affected:
for file in $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
echo "
$file:
"
grep -n "/tools" $file
done
That won't change anything, but it will give you a listing of those files showing the line numbers and lines where "/tools" now appears.
If you don't get that output:
maybe you're not in the correct directory [gcc-4.8.1] when you ran the command, or
maybe your copy of gcc-4.8.1.tar.bz2 was corrupted & must be downloaded again
Are you sure that your user's shell is bash? To check that:
Code:
echo $SHELL
Are you sure that /bin/sh points to bash (and not dash)? To check that:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.