I am trying to create a Linuz dynamically linked shared libraries (.so) using autoconf, but, whatever I do it incorrectly versions the file. I am getting libWebLoom.so.0.0.1 instead of libWebLoom.so.0.1.0.
I am not sure what I have done wrong, I have been through autconf's help, but I can't resolve it.
/Makefile.am
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
/src/Makefile.am
SUBDIRS = WebLoom
/src/WebLoom/Makefile.am
AM_CPPFLAGS = -g -std=c++17 -Wall -Wextra -fPIC -I.
lib_LTLIBRARIES = libWebLoom.la
libWebLoom_la_SOURCES = Context.cpp
libWebLoom_la_LDFLAGS = -version-info $(LT_VERSION)
libWebLoom_la_LIBADD = $(LDADD)
CLEANFILES = $(lib_LTLIBRARIES)
/configure.ac
AC_INIT([WebLoom], [0.1.0], [WebLoom@invalid.invalid])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
LT_INIT
AC_PROG_CXX
CURRENT=$(echo $PACKAGE_VERSION | cut -d. -f1)
REVISION=$(echo $PACKAGE_VERSION | cut -d. -f2)
AGE=$(echo $PACKAGE_VERSION | cut -d. -f3)
AC_MSG_NOTICE([--- Version: $CURRENT.$REVISION.$AGE])
AC_SUBST(VERSION_MAJOR, [$CURRENT])
AC_SUBST(VERSION_MINOR, [$REVISION])
AC_SUBST(VERSION_PATCH, [$AGE]),
LT_VERSION="$CURRENT:$REVISION:$AGE"
AC_SUBST(LT_VERSION)
AC_OUTPUT
The output I am getting is:
Nov 5 10:29 libWebLoom.a
Nov 5 10:29 libWebLoom.la -> ../libWebLoom.la
Nov 5 10:29 libWebLoom.lai
Nov 5 10:29 libWebLoom.so -> libWebLoom.so.0.0.1
Nov 5 10:29 libWebLoom.so.0 -> libWebLoom.so.0.0.1
Nov 5 10:29 libWebLoom.so.0.0.1
The x.y.z
at the end of a Libtool-generated shared library name is not intended to be interpreted according to a semantic versioning scheme, and it generally does not correspond to any semantic version number chosen by you for the version of the package to which the library belongs. There are good, technical reasons for these not to match. There are logical reasons for Libtool's specific versioning design, but whether these and the resulting design in particular are good is more controversial.
You can read all about Libtool versioning in chapter 7 of the Libtool manual, and you should do if you're going to use that versioning. You should also understand that the three version parameters expressed to libtool do not map directly to the number triple at the end of shared library names. The former are meant for Libtool to consume, whereas the latter are a digested form meant for other software, such as linkers, to consume.
If you want to tag your libtool-built shared library with the package's semantic version number, then you can use the -release
flag instead of the -version-info
flag in the library's LDFLAGS
. This will incorporate the version number into the library's base name, but beware: among the effects is that no two releases of your package will be binary-compatible with each other.