更新时间:2023-11-16 17:14:16
如果您运行 objdump的-p libboost_thread.so
,你会发现,对于libboost_system所需的条目的.so含有(相对)的路径。根据ELF规范,所需要的条目应包括所需要的库只有名称,因此似乎是在连接器或QCC的错误。
If you run objdump -p libboost_thread.so
, you'll find that the NEEDED entry for libboost_system.so contains a (relative) path. According to the ELF specification, the NEEDED entry should contain only the name of the needed library, so there seems to be a bug in the linker or in QCC.
由于如果这时,系统将不能够找到在运行时该文件,除非当前目录是相同的,因为它是当连接发生
Because if this, the system won't be able to find the file at run-time unless the current directory is the same as it was when linking took place.
最简单的解决方法是静态链接到libboost_thread.a。
The simplest work-around is to link statically to libboost_thread.a.
另一个变通,我已经用我自己是创建一个围绕一个QCC包装,变换命令行,以便依赖给定为轮候册,-L<路径>轮候册,-l<名称>
而不是<路径> / lib目录<名称>的.so
这也需要改变升压建立系统,以便它不版本号追加到库的文件名的末尾。
Another work-around that I've used myself is to create a wrapper around QCC that transforms the command line so that dependencies are given as -Wl,-L <path> -Wl,-l <name>
instead of <path>/lib<name>.so
This also requires a change to the Boost build system so that it doesn't append the version number to the end of library file names.