简体   繁体   English

在Debian软件包中支持多个Boost版本

[英]Supporting multiple Boost versions in a Debian Package

I am trying to create a debian package for a project of mine, but have been running into issues with boost version support. 我正在尝试为我的项目创建一个debian包,但一直遇到boost版本支持的问题。

I have indeed looked at this question. 确实看了看这个问题。 It is similar but the provided solutions (Build-Depends) are not really applicable to me as I am making a binary installer. 它是类似的,但提供的解决方案(Build-Depends)并不适用于我,因为我正在制作二进制安装程序。

Basically, my installed libraries and executables always link to libboost_(component).so.1.46 instead of the symbolic link library libboost_(component).so. 基本上,我安装的库和可执行文件总是链接到libboost_(组件).so.1.46而不是符号链接库libboost_(组件).so。 Leaving my debian installer only usable by people with my exact boost version. 离开我的debian安装程序只能由我的确切提升版本的人使用。 I'm using CPack to make the debian package and my depends line looks like: 我正在使用CPack来制作debian包,我的依赖行看起来像:

SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.46),
                                  libboost-thread-dev (>= 1.46),
                                  libboost-signals-dev (>= 1.46),
                                  libboost-system-dev (>= 1.46), 
                                  libboost-filesystem-dev (>= 1.46),
                                  libboost-python-dev (>= 1.46), ..." )

Do I need to build separate installers for each platform on said platform or with that platform's boost version? 我是否需要为所述平台上的每个平台或该平台的升级版本构建单独的安装程序?

while i understand your intenstion that you want to create a package that works with all boost versions, you really have to ask yourself whether this is actually possible. 虽然我理解你想要创建一个适用于所有升级版本的软件包的强度,但你真的要问自己这是否真的可行。

the idea of .so versions (eg .so.1.46 vs .so.1.48 ) is really to indicate that the library interface (ABI) has changed , which basically indicates library incompatibilities. .so版本的概念(例如.so.1.46 vs .so.1.48 )实际上是指示库接口(ABI) 已经改变 ,这基本上表明库不兼容。

therefore, it is highly unlikely , that your application linking against libboost_foo.so.1.46 will actually work with libboost_foo.so.1.48 . 因此,这是极不可能的 ,你的应用程序链接到的libboost_foo.so.1.46将实际工作与libboost_foo.so.1.48 it could well be, that symbols needed by your application have suddenly vanished (so your application will refuse to start). 很可能,您的应用程序所需的符号突然消失(因此您的应用程序将拒绝启动)。 worse, it could be that the meaning of a symbol has changed between versions, leading to hard to track undefined behaviour. 更糟糕的是,可能是版本之间符号的含义发生了变化,导致很难跟踪未定义的行为。

this is the reason, why whenever you link against libfoo.so , the binary really links against libfoo.so.1 (or wherever libfoo.so really points) 这就是为什么每当你链接libfoo.so ,二进制文件真的链接libfoo.so.1 (或libfoo.so真正指向的地方)

now debian policy is, that the package name has to change for any incompatible ABI change. 现在debian策略是,包名称必须针对任何不兼容的ABI更改进行更改。 this basically allows the user to have two versions of the same library installed at the same time (eg boost-1.46 and boost-1.49). 这基本上允许用户同时安装相同库的两个版本(例如boost-1.46和boost-1.49)。

if you are targetting a specific version of Debian, you can be sure that a specific version of a library will be available. 如果您要定位特定版本的Debian,您可以确保可以使用特定版本的库。 eg on Debian/wheezy you will have boost-1.49. 例如在Debian / wheezy上你将获得提升-1.49。 so if you provide packages fro Debian/wheezy, you only need to link against boost-1.49. 因此,如果你提供Debian / wheezy的软件包,你只需要链接boost-1.49。 this is also one of the reasons why releases are so great: it kind of guarantees that all needed lbiraries are available. 这也是发行版如此出色的原因之一:它保证了所有需要的lbiraries都可用。

it also means, that you can have different package versions of the same application in multiple Debian releases, even though there has been no "upstream" release: the packages had to be rebuild because of an upgrade (involving a soname change) of a dependency 它还意味着,即使没有“上游”版本,你也可以在多个Debian版本中拥有相同应用程序的不同软件包版本:由于依赖项的升级(涉及soname更改),必须重新构建软件包

so to conclude: 所以得出结论:

  • linking to the actual library version is a feature to keep your system sane 链接到实际的库版本是一个让您的系统保持理智的功能

  • debian allows to have multiple versions of the same library installed at the same time debian允许同时安装同一个库的多个版本

solution for your problem: 解决您的问题:

  • provide binary packages for each soname release of any dependency 为任何依赖项的每个soname版本提供二进制包

providing packages for each debian release will make this much less troublesome than it seems (as each release has only a fixed set of libraries). 为每个debian 版本提供软件包将使它比看起来更麻烦(因为每个版本只有一组固定的库)。

What you could try to do is link boost packages statically: 你可以尝试做的是静态链接boost包:

set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)

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

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