This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange dynamic linking error...


I cross-compiled my C++ application on my x86 desktop for my ARM iPaq. The x86 
version on the desktop works fine. On the iPaq i get at some point during 
execution:

/path/to/myProgBin: relocation error: /path/to/myProgBin: undefined symbol: 
stat

Now, stat() is probably in the standard libs somewhere. For the x86 version 
working on my desktop I have:

> ldd .libs/lt-myProgBin
        libpthread.so.0 => /lib/libpthread.so.0 (0x40059000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40549000)
        libm.so.6 => /lib/libm.so.6 (0x40602000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40624000)
        libc.so.6 => /lib/libc.so.6 (0x4062c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libdl.so.2 => /lib/libdl.so.2 (0x4075f000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40763000)
        libpng.so.3 => /usr/lib/libpng.so.3 (0x40794000)
        libz.so.1 => /lib/libz.so.1 (0x407c0000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x407cf000)

On the ipaq I get:

~ # ldd /opt/2wear/bin/arm-linux-storageServiceGL2CAP
        libpthread.so.0 => /lib/libpthread.so.0 (0x4002b000)
        libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 
(0x40560000)
        libm.so.6 => /lib/libm.so.6 (0x405aa000)
        libc.so.6 => /lib/libc.so.6 (0x40623000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x4074a000)
        libpng.so.3 => /usr/lib/libpng.so.3 (0x4076e000)
        libz.so.1 => /usr/lib/libz.so.1 (0x407a6000)
        libdl.so.2 => /lib/libdl.so.2 (0x407bb000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x407c6000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x407fa000)

I am suspecting libc. On my desktop, the cross-compiler searches for libs in:

karypid@grads-d5-pc-2:/usr/local/arm/2.95.4> arm-linux-g++ -print-search-dirs
install: /usr/local/arm/2.95.4/lib/gcc-lib/arm-linux/2.95.4/
programs: 
/usr/local/arm/2.95.4/lib/gcc-lib/arm-linux/2.95.4/:/usr/local/arm/2.95.4/lib/gcc-lib/arm-linux/:/usr/lib/gcc/arm-linux/2.95.4/:/usr/lib/gcc/arm-linux/:/usr/local/arm/2.95.4/arm-linux/bin/arm-linux/2.95.4/:/usr/local/arm/2.95.4/arm-linux/bin/
libraries: /usr/local/arm/2.95.4/arm-linux/lib/

And in /usr/local/arm/2.95.4/arm-linux/lib/ I see this difference with the 
iPaq.

ipaq: /lib/libc.so.6 -> libc-2.3.2.so
desktop-crossarm:  libc-2.2.4.so

The susprising part is that if I cross-compile the subset of the program which 
uses stat() using the C compiler (gcc and NOT g++), the call to stat() is 
resolved successfully! Why is this?

-- 
In theory, there is no difference between theory and practice,
in practice there is. -- Yogi Berra.

Alexandros Karypidis
University of Thessaly
Computer & Communications Engineering dept.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]