静态链接的 xerces 3.0.0 不起作用,而动态链接在 Linux 上起作用

发布于 2024-10-05 02:17:09 字数 1100 浏览 9 评论 0原文

所以我试图在Linux上静态链接Xerces 3.0.0。

我已经使用动态链接完成了它并且它可以工作,但为了避免依赖性我想静态地完成它。

我更改了所有 make 文件以适当的方式执行此操作

-Wl,-Bstatic ... -lxerces-c -Wl,-Bdynamic ...

但我收到以下错误:

  undefined reference to '__ctype_b'
  undefined reference to '__ctype_tolower'
  undefined reference to '__ctype_toupper'

我修复了这些错误使用暴力方法在此处找到

但是还有另一种类型的错误与练习。

Xerces/3.0.0/lib/libxerces-c.a(PosixMutexMgr.o): 
In function `xercesc_3_0::PosixMutexMgr::create(xercesc_3_0::MemoryManager*)':

PosixMutexMgr.cpp:(.text+0x84): undefined reference to `pthread_mutexattr_init'
PosixMutexMgr.cpp:(.text+0x95): undefined reference to `pthread_mutexattr_settype'
PosixMutexMgr.cpp:(.text+0xad): undefined reference to `pthread_mutexattr_destroy'
PosixMutexMgr.cpp:(.text+0xd0): undefined reference to `pthread_mutexattr_destroy'

似乎缺少 pthread,所以我尝试添加它,但这并不能解决问题...... 这些错误来自 Xerces ...动态版本工作正常,静态版本失败。

有什么想法吗???

谢谢

So I am trying to statically link Xerces 3.0.0 on linux.

I did it already with dynamic link and it works, but in order to avoid dependancy I want to do it statically.

I changed all of the make files to do it in appropriate way

-Wl,-Bstatic ... -lxerces-c -Wl,-Bdynamic ...

But I am getting following errors:

  undefined reference to '__ctype_b'
  undefined reference to '__ctype_tolower'
  undefined reference to '__ctype_toupper'

I fixed those with brute force method found here

But there was another type of errors related to xerces.

Xerces/3.0.0/lib/libxerces-c.a(PosixMutexMgr.o): 
In function `xercesc_3_0::PosixMutexMgr::create(xercesc_3_0::MemoryManager*)':

PosixMutexMgr.cpp:(.text+0x84): undefined reference to `pthread_mutexattr_init'
PosixMutexMgr.cpp:(.text+0x95): undefined reference to `pthread_mutexattr_settype'
PosixMutexMgr.cpp:(.text+0xad): undefined reference to `pthread_mutexattr_destroy'
PosixMutexMgr.cpp:(.text+0xd0): undefined reference to `pthread_mutexattr_destroy'

It seems like its missing pthread so I tried adding it but that does not fix the problem...
These errors are coming from Xerces ...and dynamic version works fine static one is failing.

Any ideas???

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

聚集的泪 2024-10-12 02:17:10

xerces 的动态版本将依赖于 libpthread,以确保加载程序将选择正确的库。

在链接器命令行上指定 libphtread 应该可以修复那些未解析的外部文件,您是否 (a) 根据顺序将其放在命令行上的正确位置以及 (b) 您是否尝试了 libpthread 的静态和动态版本?

The dynamic version of the xerces will have dependencies on libpthread that ensure the loader will pick up the correct library.

Specifying libphtread on your linker command line should fix those unresolved externals, did you (a) put in in the right place on the command line as the ordering matters and (b) did you try the both the static and dynamic versions of libpthread?

拍不死你 2024-10-12 02:17:10

链接的 lib 的顺序对于链接器很重要,请尝试更改 pthread lib 的顺序。

The order of the lib linked matters for the linker, try changing the order for pthread lib.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文