LFS 9.0: Cannot make gcc, multiple errors in config.log
Working through the current LFS 9.0 tutorial and have encountered a hard error in section 5.5.1, compiling GCC.
Background: The host environment is a Vagrant VM (on a Mac) running Ubuntu 18.04.3 LTS Bionic with 30GB space. I was a developer but have essentially no Linux or C++ experience beyond a C++ class in college a few years ago, so I can bob my head along and follow a discussion generally but can't do them per se. When running make (towards the end of 5.5) I get the following error at the end after about 15 minutes: Code:
checking for suffix of object files... configure: error: in `/mnt/lfs/sources/gcc-9.2.0/build/x86_64-lfs-linux-gnu/libgcc': From reading over the GCC FAQ I ran a Code:
grep -n error config.log Code:
86 x86_64-linux-gnu
I did a find . -type d -name "*isl*" -print (think the syntax is right, snagged from SO) and got nothing, so there's no "isl" directory anywhere under /mnt/lfs/sources/gcc-9.2.0. Looking for the "qversion" reference (thinking it was a typo I could correct) led me to this SO answer which implies the Ubuntu host GCC may be outdated. For ref the Ubuntu host GCC version is: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Which is interesting since I'm trying to Compile GCC 9.2.0... But per section 2.2 I should be good to go with anything above 6.2. So at this point I'm not sure what the solution is for those two problems, if those are in fact the actual problems. Should I apt-get a newer version of GCC (but not above 9.2.0, per section 2.2) ? Or do something else? If anyone has any insight I'd greatly appreciate it. Thanks in advance. |
Preamble:
I have no knowledge of Vagrant. I have never used it. Things to check: I have used Ubuntu as a host for LFS (in the past) and I know that stock Ubuntu OOTB needs modifications to satisfy the minimum host requirements. Did you run 'version-check.sh' from chapter 2.2. on the host before you started and resolved the errors that I know occur? This also could be some sort of interaction between Ubuntu (the build host) and Vagrant. I try not to over-complicate my LFS builds (host running from a USB stick and compiling to an installed hard drive). |
Hi rsmereka thanks for the reply.
Vagrant shouldn't be a factor here because all Vagrant does is provide a wrapper for managing VMs in VirtualBox using the command line and configuration-as-code. Ubuntu is just a guest VM, it doesn't even know Vagrant exists. At least I wouldn't think it would be an issue, I'm just reporting for thoroughness. What Ubuntu tweaks were necessary? If there is a better distro to use I can certainly try that. Yes I did run version-check.sh, multiple times in fact, and cross-checked the versions reported against the versions listed in 2.2. I just ran it again and confirmed the versions from the Ubuntu host are within the parameters required by 2.2. Note I also had previously redirected /bin/sh to /bin/bash instead of the default /bin/dash, before attempting any compilations. Code:
lfs@lfs-host:/mnt/lfs$ bash version-check.sh |
One interesting bit I've noticed: Despite creating a separate lfs user I still routinely need to sudo many of the commands to get them to work. This is after I chown'd the /mnt/lfs to lfs and even did a chmod -R 777 /mnt/lfs.
Not sure what the underlying problem is, but it seems counter to what the LFS book states. From what I recall reading it should not need sudo unless explicitly stated in the text. |
Are you sure you had the three libraries mpc, mpfr and gmp unpacked in the gcc directory?
|
hazel: Yes they were unpacked into the /mnt/lfs/sources/gcc-9.2.0 directory.
Here are the contents with those dirs highlighted in bold: Code:
lfs@lfs-host:/mnt/lfs/sources/gcc-9.2.0$ ls -l For good measure, here's the contents of /mnt/lfs/sources/gcc-9.2.0/build: Code:
lfs@lfs-host:/mnt/lfs/sources/gcc-9.2.0$ ls -l build |
I asked because absence of one of these libraries is known to cause this problem. Yours however seems to be linked to libgcc.
The gcc build is unusual in that it has more than one configuration stage (binutils does the same). Each stage has its own configure log. Could you search for extra config.logs using the find -name config.log command? You might find a more informative log. |
>What Ubuntu tweaks were necessary?
If I remember correctly, /bin/sh points to dash, not bash and texinfo is not installed. >If there is a better distro to use I can certainly try that. Personal preference. I currently use MX Linux, it needs more modifications than Ubuntu but is not as heavy as Ubuntu, has no running systemd and has way better support for 32bit. >One thing I did do "extra" was created a symlink for /usr/bin/texinfo -> /usr/bin/texi2any >since it was specifically stating it wanted texinfo but Ubuntu provided texi2any instead. >Not sure if that would cause an issue, I can remove it if so. I never thought of simply creating a symbolic link to texi2any calling it texinfo. I would install the texinfo package which is in the 'universe' repository (which is not turned on by default). I read through the gcc wiki FAQ that you provided and that leads me to 'mpfr', 'gmp' and 'mpc'. These three packages are required to be present in the root gcc directory ($LFS/sources/gcc-9.2.0). After you un-tar gcc to the 'sources' directory, the first thing you do is to un-tar those three packages into the gcc directory and rename their folders to remove the version numbers. Check your gcc directory. You should have three folders there 'mpfr', 'gmp' and 'mpc'. My suggestion is to remove the entire gcc directory and start again. |
Will do, once compilation completes or fails again.
During exploration earlier I did find multiple config.log files but wasn't sure how far to explore down that rabbit hole, given I've never really used gcc before. What is the TLDR of the "more than one configuration stage" in gcc/binutils compilation? What are the purposes of the stages? I understand the theory and basic construction of compilers (e.g. frontend -> intermediate representation -> backend -> machine code) but I'm not familiar with compilation in *nix so not familiar with the configure file or this gcc process at all, this is really my first stab at really diving into linux and its toolset beyond looking up basic commands as needed a handful of times over the years. I intend to go back and study something like LLTHW for everyday working knowledge but figured the best way to start is to dive deep into it with LFS first then build up from there. Thanks! |
Compilation failed again, same error.
Here's the config.log files: Code:
lfs@lfs-host:/mnt/lfs/sources/gcc-9.2.0/build$ find -name config.log |
I also noted the date on the files. I really recommend that you 'rm -rvf' on that gcc directory. It is also not a good idea to use the same directory multiple number of times.
|
Hi rsmereka, I was thinking along the same lines and had already wiped the build dir, redeployed those three libs and restarted the compilation :) which failed again as above unfortunately. :(
Regarding texinfo, I removed the symlink but apt-get refuses to install texinfo. Apparently the universe repo is already enabled (per output from sudo add-apt-repository universe) and I'm already at the latest version of texinfo, despite texinfo not being anywhere on my path: Code:
lfs@lfs-host:/mnt/lfs/sources/gcc-9.2.0/build$ sudo apt-get install texinfo Ran apt list --installed | grep texinfo with result texinfo/bionic,now 6.5.0.dfsg.1-2 amd64 [installed] and no indication that it is in fact texi2any. Reaching the very edge of my knowledge here -- not sure if a package name in the apt list has to match the command name deployed on the filesystem, i.e. should there be a texi2any entry in the apt installed list? Or can the package be named texinfo/bionic in the apt installed list but the package actually deploys the texi2any command on the filesystem? (assuming the latter) So I don't see a way to install texinfo itself through apt, since it says it is already on my system. Am I misunderstanding something? |
Quote:
Result of the command to change GCC default dynamic linker: Code:
'gcc/config/linux.h' -> 'gcc/config/linux.h.orig' |
Look in the libgcc config.log. You might find something useful there, since the error message mentioned libgcc.
Rsmereka is right about not doing multiple builds in the same directory. Before restarting, you need to delete the entire gcc directory (not just the build directory), then untar it afresh, copy the three maths libraries into it, do all the fiddly configuration, then build. I am going through the official build log to see if I can find anything relevant. Nope, nothing! Ironically libgcc is one of the last things to be built. |
Well, even after removing the entire gcc dir and recreating as mentioned above the make errored out again, I still get the exact same errors:
Code:
checking for suffix of object files... configure: error: in `/mnt/lfs/sources/gcc-9.2.0/build/x86_64-lfs-linux-gnu/libgcc': Hazel: There is no "libgcc config.log" but I see ./libcc1/config.log and ./gcc/config.log files so I checked them both. Result of grep -n error ./libcc1/config.log: Code:
63:Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Code:
78:gcc: error: unrecognized command line option '-V' |
All times are GMT -5. The time now is 11:48 PM. |