使用32位g ++在AIX上构建64位二进制文​​件 [英] Using 32-bit g++ to build 64-bit binaries on AIX

查看:241
本文介绍了使用32位g ++在AIX上构建64位二进制文​​件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用32位g ++编译器从C ++代码构建64位二进制文​​件。
在构建时遇到以下错误:

  => / usr / local / bin / g ++ -shared -maix64 -fPIC -W1,-bM:SRE -W1,-bnoentry -W1,-bE:gcc_shr_lib.so.exp -o gcc_shr_lib.so gcc_shr_lib.o -L / usr /警告:导出的符号未定义:gcc_whereAmI 
ld:0711-317错误:未定义的符号:std :: bad_alloc的typeinfo
ld:0711-317 ERROR :未定义的符号:__gxx_personality_v0
ld:0711-317错误:未定义的符号:vtable for std :: exception
ld:0711-317错误:未定义的符号:vtable for std :: bad_alloc
ld :0711-317错误:未定义符号:.std :: ios_base :: Init :: Init()
ld:0711-317错误:未定义符号:.std :: ios_base :: Init ::〜Init
ld:0711-317错误:未定义符号:.operator new(unsigned long)
ld:0711-317错误:未定义符号:.operator delete(void *)
ld:0711- 317错误:未定义符号:._Unwind_Resume
ld:0711-317错误:未定义符号:.__ cxa_get_exception_ptr
ld:0711-317错误:未定义符号:.__ cxa_begin_catch
ld:0711-317 ERROR :未定义符号:std :: cout
ld:0711-317错误:未定义符号:.std :: basic_ostream< char,std :: char_traits< char> >& std :: operator<< < std :: char_traits< char> >(std :: basic_ostream< char,std :: char_traits< char>& char const *)
ld:0711-317错误:未定义符号:std :: basic_ostream< char,std :: char_traits< char> >& std :: endl< char,std :: char_traits< char> >(std :: basic_ostream< char,std :: char_traits< char>&)
ld:0711-317错误:未定义符号:.std :: basic_ostream< char,std :: char_traits< char> ; > :: operator<<<(std :: basic_ostream< char,std :: char_traits< char>>&(*)(std :: basic_ostream< char,std :: char_traits< char>& )
ld:0711-317错误:未定义符号:.std :: bad_alloc ::〜bad_alloc()
ld:0711-317错误:未定义符号:.__ cxa_end_catch
ld:0711- 317错误:未定义符号:.__ register_frame_info_table
ld:0711-317错误:未定义符号:.__ deregister_frame_info
ld:0711-345使用-bloadmap或-bnoquiet选项可获取更多信息。
collect2:ld返回8退出状态

看来我需要64位libstdc ++我的构建系统。


  1. 是否可以使用32位g ++编译64位二进制文​​件编译器在AIX 5.2上?


  2. 我应该在哪里获得64位libstdc ++?这64位的libstdc ++是否与32位的g ++编译器配合使用?









以下是我使用的GCC / G ++的版本:

  => gcc -v 
使用内置specs。
目标:powerpc-ibm-aix5.2.0.0
配置为:../gcc-4.1.1/configure --disable-aix64 --disable-nls
线程模型:aix
gcc version 4.1.1
[tsivaram @ maroon /]
=> g ++ -v
使用内置specs。
目标:powerpc-ibm-aix5.2.0.0
配置为:../gcc-4.1.1/configure --disable-aix64 --disable-nls
线程模型:aix
gcc version 4.1.1

由于gcc和g ++是使用 - disable-aix64 ,没有可用的64位STD库(例如:libstdc ++)。

 code> AIX版本我使用:
=> uname -a
AIX maroon 2 5 000663FC4C00
[tsivaram @ maroon /]
=> oslevel
5.2.0.0
[tsivaram @ maroon /]
=> oslevel -r
5200-05

如何构建64位libstdc ++,使用gcc / g ++ 4.1.1?



我需要重建GCC和G ++,而不使用 - disable-aix64 flag?如果是的,你能指向我一个链接解释如何建立?



我们不能只是建立libstdc ++库(必需)?


64位库在机器上可用,不管您的G ++是否是32位或64位二进制文​​件都应该 - 它应该能够生成32位和64位目标文件(和共享库,和可执行文件等)。



请注意,GCC(或G ++)非常刻意地使用不同的名称压缩方案,因为它做了各种事情作为异常处理,类布局等)不同于其他编译器。您不能可靠地将使用本机XLC编译器编译的代码与使用G ++编译的代码链接。但是,你似乎没有在这里做。



你应该看看/ usr / local / lib看看你能找到什么64位C ++库;您可能需要在命令行上提及正确的目录和共享库名称。或者,向命令中添加-v标志,看看实际执行的是什么。



你似乎只有缺少的符号;您没有不匹配的32位对64位对象文件或库或任何。



(AIX 5.2是否仍然支持?您是否应该计划移动到5.3或6.1?)

/ p>

I am trying to build a 64-bit binary from C++ code using 32-bit g++ compiler. I am getting the following errors while building:

=> /usr/local/bin/g++ -shared -maix64 -fPIC -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bE:gcc_shr_lib.so.exp -o gcc_shr_lib.so gcc_shr_lib.o -L/usr/local/lib
ld: 0711-319 WARNING: Exported symbol not defined: gcc_whereAmI
ld: 0711-317 ERROR: Undefined symbol: typeinfo for std::bad_alloc
ld: 0711-317 ERROR: Undefined symbol: __gxx_personality_v0
ld: 0711-317 ERROR: Undefined symbol: vtable for std::exception
ld: 0711-317 ERROR: Undefined symbol: vtable for std::bad_alloc
ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::Init::Init()
ld: 0711-317 ERROR: Undefined symbol: .std::ios_base::Init::~Init()
ld: 0711-317 ERROR: Undefined symbol: .operator new(unsigned long)
ld: 0711-317 ERROR: Undefined symbol: .operator delete(void*)
ld: 0711-317 ERROR: Undefined symbol: ._Unwind_Resume
ld: 0711-317 ERROR: Undefined symbol: .__cxa_get_exception_ptr
ld: 0711-317 ERROR: Undefined symbol: .__cxa_begin_catch
ld: 0711-317 ERROR: Undefined symbol: std::cout
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
ld: 0711-317 ERROR: Undefined symbol: std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)
ld: 0711-317 ERROR: Undefined symbol: .std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))
ld: 0711-317 ERROR: Undefined symbol: .std::bad_alloc::~bad_alloc()
ld: 0711-317 ERROR: Undefined symbol: .__cxa_end_catch
ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status

It seems I need 64-bit libstdc++ available on my build system. Could someone please throw some light on to solve this?

  1. Is it OK to build 64-bit binaries using 32-bit g++ compiler on AIX 5.2?

  2. Where should I get 64-bit libstdc++? Will this 64 bit libstdc++ work with 32-bit g++ compiler?


Thanks a lot for your quick response and for pointing out the problem.

Following are the versions of GCC/G++ I am using:

=> gcc -v
Using built-in specs.
Target: powerpc-ibm-aix5.2.0.0
Configured with: ../gcc-4.1.1/configure --disable-aix64 --disable-nls
Thread model: aix
gcc version 4.1.1
[tsivaram@maroon /]
=> g++ -v
Using built-in specs.
Target: powerpc-ibm-aix5.2.0.0
Configured with: ../gcc-4.1.1/configure --disable-aix64 --disable-nls
Thread model: aix
gcc version 4.1.1

Since gcc and g++ are configured/built with --disable-aix64, there are no 64-bit STD libraries available (Ex: libstdc++).

AIX version i am using:
=> uname -a
AIX maroon 2 5 000663FC4C00
[tsivaram@maroon /]
=> oslevel
5.2.0.0
[tsivaram@maroon /]
=> oslevel -r
5200-05

How can I build 64-bit libstdc++, which should work with gcc/g++ 4.1.1?

Do I need to rebuild GCC and G++ without the --disable-aix64 flag? If yes, could you please point to me a link explaining how to build?

Can not we just build libstdc++ library (required)?

解决方案

You seem to be building a shared library rather than an executable.

As long as the relevant 64-bit libraries are available on the machine, it should not matter whether your G++ is itself a 32-bit or a 64-bit binary - it should be able to generate both 32-bit and 64-bit object files (and shared libraries, and executables, etc).

Be aware that GCC (or G++) uses a different name-mangling scheme from other compilers quite deliberately - because it does various things (such as exception handling, class layouts and the like) differently from other compilers. You cannot reliably link code compiled with the native XLC compilers with code compiled with G++. However, you do not seem to be doing that here.

You should look under /usr/local/lib to see what you can find in the way of 64-bit C++ libraries; you may need to mention the right directory and shared library name on the command line. Alternatively, add the '-v' flag to the command and see what is actually being executed.

You seem to just have missing symbols; you don't have mismatched 32-bit vs 64-bit object files or libraries or whatever. So, you're close - just not quite there yet.

(Is AIX 5.2 still supported? Shouldn't you be planning to move to 5.3 or 6.1?)

这篇关于使用32位g ++在AIX上构建64位二进制文​​件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
C/C++开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆