From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9D4802BA1 for ; Wed, 24 Feb 2016 10:28:35 +0100 (CET) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 24A618553D; Wed, 24 Feb 2016 09:28:35 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org (vpn1-7-116.ams2.redhat.com [10.36.7.116]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1O9SX5Z032030; Wed, 24 Feb 2016 04:28:34 -0500 To: Stefan Puiu , "dev@dpdk.org" References: From: Panu Matilainen Message-ID: <56CD77C1.704@redhat.com> Date: Wed, 24 Feb 2016 11:28:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Subject: Re: [dpdk-dev] including rte.app.mk from a Makefile.am 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, 24 Feb 2016 09:28:35 -0000 On 02/24/2016 04:24 AM, Stefan Puiu wrote: > Hi, > > I'm working on a Linux project that uses the DPDK and (unfornately, > IMO) automake; so we have a Makefile.am where we include rte.extapp.mk > and rte.vars.mk from the DPDK, add LDLIBS to the linker > > However, I've tried building against DPDK 2.2 and I'm getting linker > errors about options like '--no-as-needed', '--whole-archive' etc not > being recognized. Basically, we use libtool to link the binary, which > behind the scenes ends up calling gcc to link the binary, and gcc > doesn't know how to read linker options - they need to be prefixed > with '-Wl,..'. I've traced this to this part of rte.app.mk: > > === DPDK 1.7.1 > ifeq ($(LINK_USING_CC),1) > LDLIBS := $(call linkerprefix,$(LDLIBS)) > LDFLAGS := $(call linkerprefix,$(LDFLAGS)) > > === DPDK 2.2 (since DPDK 1.8, AFAICT) > ifeq ($(LINK_USING_CC),1) > O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ > -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call > linkerprefix,$(LDFLAGS)) \ > $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS)) > > Notice on 1.7.1 LDFLAGS gets the -Wl, prefix if linking with gcc; for > 2.2, that doesn't happen anymore - note O_TO_EXE calls linkerprefix > explicitly for LDLIBS and LDFLAGS. > > The change that removed the LDLIBS/LDFLAGS setting is 3c6a14f6, which > ironically says "mk: fix link with CC" in the title. > > I've tried working around this, but apparently automake doesn't give > you too much control of what you can do; overriding LDFLAGS with > $(call linkerprefix,$(LDFLAGS) in Makefile.am doesn't work. Since > LDFLAGS is treated as a user variable by automake, it's tricky to > override it. > > Now my question is: is this supposed to work? Is there any point in > trying to use the mk files from my outside project? I would say no, especially when the rest of your buildsystem is around automake (or cmake or...). Pktgen relies on the dpdk make infrastructure but even that gets into all sorts of trouble with it. > I noticed dpdk-ovs > doesn't seem to bother with that, and just builds one library to link > against. I guess it's useful to pick up the defines that the DPDK was > built against, so inline functions in headers are properly picked up. > Are there people using the DPDK from projects using automake? > > IMO, It would be nice if you could extract the CPPFLAGS/LDFLAGS etc > from the DPDK without including the mk files - maybe by running > something like 'make showvars' or something like that in the DPDK dir. > Then external projects could integrate those in their build system > without too much extra baggage. It would be nice yes, but instead of some custom make-thing, I'd prefer a pkg-config file for the purpose. Adding a pkg-config file has been suggested in the past a few times but nobody has stepped up to do it. - Panu - > Thanks, > Stefan. >