Page 1 of 1

GCC_NO_EXECUTABLES Error building OS Specific Toolchain

Posted: Thu Apr 30, 2015 9:29 am
by PinkyNoBrain
Dear OSDev Community,

I have been trying to build an Tailored toolchain for my OS following these guides:

http://wiki.osdev.org/OS_Specific_Toolchain - for adding my OS as a target
http://wiki.osdev.org/Porting_Newlib - To extend the above to use newlib as the C library
http://wiki.osdev.org/Hosted_GCC_Cross-Compiler - for additional information

To the best of my knowledge I followed the guides accurately and initially everything went well (too well)! binutils, gcc and newlib all compiled successfully. However, at the last hurdle of compiling libstdc++, I hit the following error and have spent the last week hacking around trying to fix it :-(

Code: Select all

checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
Googling the above I have learnt that this error is really saying "your gcc is not capable of producing executables", which doesn't sound very good!

I have variously tried re-tracing my steps in the tutorials, recompiling each of the items from scratch and checking the header and lib files are in sysroot but the same problem persists. My current guess is that the new gcc is not finding or using the newlib libc.a as expected.

The exact commands I used to build each component are:

Code: Select all

cp -RT newlib/newlib/libc/include  $(SYSROOT)/usr/include

	cd $(BUILD_BINUTILS) && $(SRCROOT)/binutils/configure --prefix=$(INSTALL_PREFIX) --target=x86_64-cosk  --with systroot="$(SYSROOT)" --disable-werror
	cd $(BUILD_BINUTILS) && make all
	cd $(BUILD_BINUTILS) && make install

	cd $(BUILD_GCC) && $(SRCROOT)/gcc-4.9.2/configure --prefix=$(INSTALL_PREFIX) --target=x86_64-cosk  --with-systroot="$(SYSROOT)" --enable-languages=c,c++
	cd $(BUILD_GCC) && make all-gcc all-target-libgcc
	cd $(BUILD_GCC) && make install-gcc install-target-libgcc

	cd $(BUILD_NEWLIB) && $(SRCROOT)/newlib/configure --prefix=/usr --target=x86_64-cosk 
	cd $(BUILD_NEWLIB) && make all
	cd $(BUILD_NEWLIB) && make DESTDIR=$(SYSROOT) install

	cd $(BUILD_GCC) && make all-target-libstdc++-v3
	cd $(BUILD_GCC) && make install-target-libstdc++-v3
The versions of tools i am using are binutils 2.25,gcc 4.9.2, newlib latest from git.

I am very happy to post additional information and output (config.logs e.t.c). I just don't want to swamp this post with unnecessary information.

I would really appreciate some help sorting this issue out as it is now doing my head in.

Thanks,

Pinky

P.S I am not a gcc or toolchain expert so it is probably a stupid mistake I have made somewhere.