简体   繁体   English

在Linux上构建Boost - 库名

[英]Building Boost on Linux - library names

I am trying to build an application which depends on Boost . 我正在尝试构建一个依赖于Boost的应用程序。 So I downloaded Boost 1_41_0 to my Linux box and followed the instructions found on the Boost site for Unix variants, http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html . 所以我将Boost 1_41_0下载到我的Linux盒子中,然后按照Boost站点上的Unix变种说明进行操作, http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html

They basically suggest that I run ./bjam install, which I did. 他们基本上建议我运行./bjam install,我做了。 The build completed successfully. 构建成功完成。 However, the library names don't seem to match the Boost naming convention described both in the documentation above, and what is specified in the makefile of the application I am trying to build. 但是,库名称似乎与上面的文档中描述的Boost命名约定不匹配,以及我正在尝试构建的应用程序的makefile中指定的内容。

I noticed that there are a bunch of options that I can specify to bjam and I tried to play with those, but no matter what happens I can't seem to get it quite right. 我注意到我可以为bjam指定一些选项,我尝试使用这些选项,但不管发生了什么,我似乎都无法做到这一点。 My understanding is that the libraries should go into the $BOOST_ROOT/lib directory. 我的理解是库应该进入$ BOOST_ROOT / lib目录。 This is where the libraries show up, but named: 这是库出现的地方,但命名为:

libboost_thread.a
libboost_thread.so
libboost_thread.so.1.41.0

I'd expect them to be named libboost_thread-gcc41-mt-d-1_41_0 or something similar. 我希望它们被命名为libboost_thread-gcc41-mt-d-1_41_0或类似的东西。

I did try ./bjam --build-type=complete --layout=tagged and I see: 我试过./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

So, I am not sure if I should just make stage my -L directory? 所以,我不确定我是否应该创建舞台我的-L目录? Is there any documentation which describe this in more detail? 有没有更详细地描述这个的文件?

The names was changed in 1.40.0 - see in release notes : 名称在1.40.0中更改 - 请参阅发行说明

Build System 构建系统

The default naming of libraries in Unix-like environment now matches system conventions, and does not include various decorations. 类Unix环境中库的默认命名现在与系统约定相匹配,并且不包括各种装饰。

They probably forgot to update this part in the build documentation. 他们可能忘记在构建文档中更新此部分。

There are two variables here. 这里有两个变量。 First is "install" vs. "stage" (default). 首先是“安装”与“舞台”(默认)。 "install" copies both libraries and headers into a directory -- /usr/local by default, and you can then remove source tree. “install”将库和头文件复制到一个目录 - 默认情况下为/ usr / local,然后您可以删除源树。 "stage" puts libraries to "stage/lib", and you should add "-L /stage/lib -I " flags. “stage”将库放到“stage / lib”中,你应该添加“-L / stage / lib -I”标志。

Second is --layout=versioned and --layout=system. 第二个是--layout =版本化和--layout =系统。 It seems like you have discovered what they do already, and indeed, system is default since 1.40. 看起来你已经发现了他们已经做过的事情,事实上,系统是1.40以来的默认设置。 The getting started guide fails to mention this, and I've added an action item to update it. 入门指南未提及此问题,我添加了一个操作项来更新它。 Ideally, you should talk to the authors of the application to use the system naming of boost libraries. 理想情况下,您应该与应用程序的作者交谈,以使用boost库的系统命名。 If that's not possible, then building with --layout=versioned is the only option. 如果那是不可能的,那么使用--layout = versioned构建是唯一的选择。

From the Boost documentation at http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#library-naming , the convention is: 来自http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#library-naming的Boost文档,该约定是:

-mt Threading tag: indicates that the library was built with multithreading support enabled. -mt Threading标记:表示库是在启用多线程支持的情况下构建的。 Libraries built without multithreading support can be identified by the absence of -mt. 没有多线程支持的情况下构建的库可以通过缺少-mt来识别。

-d ABI tag: encodes details that affect the library's interoperability with other compiled code. -d ABI标记:对影响库与其他编译代码的互操作性的详细信息进行编码。 For each such feature, a single letter is added to the tag: 对于每个此类功能,标记中都会添加一个字母:

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.

For example, if you build a debug version of your code for use with debug versions of the static runtime library and the STLPort standard library in “native iostreams” mode, the tag would be: -sgdpn. 例如,如果构建代码的调试版本以与“native iostreams”模式下的静态运行时库和STLPort标准库的调试版本一起使用,则标记将为:-sgdpn。 If none of the above apply, the ABI tag is ommitted. 如果以上都不适用,则省略ABI标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM