build: fix soname info in make build

Message ID 20191210180012.871114-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Headers
Series build: fix soname info in make build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed

Commit Message

Bruce Richardson Dec. 10, 2019, 6 p.m. UTC
  The soname for each stable ABI version should be just the ABI version major
number without the minor number. Unfortunately both major and minor were
used causing version 20.1 to be incompatible with 20.0.

For make the fix is to separate out the soname passed to the linker from
the final shared library name, and then add an additional symlink to
properly ensure all expected .so.* files are present.

Fixes: cba806e07d6f ("build: change ABI versioning to global")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 mk/rte.lib.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 655a1b143..4b4267021 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -19,6 +19,8 @@  LIBABIVER := 0.$(shell cat $(RTE_SRCDIR)/ABI_VERSION | tr -d '.')
 endif
 
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+SOVER := $(basename $(LIBABIVER))
+SONAME := $(patsubst %.a,%.so.$(SOVER),$(LIB))
 LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB))
 ifeq ($(EXTLIB_BUILD),n)
 CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP)
@@ -74,7 +76,7 @@  NO_UNDEFINED := -z defs
 endif
 
 O_TO_S = $(LD) -L$(RTE_SDK_BIN)/lib $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) \
-	  -shared $(OBJS-y) $(NO_UNDEFINED) $(LDLIBS) -Wl,-soname,$(LIB) -o $(LIB)
+	  -shared $(OBJS-y) $(NO_UNDEFINED) $(LDLIBS) -Wl,-soname,$(SONAME) -o $(LIB)
 O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
 O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)","  LD $(@)")
 O_TO_S_DO = @set -e; \
@@ -133,6 +135,7 @@  $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
 	$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
 	$(Q)ln -s -f $< $(shell echo $@ | sed 's/\.so.*/.so/')
+	$(Q)ln -s -f $< $(shell echo $@ | sed 's/\.so.*/.so.$(SOVER)/')
 endif
 
 #