gcc-5 build config log

I am planning to build the debug version of gcc-5, specifically gcc-5.4.0-6 16.04.10. I am doing this to investigate some segmentation faults on a particular machine. I have a working version of this gcc-5 on another machine that I can use for reference.

I know exactly which GMP, MPFR, and MPC I need to do the build.

My problem is that I run ./configure, make, make check, and make install, and there are never any errors in those processes. make check runs all of the tests and none fail.

But when I look at the config.log, I always see a bunch of errors. What I'm wondering, is why? And what do the errors mean? What am I doing wrong with my builds? If I have to understand this process in more detail, I'm willling but I didn't think it would be so difficult. I never see any errors emitted to the screen but I have no shared libaries build. I guess ideally, I would have the make install install to a test directory first so I guess I just need to check all the configure, make and make install options and set these. I have just run off the defaults - perhaps that's the problem. But I seem to have most or all of the tools installed that I need. I'll attach a log here. I will probably update this with the logs for GMP, MPFR, and MPC.

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64. Invocation command line was

$ ./configure

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
configure:4350: $? = 0
configure:4339: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4350: $? = 1
configure:4339: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4350: $? = 1
configure:4370: checking for C compiler default output file name
configure:4392: gcc conftest.c >&5
configure:4396: $? = 0
configure:4433: result: a.out
configure:4449: checking whether the C compiler works
configure:4458: ./a.out
configure:4462: $? = 0
configure:4477: result: yes
configure:4484: checking whether we are cross compiling
configure:4486: result: no
configure:4489: checking for suffix of executables
configure:4496: gcc -o conftest conftest.c >&5
configure:4500: $? = 0
configure:4522: result:
configure:4528: checking for suffix of object files
configure:4550: gcc -c conftest.c >&5
configure:4554: $? = 0
configure:4575: result: o
configure:4579: checking whether we are using the GNU C compiler
configure:4598: gcc -c conftest.c >&5
configure:4598: $? = 0
configure:4607: result: yes
configure:4616: checking whether gcc accepts -g
configure:4636: gcc -c -g conftest.c >&5
configure:4636: $? = 0
configure:4677: result: yes
configure:4694: checking for gcc option to accept ISO C89
configure:4758: gcc -c -g -O2 conftest.c >&5
configure:4758: $? = 0
configure:4771: result: none needed
configure:4849: checking for g++
configure:4865: found /usr/bin/g++
configure:4876: result: g++
configure:4903: checking for C++ compiler version
configure:4912: g++ --version >&5
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4923: $? = 0
configure:4912: g++ -v >&5
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.10' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --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 --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
configure:4923: $? = 0
configure:4912: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:4923: $? = 1
configure:4912: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'
g++: fatal error: no input files
compilation terminated.
configure:4923: $? = 1
configure:4927: checking whether we are using the GNU C++ compiler
configure:4946: g++ -c conftest.cpp >&5
configure:4946: $? = 0
configure:4955: result: yes
configure:4964: checking whether g++ accepts -g
configure:4984: g++ -c -g conftest.cpp >&5
configure:4984: $? = 0
configure:5025: result: yes
configure:5074: checking whether g++ accepts -static-libstdc++ -static-libgcc
configure:5091: g++ -o conftest -g -O2 -static-libstdc++ -static-libgcc conftest.cpp >&5
configure:5091: $? = 0
configure:5092: result: yes
configure:5156: checking for gnatbind
configure:5172: found /usr/bin/gnatbind
configure:5183: result: gnatbind
configure:5248: checking for gnatmake
configure:5264: found /usr/bin/gnatmake
configure:5275: result: gnatmake
configure:5297: checking whether compiler driver understands Ada
configure:5320: result: yes
configure:5329: checking how to compare bootstrapped objects
configure:5354: result: cmp --ignore-initial=16 $$f1 $$f2
configure:5408: checking for objdir
configure:5423: result: .libs
configure:5597: checking for the correct version of gmp.h
configure:5617: gcc -c -g -O2 conftest.c >&5
configure:5617: $? = 0
configure:5635: gcc -c -g -O2 conftest.c >&5
configure:5635: $? = 0
configure:5636: result: yes
configure:5652: checking for the correct version of mpfr.h
configure:5670: gcc -c -g -O2 conftest.c >&5
configure:5670: $? = 0
configure:5687: gcc -c -g -O2 conftest.c >&5
configure:5687: $? = 0
configure:5688: result: yes
configure:5705: checking for the correct version of mpc.h
configure:5722: gcc -c -g -O2 conftest.c >&5
conftest.c:10:17: fatal error: mpc.h: No such file or directory
compilation terminated.
configure:5722: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h. */
| #include <mpc.h>
| int
| main ()
| {
|
| #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
| choke me
| #endif
|
| ;
| return 0;
| }
configure:5747: result: no
configure:5813: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.

Did you create the objdir and run configure/make/make install from that directory?

These are the directions I usually use to compile gcc from source:

tar xzf gcc-4.6.2.tar.gz
cd gcc-4.6.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
../gcc-4.6.2/configure --prefix=/opt/gcc-4.6.2
make
make install


You would change gcc-4.6.2 to your version and the --prefix= can be a directory of your choice. This is where make install will install the binaries.

By downloading the prerequisites in the source directory the prerequisites will be placed in a directory so that make will normally find them automatically.

BIG NOTE:
You need to run configure from outside the source directory.

Edit: See this link for more information:
https://gcc.gnu.org/wiki/InstallingGCC
Last edited on
Thanks very much for the heads-up information. I will start over. I want to be REAL sure that I put the binaries into a directory other than /usr/lib/x86_64-linux-gnu as my current gcc-5 compiler runs fine and although these are exactly the same version, I need to patch the source code first. I also will need to learn how to use the patch utility as I have the right versions of GMP, MPFR and MPC, but in the cases of MPC and gcc-5, I have a slight diff. But frankly, I don't see any code in the .diff file. Is it possible that the .diff file is simply comments on what changes are made. Anyway, I'll get pointed in a new direction per your helpful comments.
Also, in my case, I will not be doing an install, only a make check, since I want to install the compiler on a different machine. I don't want to risk over-writing the existing compiler, so I guess I'll just test it out in it's own directory and do the make check. Hopefuly, that will work.
I want to be REAL sure that I put the binaries into a directory other than /usr/lib/x86_64-linux-gnu as my current gcc-5 compiler runs fine

That is the purpose of the "--prefix=" flag. You can have an unlimited number of different versions of gcc all in different directories using that flag.

I also will need to learn how to use the patch utility as I have the right versions of GMP, MPFR and MPC, but in the cases of MPC and gcc-5,
I really suggest you thoroughly read the documentation on how to compile the source that I linked above, including all the links on that page. It us usually recommended that you download the prerequisites as explained in the documentation instead of trying to manually configure the make system to use some "special" versions of GMP, MPFR, etc.

Edit:
Also, in my case, I will not be doing an install, only a make check, since I want to install the compiler on a different machine.

Is there a reason you don't want to build the compiler on that "different" machine?



Last edited on
Yes, my other machine does not have a version 5 of gcc compiler which is required to build gcc-5. So I would have to bootstrap that machine somehow by building the compiler on a machine that has a version 5 compiler. It is almost impossible to get someone else's compiler to build and install properly - I get segment faults no matter how I configure paths, and no matter how I use older and newer shared libs. I have gotten things to work sometimes but it always goes into the wrong directories. I always have to make a choice whether to use the ldconfig cache way or LD_LIBRARY_PATH way or whatever because I want more than one compiler at a time. I don't want to install over my existing compiler although to be honest - that I find is the best way since my newer compiler will be in the x86_64-linux-gnu dirs which is "orthogonal" to the other older compiler which is in lib64. So it can work but I want to build debug versions of all of the binaries to investigate the segfault. When I use strace and gdb it just isn't enough information. I sometimes build gcc for unusual versions of Linux, that's all.

My build you helped me with ran to completion - my only bewilderment, is why do I have all the binaries (except gcc). I have all of the other binaries. So yes, I will NOT be doing a make install. I don't see any reason why a build of a compiler can't be done on ANY machine, then simply installed on another machine. That's the whole idea of binary files, isn't it? And as for the libraries, I will eventually be building with somewhat newer versions of GMP, MPFR, and MPC. I know exactly which libraries are compatible. When I downloade the prerequisties, those are just the easiest ones perhaps. I can use later versions of the libraries in the build.

So now I just have to troubleshoot what happened with the main executable and then build the debug versions of everything. At least the build seems to be working. I don't know why there is gcc-ar, gcc-nm, ... but no just gcc, or just gcc-5. I'll have to look into it.

Is it possible that when I ran ./configure, that I did it wrong on that machine, and when it ran it said I needed a version 5 or greater compiler. I'm perfectly willing to rerun the build on that machine using ./configure in the manner that you describe. Perhaps it will relax the compiler to a previous version. I hadn't bothered to read the link on how to build it because I thought it was just as simple as ./configure, make, make install. I will try again tomorrow using your new recipe from the link you gave me, and hopefully do some test of the build I did today with the executables that I DO have. Still missing gcc itself which is puzzling. I might rerun make since I accidentally on purpose typed make check and it failed. Perhaps I need to build again. It should go fast an

Anyway. I think it's a bad idea to have a check or something. I don't know.

I also notice that all the libraries are .lo files so it looks like libtool has not run. Perhaps that is done during the make install? So I need to burn this to a cd then install it on another machine or perhaps (what I would like is to install it to a custom directory). I don't know - this is my first time trying to build gcc. I didn't know that the output of the make was a bunch of .lo files, and not .so files along with a gcc-5 file.
Last edited on
I went to the other machine today and I got the configure to run properly. My old config runs were way off apparently. So I should be able to build right on the machine now. I only got one comment about the isl version but I can probably fix that up in with some flag of configure - and I had to disable-multilib since I don't have the 32-bit stuff in the build. I manually configured gmp, mpfr, and mpc to look identical to the apt-get approach and it went well. So I will make some time later. It takes a couple hours to build. I might also turn off gcc boot-strapping although in my case it might be better on - I'll have to decide when I run it later.
It had said, WARNING: Using in-tree ISL, disabling version check. I will build the first time with 0.14, but then I will upgrade later to version 15, and I will later upgrade to other versions of gmp, mpfr, and mpc. I think it's good to start out with the prereqs min, and later upgrade.
Last edited on
The build ran for a while then failed with the error:

../../gcc-5.4.0/gcc/hwint.h:61:5: error: #error "Unable to find a suitable type for HOST_WIDE_INT"


It's due to the below typedef statement in hwint.h (there is no definition given anywhere for __gcc_host_wide_int__):

* This is a magic identifier which allows GCC to figure out the type
of HOST_WIDE_INT for %wd specifier checks. You must issue this
typedef before using the __asm_fprintf__ format attribute. */
typedef HOST_WIDE_INT __gcc_host_wide_int__;

/* Provide C99 <inttypes.h> style format definitions for 64bits. */

Either the language, the compiler make script or I have to somehow. Perhaps there is some other file where it is defined that I still need to install or perhaps the compiler needs to have a setting for that. Perhaps the version 5.0 and greater compilers automatically set that, and < 5.0 do not.
Last edited on
I read that someone else unset some environment variables who had this problem so I issued the command:
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
I am running make again.
The make failed again. A libtool command failed on asan.

Makefile:461: recipe for target 'asan_allocator2.lo' failed
make[4]: *** [asan_allocator2.lo] Error 1
make[4]: Leaving directory '/aufs/devsave/Downloads/gcc5build/objdir/x86_64-unknown-linux-gnu/libsanitizer/asan'
Makefile:437: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/aufs/devsave/Downloads/gcc5build/objdir/x86_64-unknown-linux-gnu/libsanitizer'
Makefile:307: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/aufs/devsave/Downloads/gcc5build/objdir/x86_64-unknown-linux-gnu/libsanitizer'
Makefile:16925: recipe for target 'all-target-libsanitizer' failed
make[1]: *** [all-target-libsanitizer] Error 2
make[1]: Leaving directory '/aufs/devsave/Downloads/gcc5build/objdir'
Makefile:910: recipe for target 'all' failed
make: *** [all] Error 2A

Update:
I just ran make again, and it seems to have picked up where it left off. I hadn't realized that the make would so large - maybe it just erred out of memory or something. Things are building and the part of the make that failed has finished this time - I should have just chosen a couple languages.
Last edited on
I need to figure out if libtool is even installed - it appears that even on my machine that has a good installation of gcc 5, I typed libtool -v, and it said, "The program 'libtool' is currently not installed. You can install it by typing: sudo apt install libtool-bin. This would explain why I'm not getting my shared libraries. I am surprised that my machine has such a good compiler and linker but no libtool. The machine without the good version of gcc 5 DOES have libtool. I didn't realize it was so much trouble just to build gcc. I haven't even tried g++ yet.
On one of my machines, my build ran fine - no errors but it said at one point, "checking whether to build shared libraries...no" so it doesn't build the shared libraries. And it is always missing one file: gcc. It makes all other executables and libraries. So now I probably have to put in some flag, because shared libraries are supposed to be built by default. So it's not building them NOT because of a lack of --enable-shared but for some other reason - but the compiler doesn't say what it is. It would be nice if it said WHY it's not building shared libraries. And why it doesn't ever build the one executable that I want to build which is gcc. It's built cc1, collect2, ld, etc..
I now realize all the compiler is doing is doing a 1-stage bootstrap, making the support shared libs like libatomic, libasan, etc.., then it probably use stops for some reason. So now I want to disable the boostrap because it doesn't even go through all 3 stages even though it should.
I reran the build on each machine - it runs to completion ending with make(4), make(3) .. leaving directory.

I am going through the root directory makefile - it looks pretty normal, but I notice RPATH_ENVVAR = LD_LIBRARY_PATH. I unset that variable before the build due to the problem with HOST_WIDE_INT. Why an LD_LIBRARY_PATH variable would have anything to do with an include file, I don't know. Perhaps it isn't LD_LIBRARY_PATH but some other variable. I'm trying to read the makefile and eventually come across the word install to see if that's when it fetches a copy of gcc from somewhere.

There are troublesome statements, like this:
# This is the list of variables to export in the environment when
# configuring subdirectories for the host system. We need to pass
# some to the GCC configure because of its hybrid host/target nature.

And this:
AS = as
AR = ar
AR_FLAGS = rc
CC = gcc
CXX = g++
DLLTOOL = dlltool
LD = ld
LIPO = lipo
NM = nm
OBJDUMP = objdump
RANLIB = ranlib
READELF = readelf
STRIP = strip
WINDRES = windres
WINDMC = windmc

If I don't have one of these, will the building of gcc fail, yet every single other executable, library, and shared library is built?
Last edited on
Topic archived. No new replies allowed.