Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different library versions in cmake and autotools builds #189

Open
ryandesign opened this issue Nov 9, 2023 · 6 comments
Open

Different library versions in cmake and autotools builds #189

ryandesign opened this issue Nov 9, 2023 · 6 comments

Comments

@ryandesign
Copy link

faad2 2.10.1 built with autotools on macOS has this library information (viewed with otool -L):

/opt/local/lib/libfaad.dylib:
	/opt/local/lib/libfaad.2.dylib (compatibility version 3.0.0, current version 3.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

Note specifically the library's current minor version and compatibility minor version.

faad2 2.11.0 built with cmake on macOS has this library information:

/opt/local/lib/libfaad.dylib:
	/opt/local/lib/libfaad.2.dylib (compatibility version 2.0.0, current version 2.11.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

Note how even though this is a later version of faad2, its library's minor versions are lower.

This is one of those problems with maintaining two build systems. It's a lot of work to ensure that they both function the same. You may want to consider dropping all but one build system.

ryandesign referenced this issue in macports/macports-ports Nov 9, 2023
* switch to cmake 1.1 portgroup
@fabiangreffrath
Copy link
Collaborator

Well, not too sure what to do about this one. @eustas any idea?

@fabiangreffrath
Copy link
Collaborator

I don't even know where that "version 3" came from. This is what was passed in the Autotools times:
https://github.com/knik0/faad2/blob/3918dee56063500d0aa23d6c3c94b211ac471a8c/libfaad/Makefile.am#L7C55-L7C55

@eustas
Copy link
Contributor

eustas commented Nov 27, 2023

Hi. Sorry I've been offline for ~3 weeks. Will take a look soon.

@ryandesign
Copy link
Author

I don't even know where that "version 3" came from. This is what was passed in the Autotools times:
https://github.com/knik0/faad2/blob/3918dee56063500d0aa23d6c3c94b211ac471a8c/libfaad/Makefile.am#L7C55-L7C55

So you were passing -version-info 2:0:0 to libtool, where 2 is current, the first 0 is revision, and the second 0 is age. Libtool uses an algorithm to convert current, revision, and age to library version numbers. The algorithm is not the same on every operating system. Specifically, early versions of Mac OS X did not accept minor library version numbers less than 1.0.0, but many existing open source projects designed for other operating systems used minor library versions less than 1.0.0. Therefore, when Mac OS X support was first added to libtool, it was decided that 1 would be added to current on Mac OS X:

https://github.com/autotools-mirror/libtool/blob/1ec8fa28dcb29500d485c136db28315671ec4c3b/build-aux/ltmain.in#L7016

Therefore, specifying 2:0:0 results in a library minor version of 3.0.0 on macOS and 2.0.0 on other operating systems. This is not a problem unless you decide to switch away from libtool and implement your own library versioning without understanding that this difference exists.

@eustas
Copy link
Contributor

eustas commented Nov 28, 2023

Since CMake calculates / sets version numbers, it is possible to add a hack when OS == Darwin.
@fabiangreffrath do we want to do that?

@fabiangreffrath
Copy link
Collaborator

I guess the only ones who are affected by this change are software distributors for Apple, e.g. like Macports. But since we have already released with this change, rebuilds have become necessary (and have been executed) anyway, so this ship has sailed, I'm afraid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants