与 Boost 库一起分发?
我对使用 boost 很陌生,我似乎无法在任何地方找到有关如何在使用 boost 时分发应用程序的文档?
许多库都是共享库,我不希望我的用户安装 boost,我只使用单个库(正则表达式),所以有没有一种简单的方法可以将正则表达式库与我的应用程序打包在一起,而无需使用静态编译版本?
I'm quite new to using boost and I can't seem to find documentation anywhere on how to distribute your application when using boost?
Many of the libraries are shared libraries, I'm not expecting my users to have boost installed, I'm only using a single library (regex) so is there an easy way to package the regex library with my application without compiling with the static version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Linux
对于二进制发行版,我建议使用发行版的包管理,它应该处理所有依赖关系。
一些商业应用程序只使用二进制blob,你需要自己安装一个版本的boost。
在 Linux 上查找库有点困难。如果共享对象在编译时链接,它不会自动从当前目录加载共享对象(与使用 dlopen 在运行时加载相反)。
您必须使用 LD_LIBRARY_PATH 环境变量或使用 rpath。两者都有其缺点。
Windows
没有办法包含 dll。通常的方法是将所有内容放入一个目录中并将其压缩。
两者
要从源代码构建,无论如何都需要增强源,因此不需要包含库。
无论如何,boost 中的大多数库都只是头文件,regexp 不是其中之一。包含该模块的 dll 就足够了。
在 Linux 中,您可以使用以下命令检查二进制文件编译的共享库:
Linux
For binary distribution, I recommend using the distribution's package management, which should take care of any dependencies.
Some commercial apps just use binary blobs and you need to install a version of boost by yourself.
Finding libraries is a bit more difficult on linux. It does not automatically load shared objects from the current directory if they are linked at compile time (as opposed to loading at runtime with dlopen).
You have to use the LD_LIBRARY_PATH env variable or use rpath. Both has it's drawbacks.
Windows
There is no way around including the dlls. The usual approach is to put everything into a directory and zip it up.
Both
To build from source you need the boost sources anyway, so no need to include libraries.
Most libraries in boost are header only anyway, regexp is not one of them. It should be sufficient to include dlls for this module.
In Linux you can check against which shared libs your binary is compiled by using: