Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELDK gcc linker error in ld.so.1

I have ELDK-3.1 installed in a Ubuntu box working perfectly.

In another machine, running 64 bits OpenSuse 12.1, I cloned the ELDK installation and, for some time it worked very well.

Now when I try to configure my projects I see:

configure: error: C compiler cannot create executables
See `config.log' for more details

And the log shows:

configure:3411: ppc-linux-gcc    conftest.c  >&5
/opt/ELDK-3.1/usr/bin/../lib/gcc-lib/ppc-linux/3.3.3/../../../../ppc-linux/bin/ld: warning: ld.so.1, needed by /opt/ELDK-3.1//usr/../ppc_8xx/lib/libc.so.6, not found (try using -rpath or -rpath-link)
/opt/ELDK-3.1//usr/../ppc_8xx/lib/libc.so.6: undefined reference to `_dl_lookup_versioned_symbol_skip@GLIBC_PRIVATE'
...

The file ld.so.1 is in the same directory as libc.so.6.

s -l /opt/ELDK-3.1//usr/../ppc_8xx/lib/ld.so.1 
lrwxrwxrwx 1 root root 11 Jan 31 11:43 /opt/ELDK-3.1//usr/../ppc_8xx/lib/ld.so.1 -> ld-2.3.1.so

As far as I can see, I am correctly defining all the needed environment and trying to build using exactly the same build system as in the Ubuntu box (the project is "automaked").

So I wrote a script trying to mimic everything my automaked configure does:

#!/bin/bash


if [ ! -f confdefs.c ]; then
    cat > confdefs.c << EOF
/* confdefs.h */
#define PACKAGE_NAME "xyz"
#define PACKAGE_TARNAME "xyz"
#define PACKAGE_VERSION "1.00"
#define PACKAGE_STRING "xyz 1.00"
#define PACKAGE_BUGREPORT "<contact@company>"
#define PACKAGE_URL ""
#define PACKAGE "xyz"
#define VERSION "1.00"
/* end confdefs.h.  */

int
main ()
{

;
return 0;
}
EOF
fi

ARCH=powerpc
export CROSS_COMPILE=ppc_8xx
TOOLCHAIN=ppc-linux-
TOOLCHAIN_ROOT=/opt/ELDK
LD=`which ${TOOLCHAIN}ld`
CC=`which ${TOOLCHAIN}gcc`
GCC=$CC
export CFLAGS="-Wall -g -I${TOOLCHAIN_ROOT}/ppc_8xx/usr/include/"
export CPPFLAGS=$CFLAGS
# export LDFLAGS="-shared"

$CC $CFLAGS $LDFLAGS confdefs.c -o confdefs

This gives me exactly the same error as configure.

If I uncomment the line export LDFLAGS="-shared", on the other hand, it builds perfectly!.

> ls -l confdefs
-rwxr-xr-x 1 myself users 16136 Fev  1 09:52 confdefs
> file confdefs
confdefs: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, not stripped

Could anybody here please give me any clue of what I am missing so that my projects work finely on one box and not in the other?

Thanks!

like image 392
j4x Avatar asked Feb 01 '12 11:02

j4x


1 Answers

I'm not 100% sure that it solves all problems, but it works for us.

We discovered that symlink "ld.so.1 -> ../../../ppc_8xx/lib/ld.so.1" to eldk-3.1/usr/ppc-linux/lib solves linking error.

I suspect something changed with environment between F15 and F16. Same for OpenSUSE (11->12). Also bug was submitted against Fedora https://bugzilla.redhat.com/show_bug.cgi?id=754695 which was terminated as intentional ABI changes.

like image 58
Sergei Nikulov Avatar answered Oct 02 '22 09:10

Sergei Nikulov