Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ AIX5.3上的跨共享库异常问题_C++_Exception_Gcc_Aix - Fatal编程技术网

C++ AIX5.3上的跨共享库异常问题

C++ AIX5.3上的跨共享库异常问题,c++,exception,gcc,aix,C++,Exception,Gcc,Aix,我正在为AIX移植一个相当稳定的代码,它已经在Windows、Linux(32位和64位)以及Solaris SPARC和x86中运行。代码在共享库中引发异常: Environment: IBM AIX 5.3 64 Bits Compiler: GCC 4.6.1 libConfig.so needs: /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libstdc++.a(libstdc++.so.6)

我正在为AIX移植一个相当稳定的代码,它已经在Windows、Linux(32位和64位)以及Solaris SPARC和x86中运行。代码在共享库中引发异常:

Environment: IBM AIX 5.3 64 Bits Compiler: GCC 4.6.1

libConfig.so needs:
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libstdc++.a(libstdc++.so.6)
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libgcc_s.a(shr.o)
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

libHostServices.so needs:
         ../../../bin/aix/debug/libConfig.so
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libstdc++.a(libstdc++.so.6)
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libgcc_s.a(shr.o)
         /usr/lib/libc.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)

InterfaceCTest needs:
         /usr/lib/libc.a(shr_64.o)
         ../../../bin/aix/debug/libHostServices.so
         ../../../bin/aix/debug/libConfig.so
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libgcc_s.a(shr.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
         /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/ppc64/libstdc++.a(libstdc++.so.6)
下面的示例是使用
OBJECT\u MODE=64生成的

我的GCC生成选项是

Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/lto-wrapper Target: powerpc-ibm-aix5.3.0.0 Configured with: ../gcc-4.6.1/configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --enable-threads --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --host=powerpc-ibm-aix5.3.0.0 Thread model: aix gcc version 4.6.1 (GCC) COLLECT_GCC_OPTIONS='-g' '-v' '-Wextra' '-Wall' '-fPIC' '-O2' '-mminimal-toc' '-fpermissive' '-fexceptions' '-Wmissing-field-initializers' '-Wwrite-strings' '-Wformat' '-maix64' '-c' '-I' '.' '-I' '../../../src/HostServices' '-I' '../../../src/InterfaceCTest' '-D' '_LOG' '-D' '_LOGSTDOUT' '-D' '_DEBUG' '-shared-libgcc' /opt/freeware/libexec/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/cc1plus -quiet -v -I . -I ../../../src/HostServices -I ../../../src/InterfaceCTest -imultilib ppc64 -D_ALL_SOURCE -D__64BIT__ -D _LOG -D _LOGSTDOUT -D _DEBUG ../../../src/InterfaceCTest/InterfaceCTest.c -quiet -dumpbase InterfaceCTest.c -mminimal-toc -maix64 -auxbase InterfaceCTest -g -O2 -Wextra -Wall -Wmissing-field-initializers -Wwrite-strings -Wformat -version -fPIC -fpermissive -fexceptions -o /u01/ceibo/desen/tmp/ccQYtChL.s 当我执行可执行的InterfaceCest时,我得到:


GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-ibm-aix5.1.0.0"...
(gdb) run
...
Program received signal SIGABRT, Aborted.
0x090000000005ca8c in raise () from /usr/lib/libc.a(shr_64.o)
(gdb) where
#0  0x090000000005ca8c in raise () from /usr/lib/libc.a(shr_64.o)
#1  0x0900000000088008 in abort () from /usr/lib/libc.a(shr_64.o)
#2  0x090000000f16a704 in __gnu_cxx::__verbose_terminate_handler() () at  _start_ :95
#3  0x090000000f173b34 in __cxxabiv1::__terminate(void (*)()) (handler=
findvar.c:706: internal-error: value_from_register: Value not stored anywhere!
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) findvar.c:706: internal-error: value_from_register: Value not stored anywhere!
IOT/Abort trap(coredump)
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) 
过去的三天里,我一直在谷歌上搜索我可能做错的任何事情,但直到现在我什么都没有得到。这个链接对我来说很好,所以我确信这个问题是由于在共享库中抛出异常造成的

有人知道我可能做错了什么吗

谢谢


我做了一个非常简单的测试,现在我非常确定它与我的环境有关:

libCore.a

标题
Core.h

#ifdef __cplusplus
extern "C" {
#endif

void ThrowException();

#ifdef __cplusplus
} //extern "C"
#endif
正文:

可执行文件
CoreCTest

#include "Core.h"

int main()
{

    ThrowException();

    return 1;
}
当我执行我的可执行文件时,我得到:

./CoreCTest terminate called after throwing an instance of 'int*' IOT/Abort trap(coredump) 有人知道发生了什么事吗?任何帮助都将不胜感激


谢谢

我可以通过向链接器提供链接库的“-lsupc++”选项来解决这个问题。

只是想知道,你的
libCore.a
不是共享库吗?为什么使用
.a
后缀?不,IBM AIX使用与其他unix系统不同的共享库概念。共享库有。一个扩展和运行时可链接的二进制文件有。所以(真是一团糟呵呵)。解决了!!!!!!对于处理同一问题的人,有两个技巧:1-使用BASH作为shell-其他shell会给你混乱的重复符号(难以置信,我知道-)2-缺少-在我的LDFLAGS上共享;3-LDFLAGS允许未解析的符号。新的LDFLAGS=-shared-Wl,-G,-bernotok-Wl,-bnoentry-Wl,-bexpall
#include "Core.h"

int main()
{

    ThrowException();

    return 1;
}
./CoreCTest terminate called after throwing an instance of 'int*' IOT/Abort trap(coredump) CoreCTest needs: /usr/lib/libc.a(shr_64.o) /usr/lib/libpthreads.a(shr_xpg5_64.o) ../../../bin/aix/debug/libCore.a /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/pthread/ppc64/libgcc_s.a(shr.o) /unix /usr/lib/libcrypt.a(shr_64.o) /opt/freeware/lib/gcc/powerpc-ibm-aix5.3.0.0/4.6.1/pthread/ppc64/libstdc++.a(libstdc++.so.6)