[dpdk-dev,v3,3/4] Add library version extenstion
Commit Message
To differentiate libraries that break ABI, we add a library version number
suffix to the library, which must be incremented when a given libraries ABI is
broken. This patch enforces that addition, sets the initial abi soname
extension to 1 for each library and creates a symlink to the base SONAME so that
the test applications will link properly.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Thomas Monjalon <thomas.monjalon@6wind.com>
CC: "Richardson, Bruce" <bruce.richardson@intel.com>
Change Notes:
v3)
Made symlinking of libraries conditional on a DSO build
---
lib/librte_acl/Makefile | 2 ++
lib/librte_cfgfile/Makefile | 2 ++
lib/librte_cmdline/Makefile | 2 ++
lib/librte_compat/Makefile | 2 ++
lib/librte_distributor/Makefile | 2 ++
lib/librte_eal/bsdapp/eal/Makefile | 2 ++
lib/librte_eal/linuxapp/eal/Makefile | 2 ++
lib/librte_ether/Makefile | 2 ++
lib/librte_hash/Makefile | 2 ++
lib/librte_ip_frag/Makefile | 2 ++
lib/librte_ivshmem/Makefile | 2 ++
lib/librte_kni/Makefile | 2 ++
lib/librte_kvargs/Makefile | 2 ++
lib/librte_lpm/Makefile | 2 ++
lib/librte_malloc/Makefile | 2 ++
lib/librte_mbuf/Makefile | 2 ++
lib/librte_mempool/Makefile | 2 ++
lib/librte_meter/Makefile | 2 ++
lib/librte_pipeline/Makefile | 2 ++
lib/librte_pmd_af_packet/Makefile | 2 ++
lib/librte_pmd_bond/Makefile | 2 ++
lib/librte_pmd_e1000/Makefile | 2 ++
lib/librte_pmd_enic/Makefile | 2 ++
lib/librte_pmd_i40e/Makefile | 2 ++
lib/librte_pmd_ixgbe/Makefile | 2 ++
lib/librte_pmd_pcap/Makefile | 2 ++
lib/librte_pmd_ring/Makefile | 2 ++
lib/librte_pmd_virtio/Makefile | 2 ++
lib/librte_pmd_vmxnet3/Makefile | 2 ++
lib/librte_pmd_xenvirt/Makefile | 2 ++
lib/librte_port/Makefile | 2 ++
lib/librte_power/Makefile | 2 ++
lib/librte_ring/Makefile | 2 ++
lib/librte_sched/Makefile | 2 ++
lib/librte_table/Makefile | 2 ++
lib/librte_timer/Makefile | 2 ++
lib/librte_vhost/Makefile | 2 ++
mk/rte.lib.mk | 13 +++++++++++--
38 files changed, 85 insertions(+), 2 deletions(-)
Comments
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Neil Horman
> Sent: Tuesday, December 23, 2014 3:52 PM
>
> a/mk/rte.lib.mk b/mk/rte.lib.mk index 1d3b646..7326b8e 100644
> --- a/mk/rte.lib.mk
> +++ b/mk/rte.lib.mk
> @@ -163,9 +168,13 @@ endif
> # install lib in $(RTE_OUTPUT)/lib
> #
> $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
> + $(eval LIBSONAME := $(basename $(LIB)))
> @echo " INSTALL-LIB $(LIB)"
> @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
> $(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
> +ifeq ($(RTE_BUILD_SHARED_LIB),y)
> + $(Q)ln -s -f ./$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME) endif
>
For the relative symbolic link I meant the -r option:
ln -r -s -f $(RTE_OUTPUT)/lib /$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME)
But this works too so I leave it up to you whether to change it or not.
Regards,
Sergio
> #
> # Clean all generated files
> --
> 1.9.3
On Tue, Dec 23, 2014 at 04:44:32PM +0000, Gonzalez Monroy, Sergio wrote:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Neil Horman
> > Sent: Tuesday, December 23, 2014 3:52 PM
> >
> > a/mk/rte.lib.mk b/mk/rte.lib.mk index 1d3b646..7326b8e 100644
> > --- a/mk/rte.lib.mk
> > +++ b/mk/rte.lib.mk
> > @@ -163,9 +168,13 @@ endif
> > # install lib in $(RTE_OUTPUT)/lib
> > #
> > $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
> > + $(eval LIBSONAME := $(basename $(LIB)))
> > @echo " INSTALL-LIB $(LIB)"
> > @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
> > $(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
> > +ifeq ($(RTE_BUILD_SHARED_LIB),y)
> > + $(Q)ln -s -f ./$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME) endif
> >
> For the relative symbolic link I meant the -r option:
> ln -r -s -f $(RTE_OUTPUT)/lib /$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME)
>
I don't think theres any need to change it, given that they produce identical
output
> But this works too so I leave it up to you whether to change it or not.
>
I'm gong to leave it as is
> Regards,
> Sergio
>
> > #
> > # Clean all generated files
> > --
> > 1.9.3
>
>
On Tue, Dec 23, 2014 at 10:51:52AM -0500, Neil Horman wrote:
> To differentiate libraries that break ABI, we add a library version number
> suffix to the library, which must be incremented when a given libraries ABI is
> broken. This patch enforces that addition, sets the initial abi soname
> extension to 1 for each library and creates a symlink to the base SONAME so that
> the test applications will link properly.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> CC: Thomas Monjalon <thomas.monjalon@6wind.com>
> CC: "Richardson, Bruce" <bruce.richardson@intel.com>
>
> Change Notes:
> v3)
> Made symlinking of libraries conditional on a DSO build
> ---
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2014-12-23 10:51, Neil Horman:
> To differentiate libraries that break ABI, we add a library version number
> suffix to the library, which must be incremented when a given libraries ABI is
> broken. This patch enforces that addition, sets the initial abi soname
> extension to 1 for each library and creates a symlink to the base SONAME so that
> the test applications will link properly.
[...]
> --- a/mk/rte.lib.mk
> +++ b/mk/rte.lib.mk
> @@ -37,10 +37,9 @@ include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
>
> # VPATH contains at least SRCDIR
> VPATH += $(SRCDIR)
> -
> ifeq ($(RTE_BUILD_SHARED_LIB),y)
> -LIB := $(patsubst %.a,%.so,$(LIB))
>
> +LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB))
> CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP)
>
> endif
> @@ -63,6 +62,7 @@ build: _postbuild
>
> exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
>
> +
Newline changes seem weird.
> ifeq ($(LINK_USING_CC),1)
> # Override the definition of LD here, since we're linking with CC
> LD := $(CC) $(CPU_CFLAGS)
> @@ -113,6 +113,10 @@ lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib;
> #
> ifeq ($(RTE_BUILD_SHARED_LIB),y)
> $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
> +ifeq ($(LIBABIVER),)
> + @echo "Must Specify a $(LIB) ABI version"
> + @exit 1
I think (not sure) that @false is better handled than @exit in case of parallel processing.
> +endif
> @[ -d $(dir $@) ] || mkdir -p $(dir $@)
> $(if $(D),\
> @echo -n "$< -> $@ " ; \
> @@ -126,6 +130,7 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
> $(depfile_missing),\
> $(depfile_newer)),\
> $(O_TO_S_DO))
> +
> ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
> $(if $(or \
> $(file_missing),\
> @@ -163,9 +168,13 @@ endif
> # install lib in $(RTE_OUTPUT)/lib
> #
> $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
> + $(eval LIBSONAME := $(basename $(LIB)))
> @echo " INSTALL-LIB $(LIB)"
> @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
> $(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
> +ifeq ($(RTE_BUILD_SHARED_LIB),y)
> + $(Q)ln -s -f ./$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME)
> +endif
Why using ./ ?
Why using the eval trick for $(LIBSONAME) instead of $(basename $(LIB)) ?
Even better, you could use $< instead of $(LIB), matter of taste.
@@ -39,6 +39,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
EXPORT_MAP := rte_acl_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_ACL) += tb_mem.c
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_cfgfile_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_cmdline_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := cmdline.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_cirbuf.c
@@ -32,6 +32,8 @@
include $(RTE_SDK)/mk/rte.vars.mk
+LIBABIVER := 1
+
# install includes
SYMLINK-y-include := rte_compat.h
@@ -39,6 +39,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
EXPORT_MAP := rte_distributor_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c
@@ -48,6 +48,8 @@ CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_eal_version.map
+LIBABIVER := 1
+
# specific to linuxapp exec-env
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c
SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c
@@ -35,6 +35,8 @@ LIB = librte_eal.a
EXPORT_MAP := rte_eal_version.map
+LIBABIVER := 1
+
VPATH += $(RTE_SDK)/lib/librte_eal/common
CFLAGS += -I$(SRCDIR)/include
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_ether_version.map
+LIBABIVER := 1
+
SRCS-y += rte_ethdev.c
#
@@ -39,6 +39,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
EXPORT_MAP := rte_hash_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_HASH) := rte_hash.c
SRCS-$(CONFIG_RTE_LIBRTE_HASH) += rte_fbk_hash.c
@@ -39,6 +39,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
EXPORT_MAP := rte_ipfrag_version.map
+LIBABIVER := 1
+
#source files
ifeq ($(CONFIG_RTE_MBUF_REFCNT),y)
SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += rte_ipv4_fragmentation.c
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_ivshmem_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_kni_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
@@ -40,6 +40,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_kvargs_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
@@ -39,6 +39,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
EXPORT_MAP := rte_lpm_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
@@ -34,6 +34,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_malloc.a
+LIBABIVER := 1
+
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_malloc_version.map
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_mbuf_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_mempool_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool.c
ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_meter_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pipeline_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -40,6 +40,8 @@ LIB = librte_pmd_af_packet.a
EXPORT_MAP := rte_pmd_af_packet_version.map
+LIBABIVER := 1
+
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_eth_bond_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_e1000_version.map
+LIBABIVER := 1
+
ifeq ($(CC), icc)
#
# CFLAGS for icc
@@ -39,6 +39,8 @@ LIB = librte_pmd_enic.a
EXPORT_MAP := rte_pmd_enic_version.map
+LIBABIVER := 1
+
CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/
CFLAGS += -O3
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_i40e_version.map
+LIBABIVER := 1
+
#
# Add extra flags for base driver files (also known as shared code)
# to disable warnings
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_ixgbe_version.map
+LIBABIVER := 1
+
ifeq ($(CC), icc)
#
# CFLAGS for icc
@@ -42,6 +42,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_pcap_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_eth_ring_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_pmd_virtio_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -68,6 +68,8 @@ VPATH += $(RTE_SDK)/lib/librte_pmd_vmxnet3/vmxnet3
EXPORT_MAP := rte_pmd_vmxnet3_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_eth_xenvirt_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_port_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_power_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_ring_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
@@ -43,6 +43,8 @@ CFLAGS_rte_red.o := -D_GNU_SOURCE
EXPORT_MAP := rte_sched_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -41,6 +41,8 @@ CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_table_version.map
+LIBABIVER := 1
+
#
# all source are stored in SRCS-y
#
@@ -38,6 +38,8 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
EXPORT_MAP := rte_timer_version.map
+LIBABIVER := 1
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
@@ -36,6 +36,8 @@ LIB = librte_vhost.a
EXPORT_MAP := rte_vhost_version.map
+LIBABIVER := 1
+
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64 -lfuse
LDFLAGS += -lfuse
# all source are stored in SRCS-y
@@ -37,10 +37,9 @@ include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
# VPATH contains at least SRCDIR
VPATH += $(SRCDIR)
-
ifeq ($(RTE_BUILD_SHARED_LIB),y)
-LIB := $(patsubst %.a,%.so,$(LIB))
+LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB))
CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP)
endif
@@ -63,6 +62,7 @@ build: _postbuild
exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
+
ifeq ($(LINK_USING_CC),1)
# Override the definition of LD here, since we're linking with CC
LD := $(CC) $(CPU_CFLAGS)
@@ -113,6 +113,10 @@ lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib;
#
ifeq ($(RTE_BUILD_SHARED_LIB),y)
$(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
+ifeq ($(LIBABIVER),)
+ @echo "Must Specify a $(LIB) ABI version"
+ @exit 1
+endif
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(if $(D),\
@echo -n "$< -> $@ " ; \
@@ -126,6 +130,7 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
$(depfile_missing),\
$(depfile_newer)),\
$(O_TO_S_DO))
+
ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
$(if $(or \
$(file_missing),\
@@ -163,9 +168,13 @@ endif
# install lib in $(RTE_OUTPUT)/lib
#
$(RTE_OUTPUT)/lib/$(LIB): $(LIB)
+ $(eval LIBSONAME := $(basename $(LIB)))
@echo " INSTALL-LIB $(LIB)"
@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
+ $(Q)ln -s -f ./$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME)
+endif
#
# Clean all generated files