Automake:Makefile.am中* _la_LDFLAGS的有效值是多少?

时间:2022-05-15 12:41:38

I am wondering what are the possible value for *_la_LDFLAGS in Makefile.am ?

我想知道Makefile.am中* _la_LDFLAGS的可能值是什么?

If I ask this question, it is because I would like the following :

如果我问这个问题,那是因为我想要以下内容:

Actual shared library : libA.so (or with the version number I don't care)
Symbolic links :        libA-X.Y.Z.so, libA-X.so, libA.so 
soname :                libA-X.so

However here is what I get by using the -release flag :

然而,这是我通过使用-release标志得到的:

Actual shared library : libA-X.Y.Z.so
Symbolic links :        libA.so 
soname :                libA-X.Y.Z.so    !!! this is not what I want 

I also tried with no flags at all and got

我也试过没有任何标志,并得到了

Actual shared library : libA-0.0.0.so    !!! 0.0.0 and not the real version
Symbolic links :        libA.so, libA-0.so
soname :                libA-0.so        !!! 0.0.0 and not the real version

How should I do ? which flag should I use ?

我应该怎么做 ?我应该使用哪个旗帜?

Thanks in advance

提前致谢

2 个解决方案

#1


2  

You should use the -version-info option of Libtool to specify the interface version of the library, but be sure to read how versioning works (or here for the official manual.)

您应该使用Libtool的-version-info选项指定库的接口版本,但请务必阅读版本控制的工作原理(或此处的官方手册)。

You can additionally play with -release to make the version number of your package more apparent, but I doubt you will ever get the exact naming you'd like. Libtool has its own set of rules to define how to name the file and what symlinks to create depending on the system: these should really be regarded as implementation details of how a shared library is installed.

您还可以使用-release来使您的软件包的版本号更加明显,但我怀疑您是否会获得您想要的确切命名。 Libtool有自己的一套规则来定义如何命名文件以及根据系统创建的符号链接:这些应该被视为如何安装共享库的实现细节。

#2


1  

IMHO, the layout you want is broken. Apps that are linked to your library will depend on libA-X.so because of the soname. But what happens when libA.so is version X+1? To what will the libA-X.so symlink point?

恕我直言,你想要的布局被打破了。由于soname,链接到您的库的应用程序将依赖于libA-X.so。但是当libA.so是版本X + 1时会发生什么? libA-X.so符号链接指向什么?

The idea behind the layout you get with the -release flag is, when an app links with -lA, it will result in it being linked against the latest version. It will then, because of the soname, depend on libA-X.Y.Z.so at runtime. When you install a new version of the library, that will install a new libA-X.Y.Q.so, but it will leave the old one alone - exactly as old apps that depend on it expect. New apps will still, because of the libA symlink, link against the latest version.

使用-release标志获得的布局背后的想法是,当应用程序与-lA链接时,它将导致它与最新版本链接。然后,由于soname,它将在运行时依赖于libA-X.Y.Z.so。当您安装新版本的库时,它将安装一个新的libA-X.Y.Q.so,但它将保留旧版本 - 完全与依赖它的旧应用程序相同。由于libA符号链接,新应用程序仍会链接到最新版本。

Years of thought by some very smart people have went into a versioning scheme that allows new apps to link against the latest version of a library, while allowing multiple versions to co-exist peacefully to satisfy dependencies for apps that need them. My advice is, don't second-guess all that.

一些非常聪明的人多年的思考已经进入了一个版本控制方案,允许新的应用程序链接到最新版本的库,同时允许多个版本和平共存以满足需要它们的应用程序的依赖关系。我的建议是,不要再猜测这一切。

#1


2  

You should use the -version-info option of Libtool to specify the interface version of the library, but be sure to read how versioning works (or here for the official manual.)

您应该使用Libtool的-version-info选项指定库的接口版本,但请务必阅读版本控制的工作原理(或此处的官方手册)。

You can additionally play with -release to make the version number of your package more apparent, but I doubt you will ever get the exact naming you'd like. Libtool has its own set of rules to define how to name the file and what symlinks to create depending on the system: these should really be regarded as implementation details of how a shared library is installed.

您还可以使用-release来使您的软件包的版本号更加明显,但我怀疑您是否会获得您想要的确切命名。 Libtool有自己的一套规则来定义如何命名文件以及根据系统创建的符号链接:这些应该被视为如何安装共享库的实现细节。

#2


1  

IMHO, the layout you want is broken. Apps that are linked to your library will depend on libA-X.so because of the soname. But what happens when libA.so is version X+1? To what will the libA-X.so symlink point?

恕我直言,你想要的布局被打破了。由于soname,链接到您的库的应用程序将依赖于libA-X.so。但是当libA.so是版本X + 1时会发生什么? libA-X.so符号链接指向什么?

The idea behind the layout you get with the -release flag is, when an app links with -lA, it will result in it being linked against the latest version. It will then, because of the soname, depend on libA-X.Y.Z.so at runtime. When you install a new version of the library, that will install a new libA-X.Y.Q.so, but it will leave the old one alone - exactly as old apps that depend on it expect. New apps will still, because of the libA symlink, link against the latest version.

使用-release标志获得的布局背后的想法是,当应用程序与-lA链接时,它将导致它与最新版本链接。然后,由于soname,它将在运行时依赖于libA-X.Y.Z.so。当您安装新版本的库时,它将安装一个新的libA-X.Y.Q.so,但它将保留旧版本 - 完全与依赖它的旧应用程序相同。由于libA符号链接,新应用程序仍会链接到最新版本。

Years of thought by some very smart people have went into a versioning scheme that allows new apps to link against the latest version of a library, while allowing multiple versions to co-exist peacefully to satisfy dependencies for apps that need them. My advice is, don't second-guess all that.

一些非常聪明的人多年的思考已经进入了一个版本控制方案,允许新的应用程序链接到最新版本的库,同时允许多个版本和平共存以满足需要它们的应用程序的依赖关系。我的建议是,不要再猜测这一切。