OpenWrt Forum Archive

Topic: Problem using SDK: "C compiler cannot create executables"

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi!

I want to cross-compile some packages (eibd/linknx) for OpenWRT backfire 10.03.1 x86_generic (running on ALIX board).

I downloaded it from:

http://downloads.openwrt.org/backfire/1 … .1.tar.bz2

Then, whatever make I try on my packages, I always get this error:

checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

In the config.log file, I can see:

/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/bin/../lib/gcc/i486-openwrt-linux-uclibc/4.1.2/../../../../i486-openwrt-linux-uclibc/bin/ld: warning: ld-uClibc.so.0, needed by /data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/lib/libc.so, not found (try using -rpath or -rpath-link)
/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/lib/libc.so: undefined reference to `_dl_app_init_array'
/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/lib/libc.so: undefined reference to `_dl_loaded_modules'
/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/usr/lib/libc.so: undefined reference to `_dl_app_fini_array'
collect2: ld returned 1 exit status

Did I forget to do something after downloadinf the SDK, to configure it?

Thanks for your help,

You didn't set the STAGING_DIR environment variable. In your case it should point to "/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/"

Thanks for your answer. But it does not change anything...

The you did it wrong. The error quoted above happens exactly because of that.

Where do I need to define this var? I used the shell command 'export'...

$ echo $STAGING_DIR 
/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/

$ ls $STAGING_DIR 
bin  info.mk  lib  sbin  usr

BTW, I also have this error:

$ make menuconfig V=99
make[1]: Entering directory `/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/scripts/config'
/usr/bin/ld: i386 architecture of input file `zconf.tab.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
make[1]: *** [mconf] Error 1
make[1]: Leaving directory `/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/scripts/config'
make: *** [scripts/config/mconf] Erreur 2

Again, is there something to do right after unpacking the SDK, in order to configure it? Or should it work out-of-the-box?

I didn't see anything about this STAGING_DIR var, in the wiki, except it is used in some Makefiles...

Thanks,

Hi,

i had the same problems with the SDK!

What i have done is to build the Buildroot with the SDK option in "make menuconfig":
(Don't forget to choose the right target platform)

http://wiki.openwrt.org/doc/howto/buildroot.exigence

and then simple use your own SDK.

I takes a little longer because you build a firmware to but the SDK works out-of-the-box!

Its important that you checkout the stable branch because the SDK created by the trunk branch don't work as well!

svn checkout svn://svn.openwrt.org/openwrt/branches/backfire

I hope it helps

rubiktubik

(Last edited by rubiktubik on 14 Mar 2013, 14:56)

Thanks for this tip. But I would like to build the SDK which matches my distro, the backfire 10.03.1... Is it possible ?

fma wrote:

Thanks for this tip. But I would like to build the SDK which matches my distro, the backfire 10.03.1... Is it possible ?

The SDK is only a cross-compiler a have resently build software with the 10.03 SDK for Barrier Breaker(the trunk distro) with no problems.

I think its no problem to use the 10.03 Buildroot for the 10.03.1 distro.

Regards

rubiktubik

In order to try to find the problem, could you send me some file from your freshly compiled SDK? I would like to compare them with the ones that come with the binary SDK...

I think we could start with the following files/dirs:

./Makefile
./rules.mk
./package/
./include/
./scripts/

Thanks,

The strange thing is that the path to the ld-uClibc.so.0 is set in the compilation test:

-L/data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/lib

So why the loader can't find the lib?

Mmm, no more luck with SDK compilation:

make[7]: Entering directory `/data/tmp/backfire_10.03/build_dir/host/mklibs/src/mklibs-readelf'
x86_64-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../..   -O2 -I/data/tmp/backfire_10.03/staging_dir/host/include -I/data/tmp/backfire_10.03/tools/mklibs/include  -g -O2 -MT elf.o -MD -MP -MF .deps/elf.Tpo -c -o elf.o elf.cpp
elf.cpp: In static member function 'static Elf::file* Elf::file::open(const char*)':
elf.cpp:68:5: error: '::close' has not been declared
make[7]: *** [elf.o] Error 1

Is it a problem with my system? I'm using a debian sid, on amd64 plateform...

I can't download the archive:

Download permission denied by uploader. (0b67c2f5)

Do I need an account?

I worked. Thanks!

I finally found another thread with similar problem:

https://forum.openwrt.org/viewtopic.php?id=42355

In fact, I have to add:

TARGET_LDFLAGS += -rpath-link /data/tmp/OpenWrt-SDK-x86-for-Linux-i686-gcc-4.1.2_uClibc-0.9.30.1/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/lib/ld-uClibc.so.0

(and not --rpath-link) in my own package Makfile, in the define Package/xxx section.

It seems to work smile

Is there a way to set this option more globally?

The discussion might have continued from here.