Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2515847pxb; Mon, 18 Jan 2021 21:54:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHQGsCk6kV/oIbGsfKhpA055DbR3RbgbAkf85V07U9foJF0xwzmvcfVfaG2OW0H/W6KiZ9 X-Received: by 2002:a17:906:97c5:: with SMTP id ef5mr1949737ejb.347.1611035662047; Mon, 18 Jan 2021 21:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611035662; cv=none; d=google.com; s=arc-20160816; b=vbQFSjC8zhw/bPjaE5zHNZYbu69Sg3OoMR2YiSSfum1KhGGw/9A0lT65uGPd4AI+Nf E4BLS+d1qXrlNLdZhIOdREDOkcR0V3j+sRzUPA7OyuGiYXxru55KN5K3+lTSVubH1ioD 9OwJtsvE9Blw8A1oWJqlmqqewJg81/KLG5hctLe++cJv0pBgxFT3DjvWn+AFNmNXA6Oc C1mvwkEqESgRjcHlOEyY/JU6tFg2IuTIFY8lILhhgkmI/JQQRBy4CZ9nBxl1M9hdbhmo 6UhOmAs7itpRrPEYqg7lYS2a3PU4iDOU7XWUh2G0Y+dWTQve1Ds2SbkIlx044kqEK0Cn Po5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=G1/w5bKMHx0YAmAEbmJbWZujoFp7iQPCTlT9xqhe3ts=; b=Yt64wIEPyekPpMxibf1eFSpXuINNrKdAKA8PLjey4u1JL8s0+F+KP9oYa1hyMYmMlv LDzmZO8G0rqXomvvIQ1xSEzT8xsR3gPmFUEHCJu3oIVvmyiZui+Jq4XdEb/TJa5SNJVg CAPNC4oclGkC8Q930Xrj/6sSUNn2lNUh5WPeEpH07eFwgf8u6xay/qhVESFfTjnKp2KI PTIYSzv4N0I4odcO75USLQthMd/MjvYUzyt9yamALaR8Ccab6WmFitaACoIHgnWDWqGm CnZsQpHAZFYEQUY7pd1WVJbrN1MqdL9lpqJr1GZPfQPQPjveTATuzi9r3rkW+FWhhqU4 ICmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si8040941edt.579.2021.01.18.21.53.55; Mon, 18 Jan 2021 21:54:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729354AbhASDy0 (ORCPT + 99 others); Mon, 18 Jan 2021 22:54:26 -0500 Received: from mail.loongson.cn ([114.242.206.163]:49828 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728722AbhASDyM (ORCPT ); Mon, 18 Jan 2021 22:54:12 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxZb2qVwZg1CwHAA--.8737S2; Tue, 19 Jan 2021 11:53:14 +0800 (CST) From: Tiezhu Yang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Nathan Chancellor , Nick Desaulniers Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, Xuefeng Li Subject: [PATCH bpf] samples/bpf: Update README.rst and Makefile for manually compiling LLVM and clang Date: Tue, 19 Jan 2021 11:53:05 +0800 Message-Id: <1611028385-32702-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID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I43ZEXa7VUj5l1PUUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the current samples/bpf/README.rst, the url of llvm and clang git may be out of date, they are unable to access: $ git clone http://llvm.org/git/llvm.git Cloning into 'llvm'... fatal: unable to access 'http://llvm.org/git/llvm.git/': Maximum (20) redirects followed $ git clone --depth 1 http://llvm.org/git/clang.git Cloning into 'clang'... fatal: unable to access 'http://llvm.org/git/clang.git/': Maximum (20) redirects followed There are different ways to build llvm/clang, I find the Clang Getting Started page [1] has one way, as Yonghong said, it is better to just copy the build procedure in Documentation/bpf/bpf_devel_QA.rst to keep consistent. I verified the procedure and it is proved to be feasible, so we should update README.rst to reflect the reality. At the same time, update the related comment in Makefile. [1] https://clang.llvm.org/get_started.html Signed-off-by: Tiezhu Yang --- samples/bpf/Makefile | 2 +- samples/bpf/README.rst | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 26fc96c..d061446 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -208,7 +208,7 @@ TPROGLDLIBS_xdpsock += -pthread -lcap TPROGLDLIBS_xsk_fwd += -pthread # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: -# make M=samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang +# make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang LLC ?= llc CLANG ?= clang OPT ?= opt diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index dd34b2d..d1be438 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -65,17 +65,20 @@ To generate a smaller llc binary one can use:: Quick sniplet for manually compiling LLVM and clang (build dependencies are cmake and gcc-c++):: - $ git clone http://llvm.org/git/llvm.git - $ cd llvm/tools - $ git clone --depth 1 http://llvm.org/git/clang.git - $ cd ..; mkdir build; cd build - $ cmake .. -DLLVM_TARGETS_TO_BUILD="BPF;X86" - $ make -j $(getconf _NPROCESSORS_ONLN) + $ git clone https://github.com/llvm/llvm-project.git + $ mkdir -p llvm-project/llvm/build/install + $ cd llvm-project/llvm/build + $ cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \ + -DLLVM_ENABLE_PROJECTS="clang" \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_RUNTIME=OFF + $ ninja It is also possible to point make to the newly compiled 'llc' or 'clang' command via redefining LLC or CLANG on the make command line:: - make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang Cross compiling samples ----------------------- -- 2.1.0