fix macOS use of -dead_strip_dylibs, install major version lib symlinks.

Under macOS, to reduce dependency chains, we remove functions and
data that are unreachable by the entry point or exported symbols.
In particular, the macOS linker is used with "-dead_strip" by default.

While calc on macOS will execute if linker used with "-dead_strip_dylibs"
and CUSTOM is defined, other applications that use libcalc but not
libcustcalc (such as sample_many and sample_rand) will fail to execute
due to missile symbols.  Therefore "-dead_strip_dylibs" is not used
by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS.
Thanks to GitHub user @TurtleWilly for bringing to our attention,
problems related to use of  "-dead_strip_dylibs".

When installing shared libraries, libcalc.x.y.z will be a link
to the libcalc shared library and libcustcalc.x.y.z will be a link
to the libcustcal shared library.
This commit is contained in:
Landon Curt Noll
2023-08-14 17:40:29 -07:00
parent 7d8d4cb5ea
commit faf3a4fab6
3 changed files with 31 additions and 9 deletions

12
CHANGES
View File

@@ -87,18 +87,24 @@ The following are the changes from calc version 2.14.3.1 to date:
Added Makefile variable ${VER} to hold the calc major release version. Added Makefile variable ${VER} to hold the calc major release version.
The calc major release version is a 3 level version (x.y.z). The calc major release version is a 3 level version (x.y.z).
Under macOS, the current version of both libcalc and Under macOS, the current version of both libcalc and libcustcalc
libcustcalc are set to the current calc major release version. shared libraries are set to the current calc major release version.
Under macOS, to reduce dependency chains, we remove functions and Under macOS, to reduce dependency chains, we remove functions and
data that are unreachable by the entry point or exported symbols. data that are unreachable by the entry point or exported symbols.
In particular, the macOS linker is used with "-dead_strip". In particular, the macOS linker is used with "-dead_strip" by default.
While calc on macOS will execute if linker used with "-dead_strip_dylibs" While calc on macOS will execute if linker used with "-dead_strip_dylibs"
and CUSTOM is defined, other applications that use libcalc but not and CUSTOM is defined, other applications that use libcalc but not
libcustcalc (such as sample_many and sample_rand) will fail to execute libcustcalc (such as sample_many and sample_rand) will fail to execute
due to missile symbols. Therefore "-dead_strip_dylibs" is not used due to missile symbols. Therefore "-dead_strip_dylibs" is not used
by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS. by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS.
Thanks to GitHub user @TurtleWilly for bringing to our attention,
problems related to use of "-dead_strip_dylibs".
When installing shared libraries, libcalc.x.y.z will be a link
to the libcalc shared library and libcustcalc.x.y.z will be a link
to the libcustcal shared library.
The following are the changes from calc version 2.14.2.1 to 2.14.3.0: The following are the changes from calc version 2.14.2.1 to 2.14.3.0:

View File

@@ -290,8 +290,8 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
# #
CALC_STATIC_LIBS= libcalc.a libcustcalc.a CALC_STATIC_LIBS= libcalc.a libcustcalc.a
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION} CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} \ SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} libcustcalc${LIB_EXT} \
libcustcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT} libcalc${LIB_EXT_VER} libcustcalc${LIB_EXT_VER}
EARLY_TARGETS= hsrc .hsrc custom/.all custom/Makefile EARLY_TARGETS= hsrc .hsrc custom/.all custom/Makefile
# list of sample programs that need to be built to satisfy sample rule # list of sample programs that need to be built to satisfy sample rule
@@ -483,6 +483,10 @@ libcalc${LIB_EXT}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
${LN} -s $? $@ ${LN} -s $? $@
libcalc${LIB_EXT_VER}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
### ###
# #
# calc documentation # calc documentation
@@ -2370,6 +2374,10 @@ libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
${LN} -s $? $@ ${LN} -s $? $@
libcustcalc${LIB_EXT_VER}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
### ###
# #
# building calc-static and static lib*.a libraries # building calc-static and static lib*.a libraries
@@ -3392,9 +3400,6 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
echo "installed ${T}${LIBDIR}/libcalc.a"; \ echo "installed ${T}${LIBDIR}/libcalc.a"; \
fi; \ fi; \
fi fi
${Q}# NOTE: The this makefile installs libcustcalc${LIB_EXT_VERSION}
${Q}# because we only want to perform one ${LDCONFIG} for both
${Q}# libcalc${LIB_EXT_VERSION} and libcustcalc${LIB_EXT_VERSION}.
-${Q} if [ -f libcalc${LIB_EXT_VERSION} ]; then \ -${Q} if [ -f libcalc${LIB_EXT_VERSION} ]; then \
if ${CMP} -s libcalc${LIB_EXT_VERSION} \ if ${CMP} -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}; then \ ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}; then \
@@ -3418,6 +3423,11 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
${LN} -f -s libcalc${LIB_EXT_VERSION} \ ${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT}; \ ${T}${LIBDIR}/libcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \ echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
echo ${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VER}; \
${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VER}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VER}"; \
fi; \ fi; \
fi fi
-${Q} if [ -f custom/libcustcalc${LIB_EXT_VERSION} ]; then \ -${Q} if [ -f custom/libcustcalc${LIB_EXT_VERSION} ]; then \
@@ -3443,6 +3453,11 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \ ${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT}; \ ${T}${LIBDIR}/libcustcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \ echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
echo ${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}; \
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VER}"; \
if [ -z "${T}" -o "/" = "${T}" ]; then \ if [ -z "${T}" -o "/" = "${T}" ]; then \
if [ ! -z "${LDCONFIG}" ]; then \ if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \ echo "running ${LDCONFIG}"; \

View File

@@ -1313,6 +1313,7 @@ VER= 2.14.3
# #
LIB_EXT= .so LIB_EXT= .so
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION} LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
LIB_EXT_VER= ${LIB_EXT}.${VER}
# standard utilities used during make # standard utilities used during make
# #