Discussion:
error building gcc w/ newlib
Wilkes, John
2016-06-25 05:23:05 UTC
Permalink
I am trying to build a tool chain for embedded x86_64 development, and I get this error when building gcc with newlib:

checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES

First I build binutils-2.26:

export TARGET=x86-pc-elf
export PREFIX=$HOME/tools/cross-compiler
export PATH=$PATH:$PREFIX/bin

../binutils-2.26/configure --target=$TARGET --prefix=$PREFIX
make all
make install

Then I build a bootstrap gcc:

../gcc-6.1.0/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c --without-headers --with-newlib
make all-gcc
make install-gcc

Then I build newlib:

../newlib-2.4.0/configure --target=$TARGET --prefix=$PREFIX --enable-newlib-nano-formatted-io --disable-multilib --disable-shared
make
make install

Then I build gcc again with newlib:
../gcc-6.1.0/configure --target=$TARGET --prefix=$PREFIX --with-system-zlib --disable-shared --enable-languages=c,c++
make

And this is where I get the error:

checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:11152: recipe for target 'configure-target-libstdc++-v3' failed

Apparently it is complaining about a shared library test. The --disable-shared configuration option does not disable the test.

There are lots of reports of this problem, but few proposed solutions, none of which have worked for me.

Any help is very much appreciated!
--
John Wilkes | AMD Research |  ***@amd.com | office: +1 425.586.6412 (x26412)
Peter Foley
2016-06-25 15:20:15 UTC
Permalink
Post by Wilkes, John
../gcc-6.1.0/configure --target=$TARGET --prefix=$PREFIX --with-system-zlib --disable-shared --enable-languages=c,c++
make
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:11152: recipe for target 'configure-target-libstdc++-v3' failed
Apparently it is complaining about a shared library test. The --disable-shared configuration option does not disable the test.
There are lots of reports of this problem, but few proposed solutions, none of which have worked for me.
I believe you still need to pass --with-newlib to the second gcc invocation.
If you provide the libstdc++-v3 config.log, it should show exactly why
link tests are being disabled.

Thanks,

Peter
Wilkes, John
2016-06-26 04:43:49 UTC
Permalink
Post by Peter Foley
Post by Wilkes, John
../gcc-6.1.0/configure --target=$TARGET --prefix=$PREFIX --with-system-zlib --disable-shared --enable-languages=c,c++
make
I believe you still need to pass --with-newlib to the second gcc invocation.
If you provide the libstdc++-v3 config.log, it should show exactly why
link tests are being disabled.
Thanks for the suggestion. If I configure the second gcc invocation with "--with-newlib", I get an earlier compile-time error complaining that "typeof" is not declared:

../../../gcc-6.1.0/libquadmath/strtod/strtod_l.c:127:24: warning: implicit declaration of function 'typeof' [-Wimplicit-function-declaration]
#define SWAP(x, y) ({ typeof(x) _tmp = x; x = y; y = _tmp; })
^
../../../gcc-6.1.0/libquadmath/strtod/strtod_l.c:1240:12: note: in expansion of macro 'SWAP'
(void) SWAP (psrc, pdest);
^~~~
../../../gcc-6.1.0/libquadmath/strtod/strtod_l.c:127:34: error: expected ';' before '_tmp'
#define SWAP(x, y) ({ typeof(x) _tmp = x; x = y; y = _tmp; })
^

The libstdc++v3 config.log file (from a build configured without "--with-newlib") is attached. There are a number of errors for unrecognized command line options with xgcc, for example:

configure:3952: $? = 0
configure:3941: /proj/microflex/users/jwilkes/gnu/build-gcc/./gcc/xgcc -B/proj/microflex/users/jwilkes/gnu/build-gcc/./gcc/ -B/proj/microflex/tools/sw/x86_64-elf/bin/ -B/proj/microflex/tools/sw/x86_64-elf/lib/ -isystem /proj/microflex/tools/sw/x86_64-elf/include -isystem /proj/microflex/tools/sw/x86_64-elf/sys-include
-V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.

It also complains about missing "ac_nonexistent.h" file, "memory.h", "dlfcn.h", files.

One of the errors is from "ld" complaining that it can't find crt0.o. I intend to use this tool chain (if I can ever get it to build and install) for FreeRTOS development, and crt0 is neither needed nor used by FreeRTOS, which is why I don't have one.

The last reported error in config.log is:

configure:11376: checking for shl_load
configure:11376: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

Thanks,
John

--
John Wilkes | AMD Research |  ***@amd.com | office: +1 425.586.6412 (x26412)
Peter Foley
2016-06-26 14:14:16 UTC
Permalink
If you don't need it, you can probably work around this with
--without-libquadmath
Post by Wilkes, John
One of the errors is from "ld" complaining that it can't find crt0.o. I intend to use this tool chain (if I can ever get it to build and install) for FreeRTOS development, and crt0 is neither needed nor used by FreeRTOS, which is why I don't have one.
This is most likely the reason that you're failing the link test later on.
I think you're either going to have to pass --with-newlib and fix
whatever other issues that causes, or just create a dummy crt0.o to
make configure happy.
Your best bet is probably --with-newlib --without-libquadmath.
Hopefully that'll be enough.

Thanks,

Peter
Peter Foley
2016-06-26 14:39:13 UTC
Permalink
Post by Peter Foley
Your best bet is probably --with-newlib --without-libquadmath.
Looks like it's actually --disable-libquadmath
Wilkes, John
2016-06-27 21:28:49 UTC
Permalink
Peter,

I can't thank you enough!

Adding "--with-newlib and --disable-libaquadmath" did the trick. I have successfully built and installed a newlib-based gcc tool chain for embedded/standalone development.

Thanks for your help!

John

--
John Wilkes | AMD Research |  ***@amd.com | office: +1 425.586.6412 (x26412)


-----Original Message-----
From: Peter Foley [mailto:***@pefoley.com]
Sent: Sunday, June 26, 2016 7:39 AM
To: Wilkes, John
Cc: ***@sourceware.org
Subject: Re: error building gcc w/ newlib
Post by Peter Foley
Your best bet is probably --with-newlib --without-libquadmath.
Looks like it's actually --
Peter Foley
2016-06-27 22:01:59 UTC
Permalink
Post by Wilkes, John
Peter,
I can't thank you enough!
Adding "--with-newlib and --disable-libaquadmath" did the trick. I have successfully built and installed a newlib-based gcc tool chain for embedded/standalone development.
Great to hear!

Loading...