knik0 / faad2

Freeware Advanced Audio (AAC) Decoder faad2 mirror
https://sourceforge.net/projects/faac/
Other
175 stars 77 forks source link

Different library versions in cmake and autotools builds #189

Open ryandesign opened 1 year ago

ryandesign commented 1 year ago

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.

fabiangreffrath commented 1 year ago

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

fabiangreffrath commented 1 year ago

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 commented 11 months ago

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

ryandesign commented 11 months ago

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 commented 11 months ago

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

fabiangreffrath commented 11 months ago

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.