From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbdF1Iep (ORCPT ); Wed, 28 Jun 2017 04:34:45 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:37664 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbdF1Ieb (ORCPT ); Wed, 28 Jun 2017 04:34:31 -0400 MIME-Version: 1.0 In-Reply-To: <1498214246-1244-3-git-send-email-marcin.nowakowski@imgtec.com> References: <1498214246-1244-1-git-send-email-marcin.nowakowski@imgtec.com> <1498214246-1244-3-git-send-email-marcin.nowakowski@imgtec.com> From: Fathi Boudra Date: Wed, 28 Jun 2017 11:34:29 +0300 Message-ID: Subject: Re: [PATCH 2/3] selftests/gpio: fix build error To: Marcin Nowakowski Cc: Shuah Khan , linux-kselftest@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23 June 2017 at 13:37, Marcin Nowakowski wrote: > 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 FWIW, I've tested the patch and it fixes the issue mentioned. Tested-by: Fathi Boudra > --- > 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 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html