简体   繁体   English

solaris sparc 9/10 libstdc ++兼容性问题(64位)

[英]solaris sparc 9/10 libstdc++ compatibilty issue (64 bit)

I have gcc 3.4.6 installed on sparc9 and sparc10 systems. 我在sparc9和sparc10系统上安装了gcc 3.4.6。 I am having incompatibility issues when I try to use shared object(built on sparc9) on sparc10. 当我尝试在sparc10上使用共享对象(基于sparc9构建)时遇到不兼容问题。 I am not seeing any issue if I use same shared object on sparc9 system. 如果在sparc9系统上使用相同的共享库,我看不到任何问题。 Snippet from makefile:- Makefile中的代码段:-

LIB=-L/usr/lib/sparcv9 -L/usr/local/lib/sparcv9 -L/lib/sparcv9
gcc -m64 -shared -fPIC -o myapi.so.1 myapi.o $(LIB) -lc -lstdc++ -luuid

Now following in sparc10:- 现在在sparc10中:

ldd -d /home/myapi.so
libstdc++.so.6 =>        /usr/local/lib/sparcv9/libstdc++.so.6
symbol not found: _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode                (./myapi.so)

I have skipped other dependencies in above output which appear normal. 我在上面的输出中跳过了其他正常显示的依赖项。

Then, I ran "nm" against libstdc++.so.6 in /usr/local/lib/sparcv9 for above unreferenced symbol and came with following conclusion:- 然后,我在/ usr / local / lib / sparcv9中针对libstdc ++。so.6运行了“ nm”,以查找上面未引用的符号,并得出以下结论:

V9---> _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode
V10--->_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffElSt12_Ios_SeekdirSt13_Ios_Openmode

If you look carefully, you can see a difference in mangled-name symbol in sparc9 and sparc10... "ExSt12" v/s "ElSt12". 如果仔细看,您会发现sparc9和sparc10中的错误名称符号有所不同...“ ExSt12” v / s“ ElSt12”。

Similarly, if I build myapi.so on sparc10, it fails on sparc9 because of symbol mismatch in V9 and V10. 同样,如果我在sparc10上构建myapi.so,则由于V9和V10中的符号不​​匹配而在sparc9上失败。

Can someone please point me to any helpful hints as to if I am missing something? 有人可以向我指出有关我是否缺少任何东西的任何有用提示吗? Or do I need to install any package on V9. 还是我需要在V9上安装任何软件包。 I am assuming that shared object built on V9 should work on V10. 我假设基于V9构建的共享对象应该可以在V10上运行。

I would like to add that there is a size of libstdc++.so.6 on V9 is different from V10. 我想补充一点,V9上的libstdc ++。so.6大小与V10不同。 V9 has SMCgcc and V10 has both SUNWgccruntime and SMCgcc. V9具有SMCgcc,而V10具有SUNWgccruntime和SMCgcc。

Those symbols demangle as: 这些符号分解为:

std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)

and

std::basic_streambuf<char, std::char_traits<char> >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)

Notice that one uses long and the other uses long long 请注意,一个使用long ,另一个使用long long

I suspect that means one was built with 64-bit file offsets (aka large file support) and the other wasn't. 我怀疑这意味着一个是使用64位文件偏移量构建的(又名大文件支持),而另一个不是。 That means the two versions of GCC have been built differently (by sunfreeware.com or whoever provided them) and are incompatible. 这意味着两个版本的GCC的构建方式不同(由sunfreeware.com或提供它们的人),并且不兼容。

Looks like you're using incompatible versions of the GNU C++ compiler & standard library on the two OS'es. 看来您在两个OS上使用的GNU C ++编译器和标准库的版本不兼容。 Unfortunately, there is no standard ABI for C++ and many compilers change symbol mangling conventions incompatibly between major releases (such as Sun C++ compiler 4.x vs. 5.x, or g++ 2.x vs. 3.x vs. 4.x). 不幸的是,没有针对C ++的标准ABI,许多编译器在主要发行版之间不兼容地更改符号处理约定(例如Sun C ++编译器4.x与5.x或g ++ 2.x与3.x与4.x。 )。

The /usr/local/lib path implies you're using the libraries from the SMCgcc packages downloaded from the sunfreeware.com site - make sure you have matching versions on the Solaris 9 and 10 machines. / usr / local / lib路径表示您正在使用从sunfreeware.com站点下载的SMCgcc软件包中的库-确保在Solaris 9和10计算机上具有匹配的版本。 (There is no "sparc 10", so you must mean Solaris 10.) (没有“ sparc 10”,因此您必须指Solaris10。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM