* [dpdk-dev] [PATCH] mk: fix build ignoring other installed versions @ 2014-04-29 11:52 Thomas Monjalon 2014-04-30 20:57 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon 0 siblings, 1 reply; 4+ messages in thread From: Thomas Monjalon @ 2014-04-29 11:52 UTC (permalink / raw) To: dev 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 <thomas.monjalon@6wind.com> --- mk/rte.app.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 072718a..fa67a67 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT) endif # default path for libs -LDLIBS += -L$(RTE_SDK_BIN)/lib +LDPATH += -L$(RTE_SDK_BIN)/lib # # Include libraries depending on config if NO_AUTOLIBS is not set @@ -209,10 +209,11 @@ LDLIBS := $(addprefix -Wl$(comma),$(LDLIBS)) LDFLAGS := $(addprefix -Wl$(comma),$(LDFLAGS)) override EXTRA_LDFLAGS := $(addprefix -Wl$(comma),$(EXTRA_LDFLAGS)) O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ - -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDLIBS) + -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) \ + $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDPATH) $(LDLIBS) else O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ - -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS) + -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDPATH) $(LDLIBS) endif O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," LD $(@)") -- 1.9.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] mk: fix build ignoring other installed versions 2014-04-29 11:52 [dpdk-dev] [PATCH] mk: fix build ignoring other installed versions Thomas Monjalon @ 2014-04-30 20:57 ` Thomas Monjalon 2014-05-01 20:50 ` Neil Horman 0 siblings, 1 reply; 4+ messages in thread From: Thomas Monjalon @ 2014-04-30 20:57 UTC (permalink / raw) To: dev 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 <thomas.monjalon@6wind.com> --- changes since v1: - automatically remove -Wl from LDLIBS, LDFLAGS and EXTRA_LDFLAGS for -L - same behavior for rte.app.mk and rte.shared.mk 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 d748189..d5ddbfa 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 072718a..a2c60b6 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 e9be02d..42feee7 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 -- 1.9.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] mk: fix build ignoring other installed versions 2014-04-30 20:57 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon @ 2014-05-01 20:50 ` Neil Horman 2014-05-01 21:10 ` Thomas Monjalon 0 siblings, 1 reply; 4+ messages in thread From: Neil Horman @ 2014-05-01 20:50 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev On Wed, Apr 30, 2014 at 10:57:00PM +0200, Thomas Monjalon wrote: > 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 <thomas.monjalon@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] mk: fix build ignoring other installed versions 2014-05-01 20:50 ` Neil Horman @ 2014-05-01 21:10 ` Thomas Monjalon 0 siblings, 0 replies; 4+ messages in thread From: Thomas Monjalon @ 2014-05-01 21:10 UTC (permalink / raw) To: Neil Horman; +Cc: dev 2014-05-01 16:50, Neil Horman: > On Wed, Apr 30, 2014 at 10:57:00PM +0200, Thomas Monjalon wrote: > > 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 <thomas.monjalon@6wind.com> > > Acked-by: Neil Horman <nhorman@tuxdriver.com> Applied for version 1.6.0r2 -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-01 21:10 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-04-29 11:52 [dpdk-dev] [PATCH] mk: fix build ignoring other installed versions Thomas Monjalon 2014-04-30 20:57 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon 2014-05-01 20:50 ` Neil Horman 2014-05-01 21:10 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).