c++ - 在 AIX 上使用 pthread 进行静态链接

标签 c++ linker pthreads static-libraries aix

这几天我一直在阅读和研究这个 现在,决定我需要一些外部帮助!

(这个网站看起来是个不错的地方,所以我想我会 在这里发布我的问题,看看结果如何)

我们的小公司还没有在 AIX 上构建我们的应用程序 几年来,我被分配了这个任务(很好 我喜欢挑战的事情)。

我遇到的问题很容易描述,我可以看到 其他人也在经历它,虽然我似乎不能 寻找答案。

如果我“非静态”链接应用程序,意味着我不使用“-static” 在构建命令中,应用程序在开发中运行良好 机器,但不在我们用于的其他 AIX 机器上 测试。

[关于两台机器的快速说明;

开发人员:

~$ uname -a
AIX aix3 2 5 000BA50D4C00

测试:

~$ uname -a
AIX aix4 1 5 002459A64C00

]

如果我使用“-static”链接,应用程序会在运行时“中断” 在抛出异常时在开发机器上:

terminate called after throwing an instance of 'MyAppError'
Segmentation fault      (core dumped)

并且(好像这还不够),应用程序仍然没有 在测试机上运行:

exec(): 0509-036 Cannot load program ./myapp because of the following errors:
        0509-130 Symbol resolution failed for myapp because:
        0509-136   Symbol _sigqueue (number 65) is not exported from
                   dependent module /unix.
        0509-136   Symbol ra_attachrset (number 95) is not exported from
                   dependent module /unix.
        0509-136   Symbol __rs_pickmcm (number 99) is not exported from
                   dependent module /unix.
        0509-136   Symbol _timer_create (number 122) is not exported from
                   dependent module /unix.
        0509-136   Symbol _timer_delete (number 123) is not exported from
                   dependent module /unix.
        0509-136   Symbol _timer_getoverrun (number 124) is not exported from
                   dependent module /unix.
        0509-136   Symbol _timer_gettime (number 125) is not exported from
                   dependent module /unix.
        0509-136   Symbol _timer_settime (number 126) is not exported from
                   dependent module /unix.
        0509-136   Symbol count_event_waiters (number 159) is not exported from
                   dependent module /unix.
        0509-192 Examine .loader section symbols with the
                 'dump -Tv' command.

我应该注意这里我们正在链接“-pthead”, 我读过几篇文章说这不好 使用 pthread 时静态链接。

我的脑袋疼。

如果对此有任何意见,我将不胜感激。

最佳答案

您遇到的部分问题是您在 AIX 5.2 上构建并试图在 AIX 5.1 上进行测试(uname -a 信息显示了这一点 - 感谢您提供它)。您通常可以在较旧的平台上构建并在较新的平台上运行,但反之则不行。所以,这就是你麻烦的开始。

AIX 5.1 和 5.2 都是老生常谈;您应该至少使用 AIX 5.3,可以说是 AIX 6.x。

关于c++ - 在 AIX 上使用 pthread 进行静态链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/364605/

相关文章:

c - Visual C++ 2015/GL(全程序优化)和/OPT :REF (optimize references) prevent static initializers being called

c++ - `dlopen` 'ing a .so 包含符号导致 undefined symbol

c++ - 如何降低C/C++中的线程优先级

c++ - TinyXML 元素提取为文本

C++,指针数组,指向双向链表中的条目

c++ - Winapi ShellExecuteEx 不打开文件

c++ - 类变量 - 对齐

ios - xcodeproj 添加框架但链接器找不到它

c - 来自多个线程的 pthread_cond_signal

c++ - 是否允许主线程在进入 main() 之前生成 POSIX 线程?