From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17B68C433F5 for ; Mon, 4 Apr 2022 11:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359267AbiDDLMH (ORCPT ); Mon, 4 Apr 2022 07:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243187AbiDDLME (ORCPT ); Mon, 4 Apr 2022 07:12:04 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569DC3AA50; Mon, 4 Apr 2022 04:10:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: usama.anjum) with ESMTPSA id 231F71F44F1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649070605; bh=uJM/eBYziCRkGOrHOqJSiL8T5PL06TZOxD1+cp1k4lI=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=WcxVAn7bem/ad7tCGkNyhTYZGuTiG9TbACZ2HKZn3kk0abKkB6mCKQ86B5fNfagf8 2cogEYTERRbxiCrtblpFqezTh9SfWlVYOj2qhYrEpyvvRPuSQEI6MV/AnUNc8Zv2ER l2BywD1pTw1bzWtfKqPRbvgRGO2cL4ctwqk8QjbmBnMD5xp8/YneID54IGN4bWto2R oI1hwKhzaCBut0lQ6kP08E+JitpPC1bi8S9xnWNAUl4NjcIHQdGmT1OHyEzjDLeIAB BOzJFo317z0D7tOS7JnJOwgQAt5mAzGU8Cw2NHny8n+YXErlUq8/j7KgEdQwfJ2EcH 71dHdcJuu36Mg== Message-ID: Date: Mon, 4 Apr 2022 16:09:57 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: usama.anjum@collabora.com, Michal Marek , Nick Desaulniers , kernel@collabora.com, kernelci@groups.io, "open list:KERNEL SELFTEST FRAMEWORK" , Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List Subject: Re: [PATCH] Makefile: Fix separate output directory build of kselftests Content-Language: en-US To: Masahiro Yamada , Shuah Khan References: <20220223191016.1658728-1-usama.anjum@collabora.com> <63c5d7ad-b0b2-9b37-16c3-354ac10858b6@collabora.com> From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >From [Makefile](https://elixir.bootlin.com/linux/latest/source/Makefile): ``` ifeq ($(abs_srctree),$(abs_objtree)) # building in the source tree srctree := . building_out_of_srctree := else ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) # building in a subdirectory of the source tree srctree := .. else srctree := $(abs_srctree) endif building_out_of_srctree := 1 endif ``` `ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` condition is setting `srctree` to `..`. This is wrong. This condition isn't considering that `header_install` doesn't depend on `abs_srctree and abs_objtree`. This condition needs to be tweaked or removed for the `install_headers` to work fine and fix this issue. I've added `KBUILD_ABS_SRCTREE=1` to the kselftest target which sets the `srctree` to `abs_srctree` and thus forcefully affecting only kselftest targets. This seems like the clean fix. Alternatively we should remove this condition `ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))` but it'll affect other targets as well. Complete details of investigation can be found here: https://github.com/kernelci/kernelci-project/issues/92#issuecomment-1087406222 On 3/17/22 11:08 PM, Masahiro Yamada wrote: > On Thu, Mar 17, 2022 at 7:49 PM Muhammad Usama Anjum > wrote: >> >> Reminder. Shuah is okay with this patch. Any thoughts? > > I do not think this is the right fix, > but something you just happen to find working. > > > The Make is working in a wrong directory, that is why > the relative path does not work > (and you use the absolute path to work around it) > `ifeq ($(abs_srctree)/,$(dir $(abs_objtree))) \ srctree := ..` has broken the `make headers_install` when called through selftests/Makefile. We can remove it or use the absolute path each time. -- Muhammad Usama Anjum