linkersolarisacc

CC not linking libCrun.so.1


When I compile and link a .so file on my machine, it works. When I try to distribute the file to someone, they are getting errors.

To be more specific, I am building on:

-bash-3.00# uname -a
SunOS bob 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Blade-1000
-bash-3.00# CC -V
CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25

In the makefile, I am using these flags:

CFLAGS=-m64 -library=stlport4 -KPIC
LDFLAGS=-m64 -L/usr/lib/sparcv9 -lCrun -library=stlport4 -G

I am not seeing any errors on my machine, but this error is being report

ld.so.1: batch: fatal: relocation error: file lqtbatch: symbol __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_: referenced symbol not found

Having a little trouble tracking down the reason, but here are a few differences I am seeing. On my machine, ldd -r batch:

ldd -r batch 
    libstlport.so.1 =>       /opt/SUNWspro/lib/stlport4/v9/libstlport.so.1
    librt.so.1 =>    /lib/sparcv9/librt.so.1
    libCrun.so.1 =>  /opt/SUNWspro/prod/lib/stlport4/v9/../../../usr/lib/v9/libCrun.so.1
    libm.so.1 =>     /lib/64/libm.so.1
    libc.so.1 =>     /lib/64/libc.so.1
    libaio.so.1 =>   /lib/64/libaio.so.1
    libmd.so.1 =>    /lib/64/libmd.so.1
    /platform/SUNW,Sun-Blade-1000/lib/sparcv9/libc_psr.so.1
    libm.so.2 =>     /lib/64/libm.so.2
    /platform/SUNW,Sun-Blade-1000/lib/sparcv9/libmd_psr.so.1

Others are seeing this on the ldd -r command

libstlport.so.1 =>   /opt/SUNWspro/lib/stlport4/v9/libstlport.so.1
librt.so.1 =>    /lib/sparcv9/librt.so.1
libm.so.1 =>     /lib/64/libm.so.1
libc.so.1 =>     /lib/64/libc.so.1
libaio.so.1 =>   /lib/64/libaio.so.1
libmd.so.1 =>    /lib/64/libmd.so.1
symbol not found: __1cG__CrunKpure_error6F_v_       (./liblqtcr.so)
symbol not found: __1cG__CrunKpure_error6F_v_       (./liblqtcr.so)
...many of these...
symbol not found: __1cG__CrunKpure_error6F_v_       (./liblqtcr.so)
/platform/SUNW,SPARC-Enterprise-T2000/lib/sparcv9/libc_psr.so.1
symbol not found: __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mpkc_r1_        (./liblqtcr.so)
symbol not found: __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Gsubstr6kMLL_1_        (./liblqtcr.so)
libm.so.2 =>     /lib/64/libm.so.2
symbol not found: __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___2G6Mrk1_r1_        (./liblqtcr.so)
symbol not found: __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MLLrk1_r1_        (./liblqtcr.so)
symbol not found: __1cDstdK_M_put_num4Ccn0ALchar_traits4Cc__Cb_6Frn0ANbasic_ostream3CTACTB__TC_4_       (./liblqtcr.so)
symbol not found: __1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Gassign6MpkcL_r1_      (./liblqtcr.so)
/platform/SUNW,SPARC-Enterprise-T2000/lib/sparcv9/libmd_psr.so.1

My assumption is that I am incorrectly linking libCrun.so.1 which is causing these errors and causing the error on other machines.

Any help would be appreciated


Solution

  • LDFLAGS=-m64 -L/usr/lib/sparcv9 -lCrun ...

    You should remove both the -L/usr/lib/sparcv9 and -lCrun from your LDFLAGS -- SunStudio will add them correctly all on its own.

    My assumption is that I am incorrectly linking libCrun.so.1

    No: you are linking with it correctly. The problem is that on the problem machine libCrun.so.1 is (apparently) not installed at all. That library should be installed by default -- no C++ application would normally run without it. You should find out what package libCrun.so.1 belongs to, and ask your client/customer to install it.