0

I do not have much experience with Linux systems, but I decided to work on an LFS system for a bit. I understand that this was a large undertaking for my limited knowledge, but I thought I was understanding, until I got this problem. I was trying to build GCC for chapter 5 of LFS book 7.6 This is what my command sequence looks like:

cd /mnt/lfs/sources
tar -xvf gcc-4.9.1.tar.bz2
cd gcc-4.9.1
tar -xf ../mpfr-3.1.2.tar.xz
mv -v mpfr-3.1.2 mpfr
tar -xf ../gmp-6.0.0a.tar.xz
mv -v gmp-6.0.0 gmp
tar -xf ../mpc-1.0.2.tar.gz
mv -v mpc-1.0.2 mpc

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

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
sed -i 's/if \((code.*))\)/if (\1 \&\& \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c
mkdir -v ../gcc-build
cd ../gcc-build

../gcc-4.9.1/configure --target=$LFS_TGT --prefix=/tool --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++ -v
make

After running make for a while, I get this at the end of the output:

checking for i686-lfs-linux-gnu-ranlib... i686-lfs-linux-gnu-ranlib
checking for i686-lfs-linux-gnu-strip... i686-lfs-linux-gnu-strip
checking whether ln -s works... yes
checking for i686-lfs-linux-gnu-gcc... /mnt/lfs/sources/gcc-build/./gcc/xgcc -B/mnt/lfs/sources/gcc-build/./gcc/ -B/tool/i686-lfs-linux-gnu/bin/ -B/tool/i686-lfs-linux-gnu/lib/ -isystem /tool/i686-lfs-linux-gnu/include -isystem /tool/i686-lfs-linux-gnu/sys-include   
checking for suffix of object files... configure: error: in `/mnt/lfs/sources/gcc-build/i686-lfs-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Makefile:11636: recipe for target 'configure-target-libgcc' failed
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory '/mnt/lfs/sources/gcc-build'
Makefile:850: recipe for target 'all' failed
make: *** [all] Error 2

Does anyone know what I did wrong? I am sure that I did it right, but again, I am not that experienced with this sort of stuff. Thank you for your time.

1

The configure script is trying to compile a test and failing. The config.log will contain the actual compilation error.

The most likely cause is that you don't have one of libmpfr, libgmp, or libmpc installed on your host system. Make sure you install the -dev packages for these libraries using your host system's package manager. These contain the header files for these three libraries.

  • I did not have libmpfr-dev or libmpc-dev installed, but when I did sudo apt-get install for both of them and ran the make again, it still failed. What should I be looking for in the config.log file? – Codex Jul 21 '15 at 18:11
  • In your configure statement you specify --prefix=/tool. Do you actually have a symlink at the root of your file system named tool instead of tools? – Mikel Rychliski Jul 21 '15 at 18:23
  • Ok, I have looked through the config.log and not seen anything obvious, but I may have missed something. I fixed that little typo and still it won't work. I am starting to wonder if I am missing a bunch of libraries on my host system. Would you being able to see the config.log help at all? I can find the sections that you might need to help debug. With my luck it is likely something insanely stupid that I missed. Thank you for all your help so far. – Codex Jul 21 '15 at 23:31
  • I think you're on the right track about the missing libraries. Have you tried running the two scripts located here? – Mikel Rychliski Jul 22 '15 at 14:51
  • Ok, so I ran those scripts, had one thing missing. I fixed that, ran that again and now it says the same thing. Am I the only one with this problem or is there anywhere else you know of that I could look for an answer. I have looked through gcc compilation guides and have yet to find anything that helps at all. – Codex Jul 23 '15 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.