mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
To: Shuah Khan <shuah@kernel.org>
Cc: <linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Subject: [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries
Date: Fri, 23 Jun 2017 12:37:24 +0200	[thread overview]
Message-ID: <1498214246-1244-2-git-send-email-marcin.nowakowski@imgtec.com> (raw)
In-Reply-To: <1498214246-1244-1-git-send-email-marcin.nowakowski@imgtec.com>

net test fails to link properly due to a missing reference to -lnuma and
fails with:
reuseport_bpf_numa.c:138: undefined reference to `numa_run_on_node'
reuseport_bpf_numa.c:230: undefined reference to `numa_available'
reuseport_bpf_numa.c:233: undefined reference to `numa_max_node'
collect2: error: ld returned 1 exit status

running make -p shows that this is due to a wrong LDFLAGS variable
definition which doesn't include the output prefix location:

 # makefile (from 'Makefile', line 6)
reuseport_bpf_numa: LDFLAGS += -lnuma
 # Not a target:
reuseport_bpf_numa:

The same issue has been observed in memfd with its references to
libfuse.

Resolve this by adding a pattern-matching to allow the binary name to be
prefixed with an output location.

For memfd also replace LDFLAGS with LDLIBS definition to ensure correct
ordering of arguments in the make's implicit rules.

Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 tools/testing/selftests/memfd/Makefile | 4 ++--
 tools/testing/selftests/net/Makefile   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 79891d0..754e92f 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,8 +6,8 @@ CFLAGS += -I../../../../usr/include/
 TEST_PROGS := run_fuse_test.sh
 TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
 
-fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
-fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
+%/fuse_mnt: CFLAGS += $(shell pkg-config fuse --cflags)
+%/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 35cbb4c..d7abe8b 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -3,7 +3,7 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-reuseport_bpf_numa: LDFLAGS += -lnuma
+%/reuseport_bpf_numa: LDFLAGS += -lnuma
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
 TEST_GEN_FILES =  socket
-- 
2.7.4

  reply	other threads:[~2017-06-23 10:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 10:37 [PATCH 0/3] kselftest build errors Marcin Nowakowski
2017-06-23 10:37 ` Marcin Nowakowski [this message]
2017-06-23 10:37 ` [PATCH 2/3] selftests/gpio: fix build error Marcin Nowakowski
2017-06-28  8:34   ` Fathi Boudra
2017-06-23 10:37 ` [PATCH 3/3] selftests/intel_pstate: fix undefined reference when building Marcin Nowakowski
2017-06-23 19:44 ` [PATCH 0/3] kselftest build errors Shuah Khan
2017-06-28  8:30   ` Fathi Boudra
2017-06-28 14:21     ` Shuah Khan
2017-06-29  8:37       ` Fathi Boudra
2017-07-12  9:30         ` Naresh Kamboju
2017-07-24 18:28           ` Shuah Khan

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=1498214246-1244-2-git-send-email-marcin.nowakowski@imgtec.com \
    --to=marcin.nowakowski@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.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

all inboxes | Powered by JetHome®