[英]Building Boost on Linux - library names
我正在尝试构建一个依赖于Boost的应用程序。 所以我将Boost 1_41_0下载到我的Linux盒子中,然后按照Boost站点上的Unix变种说明进行操作, http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html 。
他们基本上建议我运行./bjam install,我做了。 构建成功完成。 但是,库名称似乎与上面的文档中描述的Boost命名约定不匹配,以及我正在尝试构建的应用程序的makefile中指定的内容。
我注意到我可以为bjam指定一些选项,我尝试使用这些选项,但不管发生了什么,我似乎都无法做到这一点。 我的理解是库应该进入$ BOOST_ROOT / lib目录。 这是库出现的地方,但命名为:
libboost_thread.a
libboost_thread.so
libboost_thread.so.1.41.0
我希望它们被命名为libboost_thread-gcc41-mt-d-1_41_0或类似的东西。
我试过./bjam --build-type = complete --layout = tagged,我看到:
libboost_thread.a
libboost_thread-mt.a
libboost_thread-mt-d.a
libboost_thread-mt-d.so
libboost_thread-mt-d.so.1.41.0
libboost_thread-mt-s.a
libboost_thread-mt-sd.a
libboost_thread-mt.so
libboost_thread-mt.so.1.41.0
libboost_thread.so
libboost_thread.so.1.41.0
所以,我不确定我是否应该创建舞台我的-L目录? 有没有更详细地描述这个的文件?
这里有两个变量。 首先是“安装”与“舞台”(默认)。 “install”将库和头文件复制到一个目录 - 默认情况下为/ usr / local,然后您可以删除源树。 “stage”将库放到“stage / lib”中,你应该添加“-L / stage / lib -I”标志。
第二个是--layout =版本化和--layout =系统。 看起来你已经发现了他们已经做过的事情,事实上,系统是1.40以来的默认设置。 入门指南未提及此问题,我添加了一个操作项来更新它。 理想情况下,您应该与应用程序的作者交谈,以使用boost库的系统命名。 如果那是不可能的,那么使用--layout = versioned构建是唯一的选择。
来自http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#library-naming的Boost文档,该约定是:
-mt Threading标记:表示库是在启用多线程支持的情况下构建的。 没有多线程支持的情况下构建的库可以通过缺少-mt来识别。
-d ABI标记:对影响库与其他编译代码的互操作性的详细信息进行编码。 对于每个此类功能,标记中都会添加一个字母:
Key Use this library when: s linking statically to the C++ standard library and compiler runtime support libraries. g using debug versions of the standard and runtime support libraries. y using a special debug build of Python. d building a debug version of your code. p using the STLPort standard library rather than the default one supplied with your compiler. n using STLPort's deprecated “native iostreams” feature.
例如,如果构建代码的调试版本以与“native iostreams”模式下的静态运行时库和STLPort标准库的调试版本一起使用,则标记将为:-sgdpn。 如果以上都不适用,则省略ABI标记。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.