Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4140155ybl; Sat, 21 Dec 2019 00:27:43 -0800 (PST) X-Google-Smtp-Source: APXvYqzgEyGab+UyX+gGQ7Lap23Q+qq4WMjafumWj4s2BRNAXuZIpwrTfzUOdc/kRmA1SmSp/Qqu X-Received: by 2002:a05:6830:3001:: with SMTP id a1mr10178461otn.254.1576916863884; Sat, 21 Dec 2019 00:27:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576916863; cv=none; d=google.com; s=arc-20160816; b=BIAzmhBGNT6c+myye+B0YtQrb/N0Fhi2AE6Nh9+nS1N+S2cnQ32+AGF7ephBxvpSDL W07O/nRdTqxIIP0xPOSuZjb2eGgOVRNF8VaD/YGPw0jkOQvCnLlBPkMCLuEwRnJiEXSq N7vo1ERrYls6yPvMvAO4CBIsMOWlNGBfM2naBfnh7rCJBgEzLzI6EAnnMyua5ipYaM1W 6FwOFOwIGv2iVcRgtB8QxNcx9Uh3bzJHYXm17X5S5dsldNWt0L8c46PivSG7ZsOOtj+Q B+f6ET49s+Ep/w6QblSTUtN2/veVaCtbQ/dQu/nrBViwkOFoClFqjkf0ZrpP+xTC61L3 wn2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ebebit982XGYe1EwFDTKTd7VGALTM5sbxVsHsfjIDWQ=; b=Th2DC7pJ5yluFPH9I9xEXwmaEVN7PG6bYeQe3SKr6gsXt0pzP4+SN94fPrv2DFPYag rDJbLUDJTcerwgWQHWVBCHCl58QeiWN1aL+b418iKEmqRGrsEgPuFUeO2zMazZxRja2l hHSgXaDUfekjlg/4fZmtG2FvzB6xUJEXRE+tgkvDIWjoW8FtgtYGA1eXvSufnnaf5tgh cJqh8tKfyD2yFmSUFDdALX2XzkBRN2wfdabskL7SMCoJ3xEAUBYHMzZxNMogHN+KFjcL 6NamGtAakSj9cbCCQdGe07fk/N43sYSLRp5Tnhu5iC/frxBbSego6n6rk+nRsnvIoyfU ragQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si6487005oth.267.2019.12.21.00.27.33; Sat, 21 Dec 2019 00:27:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbfLUI0F (ORCPT + 99 others); Sat, 21 Dec 2019 03:26:05 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46184 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbfLUI0E (ORCPT ); Sat, 21 Dec 2019 03:26:04 -0500 Received: by mail-wr1-f67.google.com with SMTP id z7so11521914wrl.13; Sat, 21 Dec 2019 00:26:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ebebit982XGYe1EwFDTKTd7VGALTM5sbxVsHsfjIDWQ=; b=gxmSEryIwfcMS8axId+olPN2w2nQcn0PRimbn9oFyeFs2bKrs+Zo/0BddqjPV/4lDw /7xrlppAavltFCSovWs5HtlhAH/StSo8htTkzbCB/eJJgorM4A93+Id3wuuU56cd0LJM JVIpORvoEEXp4ixYiJh8sluPNe4QRtLpjB4yS1zpWt5IlwYVDY0LPfOvKIrklIJ/WBid V6fYzCiw0LAKRgb9OkMVnqYNj0DVVQRVLYQkknAM0wtLccxwjtRu4t7HLgMQzLovbOyf g8fyWvUlbFNoGGJUGqyyjXcmxMoXfW69Lm99N7MWCuGbQ+W+/cObgUb+TrnalnGi/7wF mB+A== X-Gm-Message-State: APjAAAUxNLxHsE68wIz0UFJo8ZfzlzNeSks0/TXJ83vnDvZA2riHtvSs OlDOJFqTIVoBv9IAiICRHa4kzLab8cP8/muVP68= X-Received: by 2002:adf:ef10:: with SMTP id e16mr18632785wro.336.1576916762285; Sat, 21 Dec 2019 00:26:02 -0800 (PST) MIME-Version: 1.0 References: <20191220032558.3259098-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Sat, 21 Dec 2019 17:25:51 +0900 Message-ID: Subject: Re: [PATCH] libbpf: Fix build on read-only filesystems To: Andrii Nakryiko Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , bpf , Arnaldo Carvalho de Melo , Jiri Olsa , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Dec 21, 2019 at 5:29 AM Andrii Nakryiko wrote: > > On Thu, Dec 19, 2019 at 7:26 PM Namhyung Kim wrote: > > > > I got the following error when I tried to build perf on a read-only > > filesystem with O=dir option. > > > > $ cd /some/where/ro/linux/tools/perf > > $ make O=$HOME/build/perf > > ... > > CC /home/namhyung/build/perf/lib.o > > /bin/sh: bpf_helper_defs.h: Read-only file system > > make[3]: *** [Makefile:184: bpf_helper_defs.h] Error 1 > > make[2]: *** [Makefile.perf:778: /home/namhyung/build/perf/libbpf.a] Error 2 > > make[2]: *** Waiting for unfinished jobs.... > > LD /home/namhyung/build/perf/libperf-in.o > > AR /home/namhyung/build/perf/libperf.a > > PERF_VERSION = 5.4.0 > > make[1]: *** [Makefile.perf:225: sub-make] Error 2 > > make: *** [Makefile:70: all] Error 2 > > > > It was becaused bpf_helper_defs.h was generated in current directory. > > Move it to OUTPUT directory. > > > > Signed-off-by: Namhyung Kim > > --- > > Overall nothing is obviously broken, except you need to fix up > selftests/bpf's Makefile as well. Thanks for pointing this out. It's because bpf selftest also needs the bpf_helper_defs.h right? But I'm currently having a problem with LLVM when building the selftests. Can you help me testing the patch below? (It should be applied after this patch. Are you ok with it?) > > BTW, this patch doesn't apply cleanly to latest bpf-next, so please rebase. > > Also subject prefix should look like [PATCH bpf-next] if it's meant to > be applied against bpf-next. Will do. Thanks Namhyung -----------8<------------- diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 866fc1cadd7c..897877f7849b 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -151,9 +151,9 @@ $(DEFAULT_BPFTOOL): force $(BPFOBJ): force $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ -BPF_HELPERS := $(BPFDIR)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h) -$(BPFDIR)/bpf_helper_defs.h: - $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ bpf_helper_defs.h +BPF_HELPERS := $(OUTPUT)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.h) +$(OUTPUT)/bpf_helper_defs.h: + $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ $(OUTPUT)/bpf_helper_defs.h # Get Clang's default includes on this system, as opposed to those seen by # '-target bpf'. This fixes "missing" files on some architectures/distros,