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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9B2EC10DCE for ; Thu, 12 Mar 2020 12:54:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE702206E7 for ; Thu, 12 Mar 2020 12:54:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbgCLMyF (ORCPT ); Thu, 12 Mar 2020 08:54:05 -0400 Received: from sym2.noone.org ([178.63.92.236]:40598 "EHLO sym2.noone.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgCLMyF (ORCPT ); Thu, 12 Mar 2020 08:54:05 -0400 Received: by sym2.noone.org (Postfix, from userid 1002) id 48dTKk0SHJzvjdW; Thu, 12 Mar 2020 13:54:01 +0100 (CET) Date: Thu, 12 Mar 2020 13:54:01 +0100 From: Tobias Klauser To: Quentin Monnet Cc: Daniel Borkmann , Alexei Starovoitov , Song Liu , Yonghong Song , bpf@vger.kernel.org, Alexei Starovoitov Subject: Re: [PATCH] bpftool: use linux/types.h from source tree for profiler build Message-ID: <20200312125401.aumdto3gkq73trgf@distanz.ch> References: <20200312105335.10465-1-tklauser@distanz.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 2020-03-12 at 13:48:21 +0100, Quentin Monnet wrote: > 2020-03-12 11:53 UTC+0100 ~ Tobias Klauser > > When compiling bpftool on a system where the /usr/include/asm symlink > > doesn't exist (e.g. on an Ubuntu system without gcc-multilib installed), > > the build fails with: > > > > CLANG skeleton/profiler.bpf.o > > In file included from skeleton/profiler.bpf.c:4: > > In file included from /usr/include/linux/bpf.h:11: > > /usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found > > #include > > ^~~~~~~~~~~~~ > > 1 error generated. > > make: *** [Makefile:123: skeleton/profiler.bpf.o] Error 1 > > > > This indicates that the build is using linux/types.h from system headers > > instead of source tree headers. > > > > To fix this, adjust the clang search path to include the necessary > > headers from tools/testing/selftests/bpf/include/uapi and > > tools/include/uapi. Also undef __bitwise in skeleton/profiler.h avoid > > clashing with the empty definition in > > tools/testing/selftests/bpf/include/uapi/linux/types.h. > > > > Cc: Daniel Borkmann > > Cc: Song Liu > > Cc: Alexei Starovoitov > > Signed-off-by: Tobias Klauser > > > diff --git a/tools/bpf/bpftool/skeleton/profiler.h b/tools/bpf/bpftool/skeleton/profiler.h > > index e03b53eae767..95358c0df5ef 100644 > > --- a/tools/bpf/bpftool/skeleton/profiler.h > > +++ b/tools/bpf/bpftool/skeleton/profiler.h > > @@ -27,6 +27,7 @@ enum { > > true = 1, > > }; > > > > +#undef __bitwise > > #ifdef __CHECKER__ > > #define __bitwise__ __attribute__((bitwise)) > > #else > > > > Even with the #undef above, I get warnings on __bitwise being redefined > in tools/testing/selftests/bpf/include/uapi/linux/types.h. Can we maybe > just find another name (or number of underscores) for the macro in > skeleton/profiler.h? Good point. It seems I actually didn't test this properly. Will change the typedefs to use the existing __bitwise__. > Makefile change works well otherwise, thanks (tested on Ubuntu with and > without gcc-multilib). Thanks for testing. - Tobias