DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stefan Puiu <stefan.puiu@gmail.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] including rte.app.mk from a Makefile.am
Date: Tue, 23 Feb 2016 20:24:48 -0600	[thread overview]
Message-ID: <CACKs7VC+uycnvyx7+vRhW+g60ML+8zxjQugSnudgteVYDWWPKg@mail.gmail.com> (raw)

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 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.

Thanks,
Stefan.

             reply	other threads:[~2016-02-24  2:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24  2:24 Stefan Puiu [this message]
2016-02-24  9:26 ` Thomas Monjalon
2016-02-24 16:43   ` Stefan Puiu
2016-02-24  9:28 ` Panu Matilainen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACKs7VC+uycnvyx7+vRhW+g60ML+8zxjQugSnudgteVYDWWPKg@mail.gmail.com \
    --to=stefan.puiu@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).