From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id E26E6590B for ; Wed, 30 Apr 2014 22:57:05 +0200 (CEST) Received: by mail-wg0-f43.google.com with SMTP id l18so2294053wgh.14 for ; Wed, 30 Apr 2014 13:57:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=AmOSvUogwKredT0ORgt399yKRUVNp4oJ4HLpvbBQPFc=; b=YkWVhjQVzqP2omsnfPtvscWDJYw9vJ7oUjZ7Sd9oMu4hj9QOZyq2yCy28V4AW/ScCy XvnQV0kzTQCYJRpfqhQdq6U4FqjvIJ9wTQL3ruj97PwebnUL+7wizASYc3oDwKTGcfhJ N7zg4hAlkRfAmxjFxFlRx7ESonq0cZX3jSww7I+LDAZv9Ed0GS6mJG5PW6Bql3ozWK/9 /HQGVymMA5FerTyG61rwD5JUSG93i0niVKdRSWfVMe3KlGRU+XVpk8zv5zIdkAYNETq8 nzie7DSNVnsupIinUoRp6gwpqz4pQ/a465KZrhkZy9htlCItRXeL3UIrV6jxzdZCtKN7 aRnA== X-Gm-Message-State: ALoCoQkZ6Ho5b5s8sc03iqlydy2ncXCEgcg+szUcWBAowvoING+DQR0BUzSVe+EUl8gC22eRX2KC X-Received: by 10.194.92.81 with SMTP id ck17mr5916598wjb.14.1398891429606; Wed, 30 Apr 2014 13:57:09 -0700 (PDT) Received: from localhost.localdomain (abo-213-55-68.mts.modulonet.fr. [85.68.55.213]) by mx.google.com with ESMTPSA id gp15sm37883156wjc.10.2014.04.30.13.57.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Apr 2014 13:57:08 -0700 (PDT) From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 30 Apr 2014 22:57:00 +0200 Message-Id: <1398891420-8839-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1398772323-31255-1-git-send-email-thomas.monjalon@6wind.com> References: <1398772323-31255-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH v2] mk: fix build ignoring other installed versions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2014 20:57:06 -0000 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 --- 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