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 2/3] selftests/gpio: fix build error
Date: Fri, 23 Jun 2017 12:37:25 +0200	[thread overview]
Message-ID: <1498214246-1244-3-git-send-email-marcin.nowakowski@imgtec.com> (raw)
In-Reply-To: <1498214246-1244-1-git-send-email-marcin.nowakowski@imgtec.com>

While building selftests/gpio, gpio-utils from linux/tools/gpio as built
in the process as well. However, the OUTPUT make variable usage in
selftests breaks the build system in linux/tools/gpio resulting in its
output files placed in the selftests folder (due to lack of trailing
slash in the path, the files are placed directly in selftests):

make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
CC    linux/tools/testing/selftests/gpiolsgpio.o
CC    linux/tools/testing/selftests/gpiogpio-utils.o
LD    linux/tools/testing/selftests/gpiolsgpio-in.o

This pollutes the selftests directory and, most importantly, makes it
impossible for selftests/gpio to find the object file it's looking for
to link the test:

cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
gpio-mockup-chardev
gcc: error: ../../../gpio/gpio-utils.o: No such file or directory

Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
make to ensure it's built where expected.

Note, that this solution is not ideal as the output is placed in
linux/tools/gpio rather than a location relative to OUTPUT, but this at
least ensures the build succeeds.
Due to differences and complexities of selftests and linux/tools build
systems, it's not trivial to ensure linux/tools get built properly when
invoked recursively from selftests build and this is left as a future
task to resolve properly.

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

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 tools/testing/selftests/gpio/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 298929d..950956e 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -23,7 +23,7 @@ LDLIBS += -lmount -I/usr/include/libmount
 $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
 
 ../../../gpio/gpio-utils.o:
-	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio OUTPUT=
 
 ../../../../usr/include/linux/gpio.h:
 	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-- 
2.7.4

  parent 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 ` [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries Marcin Nowakowski
2017-06-23 10:37 ` Marcin Nowakowski [this message]
2017-06-28  8:34   ` [PATCH 2/3] selftests/gpio: fix build error 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-3-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®