From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752806AbcANLRs (ORCPT ); Thu, 14 Jan 2016 06:17:48 -0500 Received: from foss.arm.com ([217.140.101.70]:45386 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcANLRq (ORCPT ); Thu, 14 Jan 2016 06:17:46 -0500 Subject: Re: [RFC PATCH] selftests: use INSTALL_HDR_PATH instead of relative paths To: Michael Ellerman , Shuah Khan , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org References: <1452522172-16650-1-git-send-email-sudeep.holla@arm.com> <1452742640.25808.1.camel@ellerman.id.au> Cc: Sudeep Holla From: Sudeep Holla Organization: ARM Message-ID: <569783D7.5000303@arm.com> Date: Thu, 14 Jan 2016 11:17:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1452742640.25808.1.camel@ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/01/16 03:37, Michael Ellerman wrote: > On Mon, 2016-01-11 at 14:22 +0000, Sudeep Holla wrote: > >> The selftests build fails or picks up wrong headers when cross-compiling >> and build directory is different from source as the headers are referred >> using the relative paths. >> >> This patch use $INSTALL_HDR_PATH to fix the compilation. It also removes >> installing the headers. >> >> Cc: Shuah Khan >> Signed-off-by: Sudeep Holla >> --- >> tools/testing/selftests/membarrier/Makefile | 2 +- >> tools/testing/selftests/memfd/Makefile | 2 +- >> tools/testing/selftests/net/Makefile | 2 +- >> tools/testing/selftests/vm/Makefile | 7 ++----- >> 4 files changed, 5 insertions(+), 8 deletions(-) >> >> Hi, >> >> When I was cross-compiling these tests for arm{32,64}, I faced issues. >> With limited knowledge I have on this build system, I came up with this >> patch. Please treat this as bug report if this approach makes no-sense >> and suggest on how to fix it. > > Yeah sorry that doesn't work. > > If $(INSTALL_HDR_PATH) isn't defined you end up with: > > gcc -Wall -I /include -o compaction_test compaction_test.c -lrt > ^ > Ah OK, I got carried away by below in the main Makefile. #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr > Which is wrong. > > INSTALL_HDR_PATH will not be defined when the tests are built standalone, ie. > like: > > $ make -C tools/testing/selftests > Thanks for pointing this out. I had totally forgotten about that. > > This has been on my todo list to fix, but it doesn't actually bother me so I > haven't got around to it. > > Does the patch below work for you? It uses INSTALL_HDR_PATH if it is defined, > or otherwise KERNEL_HEADERS if it is defined, or finally it guesses at > ../../../usr/include (ie. the base of the source tree). > Yes it does work fine. So feel free to add my tested-by when you post the patch. Thanks for the quick and clean fix. -- Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sudeep Holla Subject: Re: [RFC PATCH] selftests: use INSTALL_HDR_PATH instead of relative paths Date: Thu, 14 Jan 2016 11:17:43 +0000 Message-ID: <569783D7.5000303@arm.com> References: <1452522172-16650-1-git-send-email-sudeep.holla@arm.com> <1452742640.25808.1.camel@ellerman.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1452742640.25808.1.camel-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Michael Ellerman , Shuah Khan , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Sudeep Holla List-Id: linux-api@vger.kernel.org On 14/01/16 03:37, Michael Ellerman wrote: > On Mon, 2016-01-11 at 14:22 +0000, Sudeep Holla wrote: > >> The selftests build fails or picks up wrong headers when cross-compiling >> and build directory is different from source as the headers are referred >> using the relative paths. >> >> This patch use $INSTALL_HDR_PATH to fix the compilation. It also removes >> installing the headers. >> >> Cc: Shuah Khan >> Signed-off-by: Sudeep Holla >> --- >> tools/testing/selftests/membarrier/Makefile | 2 +- >> tools/testing/selftests/memfd/Makefile | 2 +- >> tools/testing/selftests/net/Makefile | 2 +- >> tools/testing/selftests/vm/Makefile | 7 ++----- >> 4 files changed, 5 insertions(+), 8 deletions(-) >> >> Hi, >> >> When I was cross-compiling these tests for arm{32,64}, I faced issues. >> With limited knowledge I have on this build system, I came up with this >> patch. Please treat this as bug report if this approach makes no-sense >> and suggest on how to fix it. > > Yeah sorry that doesn't work. > > If $(INSTALL_HDR_PATH) isn't defined you end up with: > > gcc -Wall -I /include -o compaction_test compaction_test.c -lrt > ^ > Ah OK, I got carried away by below in the main Makefile. #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr > Which is wrong. > > INSTALL_HDR_PATH will not be defined when the tests are built standalone, ie. > like: > > $ make -C tools/testing/selftests > Thanks for pointing this out. I had totally forgotten about that. > > This has been on my todo list to fix, but it doesn't actually bother me so I > haven't got around to it. > > Does the patch below work for you? It uses INSTALL_HDR_PATH if it is defined, > or otherwise KERNEL_HEADERS if it is defined, or finally it guesses at > ../../../usr/include (ie. the base of the source tree). > Yes it does work fine. So feel free to add my tested-by when you post the patch. Thanks for the quick and clean fix. -- Regards, Sudeep