Undefined Symbol - long __rwstd::InterlockedIncrement(long*) equivalence_MT

I am trying to port an application which till now was being compiled with older sun compiler 5.3. to a new compiler 5.6. But while linking I get undefined symbol error message

Undefined Symbol - long __rwstd::InterlockedIncrement(long*) equivalence_MT

I went through all the posted message in this forum on this topic but not able to resolve this problem.

Note that which I run "dumpstabs -s" on one of the libraries I am linking in this binary I get compiler version of that library as

[code] --[b]WorkShop Compilers 5.0 99/12/04 C 5.0 patch[/b][/code]

I am pasting all relevant information below --

[code]OS Version

=========

#uname -a

SunOS nys01a-079 5.8 Generic_117000-05 sun4u sparc SUNW,Ultra-80

Compiler Version

==============

#CC -V

CC: Sun C++ 5.6 2004/07/15

Compiler Location

===============

#which CC

/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/bin /CC

Link command with verbose

=================================

nys01a-079 [/home/vbasarka/SRC/AlpsPriceServers/Triarch]#make

make: Warning: Too many rules defined for target TriarchAlps

CC -v -xsb -xO5 -features=%all,no%iddollar -library=rwtools7,iostream \

-L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/l ib -L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib -L/home/vbasarka/SRC/packages/lib -L/sw/tibco/tibapi/version/v10.0.17L4/rel_s4_56_f6/lib -xildoff Application_MT.oSubscriber_MT.o tibnotif_MT.o recupdclient_MT.o triarchsource_MT.o triarchibus_MT.o config_read_MT.o equivalence_MT.o TriarchAlps.o \

-lEdoAlpsMT -lEdoUPViewMT -lEdoTibMT -lEdoNetMT -lEdoIoMT -lEdoSecurityMT -lEdoConfigMT -lEdoEventMT -lEdoStatsMT -lEdoMsgMT -lEdoBaseMT -lEdoDBsybaseMT -lTib -Bdynamic -lnsl -lsocket -lposix4 -lpthread -o TriarchAlps /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_REUTERS_SFC/4_3_1//lib/solaris2.6-sw50 /libsfc.a libssl.so.4 -lsocket -lnsl -lposix4

###command line files and options (expanded):

### -v -xsb -xO5 -features=%all,no%iddollar -L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/l ib -L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib -L/home/vbasarka/SRC/packages/lib -L/sw/tibco/tibapi/version/v10.0.17L4/rel_s4_56_f6/lib -xildoff Application_MT.o Subscriber_MT.o tibnotif_MT.o recupdclient_MT.o triarchsource_MT.o triarchibus_MT.o config_read_MT.o equivalence_MT.o TriarchAlps.o -lEdoAlpsMT -lEdoUPViewMT -lEdoTibMT -lEdoNetMT -lEdoIoMT -lEdoSecurityMT -lEdoConfigMT -lEdoEventMT -lEdoStatsMT -lEdoMsgMT -lEdoBaseMT -lEdoDBsybaseMT -lTib -Bdynamic -lnsl -lsocket -lposix4 -lpthread -o TriarchAlps /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_REUTERS_SFC/4_3_1//lib/solaris2.6-sw50 /libsfc.a libssl.so.4 -lsocket -lnsl -lposix4 -library=rwtools7,iostream

### CC: Note: NLSPATH = /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/bin /../lib/locale/%L/LC_MESSAGES/%N.cat:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SU NSTUDIO9/0_0_3/bin/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat

### CC: Note: LD_LIBRARY_PATH = /share/prime/SSI/SSICommon-SOLARIS32/ReleaseLib-SOLARIS08:/share/prime/SSI/SSIC ommon-SOLARIS32/DebugLib-SOLARIS08:/share/prime/SSI/SSICommon-SOLARIS32/ReleaseL ib-SOLARIS08:/share/prime/SSI/SSICommon-SOLARIS32/DebugLib-SOLARIS08:/home/vbasa rka/SRC/StrategyEngine/DebugLib-SOLARIS08:/home/vbasarka/LIB/PT550-SOL8/lib:/sw/ CRFS/solaris2.8-sunpro5.3/THIRDPARTY_REUTERS_SFC/4_3_1/lib/solaris2.6-sw50:/shar e/prime/AgoraLibs/agoralib/xml/lib:/share/prime/AgoraLibs/agoralib/ACE_wrappers/ ace:/share/prime/AgoraLibs/agoralib/gmr/lib:/share/prime/JDK/jdk1.5.0_10/jre/lib /sparc:/home/vbasarka/SRC/SSI/DebugLib-SOLARIS08:/home/vbasarka/SRC/SSI/ReleaseL ib-SOLARIS08:/home/vbasarka/SRC/SSI/SSICommon-SOLARIS32/DebugLib-SOLARIS08:/home /vbasarka/SRC/SSI/SSICommon-SOLARIS32/ReleaseLib-SOLARIS08:/share/prime/AgoraLib s/agoralib/xml/lib:/share/prime/AgoraLibs/agoralib/ACE_wrappers/ace:/share/prime /AgoraLibs/agoralib/gmr/lib:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_REUTERS_SFC /4_3_1/lib/solaris2.6-sw50:/home/vbasarka/SRC/StrategyEngine/DebugLib-SOLARIS08: /share/prime/AgoraLibs/agoralib/stlport/lib:/sw/sybase/oc_11.1.1/lib:/sw/CRFS/so laris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib:/sw/CRFS/solaris 2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib:/sw/tibco/tibapi /version/v10.0.17L4/rel_s4_56_f6:/sw/tibco/tibapi/version/v10.0.17L4/rel_s4_56_f 6:/develop/src/to_release//lib:/usr/lib:/usr/X11/lib:/usr/openwin/lib

### CC: Note: LD_RUN_PATH= :/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/li b:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib:/sh are/prime/AgoraLibs/agoralib/stlport/lib

### CC: Note: LD_OPTIONS = (null)

/usr/ccs/bin/ld -u __1cH__CimplKcplus_init6F_v_ -zld32=-S/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro /prod/lib/libldstab_ws.so -zld64=-S/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro /prod/lib/v9/libldstab_ws.so -zld32=-S/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro /prod/lib/libCCexcept.so.1 -zld64=-S/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro /prod/lib/v9/libCCexcept.so.1 -R :/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/li b:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib:/sh are/prime/AgoraLibs/agoralib/stlport/lib -R/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib/rw 7:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib/v8p lus:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib:/ opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/usr/ccs/lib:/lib:/usr/lib -o TriarchAlps /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /crti.o /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /CCrti.o /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /crt1.o /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /misalign.o /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /values-xa.o -Y P,/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib/rw 7:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib/v8p lus:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/ lib/rw7:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/p rod/lib/v8plus:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUN Wspro/lib:/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro /prod/lib:/usr/ccs/lib:/lib:/usr/lib -L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/l ib -L/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/lib -L/home/vbasarka/SRC/packages/lib -L/sw/tibco/tibapi/version/v10.0.17L4/rel_s4_56_f6/lib Application_MT.o Subscriber_MT.o tibnotif_MT.o recupdclient_MT.o triarchsource_MT.o triarchibus_MT.o config_read_MT.o equivalence_MT.o TriarchAlps.o -lEdoAlpsMT -lEdoUPViewMT -lEdoTibMT -lEdoNetMT -lEdoIoMT -lEdoSecurityMT -lEdoConfigMT -lEdoEventMT -lEdoStatsMT -lEdoMsgMT -lEdoBaseMT -lEdoDBsybaseMT -lTib -Bdynamic -lnsl -lsocket -lposix4 -lpthread /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_REUTERS_SFC/4_3_1//lib/solaris2.6-sw50 /libsfc.a libssl.so.4 -lsocket -lnsl -lposix4 -lrwtool -liostream -lCstd -lCrun -lm -lc /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /CCrtn.o /sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/lib /crtn.o >&/tmp/ld.09053.0.err

/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/bin /c++filt -filt=no%stdlib </tmp/ld.09053.0.err >/tmp/c++filt.09053.1.err

rm /tmp/ld.09053.0.err

/sw/CRFS/solaris2.8-sunpro5.3/THIRDPARTY_SUNSTUDIO9/0_0_3/bin/SUNWspro/prod/bin /stdlibfilt -stderr </tmp/c++filt.09053.1.err

Undefinedfirst referenced

symbolin file

long __rwstd::InterlockedIncrement(long*) equivalence_MT.o

[Hint: An object compiled with -xarch=v8plus must be linked with -xarch=v8plus]

ld: fatal: Symbol referencing errors. No output written to TriarchAlps

rm /tmp/c++filt.09053.1.err

*** Error code 1

make: Fatal error: Command failed for target `TriarchAlps'[/code]>

[8671 byte] By [vbasarkara] at [2007-11-27 0:17:02]
# 1
I believe you need to apply a solaris patch to libCstd. The most recent one for solaris 8 on sparc for 32 bits is 108434-22. I only have version -18 here but your symbol is definitely present. You can check the recommended patches there:
Marc_Glissea at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
I have checked libCstd.so, this symbol is present. Another point is I have another application which uses same compiler and same library and it compiles fine. The difference is it doesn't use rwtools7 library, instead it uses stlport.
vbasarkara at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
I have this all the time when the processor optimization differs between modules.When we combine -xarch=v8 with -xarch=v8plusa, I think we have the error in linking you have specified.
Brett_Tiplitza at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

To fix some thread synchronization bugs, we had to change the way the std::string class accesses synchronization primitives. We made changes in the <string> header used by programs, and corresponding changes in libCstd. The changes were made in Sun Studio 8, C++ 5.5, released in 2003.

If you have a binary using std::string compiled by an older compiler, it will use the old-style synchronization code, which does not mix well with binaries from later compilers. If you recompile the old binaries so that no compiler used is older than C++ 5.5, it should solve the problem.

BTW, the problem occurs only with 32-bit SPARC, compiling for pre-ultraSPARC processors. That is, using an explicit or implicit -xarch option of v7 or v8. Sun has not made or shipped such processors for more than 10 years. Code destined for UltraSPARC should be compiled with -xarch=v8plus (or higher). That is the default for recent compilers.

Mixing -xarch=v8 with -xarch=v8plus should not result in a link error using compilers and SUNWlibC versions released since 2003. If you have an example of such a problem, I'd like to see it.

clamage45a at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5
So it seems like, unless I recompile my old libraries I can not resolve this issue or is there any other option, because these libraries are not supported by the vendor any more and upgrading is much bigger project for me right now.
vbasarkara at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

It would be best to recompile the old binaries with the newer compiler. But please notice that both compilers are End Of Life. The best scenario, if you can recompile the old binaries, is to upgrade to the current compiler version, Sun Studio 11 (C++ 5.8). Studio 11 is free. You can get it here:

http://developers.sun.com/sunstudio

If recompiling the old binaries is not an option, I think you can resolve the v8/v8plus incompatibility issue. C++ 5.3 by default generated code for v8. C++ 5.6 by default generates code for v8plus. Try recompiling all your new code, but add -xarch=v8 to every CC command, compiling andl linking.

clamage45a at 2007-7-11 22:05:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...