From 221fb04df9418e09228655d3ab4c75c3120ff47d Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Tue, 29 Apr 2014 09:57:38 +0200 Subject: [PATCH] mk: fix build ignoring other installed versions If some DPDK libraries are installed on the system, the linker was trying to use them before searching in -L path. The obscure reason is that we were prefixing -L with -Wl, to pass it directly to the linker. But -L is also a gcc option. And allowing gcc to process this option fixes the issue. Signed-off-by: Thomas Monjalon Acked-by: Neil Horman --- mk/internal/rte.build-pre.mk | 3 +++ mk/rte.app.mk | 7 +++---- mk/rte.shared.mk | 7 +++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mk/internal/rte.build-pre.mk b/mk/internal/rte.build-pre.mk index d748189417..d5ddbfab52 100644 --- a/mk/internal/rte.build-pre.mk +++ b/mk/internal/rte.build-pre.mk @@ -30,3 +30,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _BUILD_TARGETS := _prebuild _build _postbuild + +comma := , +linkerprefix = $(subst -Wl$(comma)-L,-L,$(addprefix -Wl$(comma),$1)) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 072718a9d4..a2c60b6059 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -204,10 +204,9 @@ LDLIBS += -l$(RTE_LIBNAME) endif ifeq ($(LINK_USING_CC),1) -comma := , -LDLIBS := $(addprefix -Wl$(comma),$(LDLIBS)) -LDFLAGS := $(addprefix -Wl$(comma),$(LDFLAGS)) -override EXTRA_LDFLAGS := $(addprefix -Wl$(comma),$(EXTRA_LDFLAGS)) +LDLIBS := $(call linkerprefix,$(LDLIBS)) +LDFLAGS := $(call linkerprefix,$(LDFLAGS)) +override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDLIBS) else diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk index e9be02d927..42feee7430 100644 --- a/mk/rte.shared.mk +++ b/mk/rte.shared.mk @@ -58,10 +58,9 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) ifeq ($(LINK_USING_CC),1) -comma := , -LDLIBS := $(addprefix -Wl$(comma),$(LDLIBS)) -LDFLAGS := $(addprefix -Wl$(comma),$(LDFLAGS)) -override EXTRA_LDFLAGS := $(addprefix -Wl$(comma),$(EXTRA_LDFLAGS)) +LDLIBS := $(call linkerprefix,$(LDLIBS)) +LDFLAGS := $(call linkerprefix,$(LDFLAGS)) +override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) O_TO_SO = $(CC) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ -shared -o $@ $(OBJS-y) $(LDLIBS) else -- 2.20.1