相对路径构建Boost库 [英] boost libraries built with relative paths

查看:147
本文介绍了相对路径构建Boost库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建升压1.57.0在QNX 6.5.0。没有生成错误。但是,一些库链接到指定libboost_system.so相对路径。我保存的编辑日志。下面是boost_thread联动步:

I built boost 1.57.0 in QNX 6.5.0. There is no build error. But some libraries are linked to libboost_system.so specifying relative path. I saved compilation logs. Here is linkage step for boost_thread:

"QCC_gpp"   -o "bin.v2/libs/thread/build/qcc/release/threading-multi/libboost_thread.so.1.57.0"  -shared "bin.v2/libs/thread/build/qcc/release/threading-multi/pthread/thread.o" "bin.v2/libs/thread/build/qcc/release/threading-multi/pthread/once.o" "bin.v2/libs/thread/build/qcc/release/threading-multi/future.o" "bin.v2/libs/system/build/qcc/release/threading-multi/libboost_system.so.1.57.0"    -lm 

所以,当我运行 LDD libboost_thread.so ,它无法找到libboost_system。我觉得libboost_thread应该 -lboost_system 选项链接。但我不知道如何做到这一点。

So, When I run ldd libboost_thread.so, it can't find libboost_system. I think libboost_thread should be linked with -lboost_system option. But I don't know how to do this.

感谢。

编辑:我无法建立任何程序与boost_thread链接。因为,boost_thread搜索boost_system在 bin.v2 /库/系统/建造/ QCC /发行/线程的多文件夹中。然而无论boost_thread和boost_system是在库搜索文件夹。 (与定义的 LD_LIBRARY_PATH

I cannot build any program linking with boost_thread. Because, boost_thread searches boost_system in bin.v2/libs/system/build/qcc/release/threading-multi folder. However both boost_thread and boost_system are in a library search folder. (defined with LD_LIBRARY_PATH)

推荐答案

如果您运行 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.

这篇关于相对路径构建Boost库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆