| From 1623dc13ad8025f95bca1d671c3aaa32c2c5f655 Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org> |
| Date: Wed, 12 Aug 2020 17:15:17 -0500 |
| Subject: [PATCH] tools build feature: Quote CC and CXX for their arguments |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| commit fa5c893181ed2ca2f96552f50073786d2cfce6c0 upstream. |
| |
| When using a cross-compilation environment, such as OpenEmbedded, |
| the CC an CXX variables are set to something more than just a |
| command: there are arguments (such as --sysroot) that need to be |
| passed on to the compiler so that the right set of headers and |
| libraries are used. |
| |
| For the particular case that our systems detected, CC is set to |
| the following: |
| |
| export CC="aarch64-linaro-linux-gcc --sysroot=/oe/build/tmp/work/machine/perf/1.0-r9/recipe-sysroot" |
| |
| Without quotes, detection is as follows: |
| |
| Auto-detecting system features: |
| ... dwarf: [ OFF ] |
| ... dwarf_getlocations: [ OFF ] |
| ... glibc: [ OFF ] |
| ... gtk2: [ OFF ] |
| ... libbfd: [ OFF ] |
| ... libcap: [ OFF ] |
| ... libelf: [ OFF ] |
| ... libnuma: [ OFF ] |
| ... numa_num_possible_cpus: [ OFF ] |
| ... libperl: [ OFF ] |
| ... libpython: [ OFF ] |
| ... libcrypto: [ OFF ] |
| ... libunwind: [ OFF ] |
| ... libdw-dwarf-unwind: [ OFF ] |
| ... zlib: [ OFF ] |
| ... lzma: [ OFF ] |
| ... get_cpuid: [ OFF ] |
| ... bpf: [ OFF ] |
| ... libaio: [ OFF ] |
| ... libzstd: [ OFF ] |
| ... disassembler-four-args: [ OFF ] |
| |
| Makefile.config:414: *** No gnu/libc-version.h found, please install glibc-dev[el]. Stop. |
| Makefile.perf:230: recipe for target 'sub-make' failed |
| make[1]: *** [sub-make] Error 2 |
| Makefile:69: recipe for target 'all' failed |
| make: *** [all] Error 2 |
| |
| With CC and CXX quoted, some of those features are now detected. |
| |
| Fixes: e3232c2f39ac ("tools build feature: Use CC and CXX from parent") |
| Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> |
| Reviewed-by: Thomas Hebb <tommyhebb@gmail.com> |
| Cc: Alexei Starovoitov <ast@kernel.org> |
| Cc: Andrii Nakryiko <andriin@fb.com> |
| Cc: Daniel Borkmann <daniel@iogearbox.net> |
| Cc: Jiri Olsa <jolsa@kernel.org> |
| Cc: John Fastabend <john.fastabend@gmail.com> |
| Cc: KP Singh <kpsingh@chromium.org> |
| Cc: Martin KaFai Lau <kafai@fb.com> |
| Cc: Namhyung Kim <namhyung@kernel.org> |
| Cc: Song Liu <songliubraving@fb.com> |
| Cc: Stephane Eranian <eranian@google.com> |
| Cc: Yonghong Song <yhs@fb.com> |
| Link: http://lore.kernel.org/lkml/20200812221518.2869003-1-daniel.diaz@linaro.org |
| Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature |
| index 2c900252ab65..5cc7a3131e20 100644 |
| --- a/tools/build/Makefile.feature |
| +++ b/tools/build/Makefile.feature |
| @@ -8,7 +8,7 @@ endif |
| |
| feature_check = $(eval $(feature_check_code)) |
| define feature_check_code |
| - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC=$(CC) CXX=$(CXX) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0) |
| + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC="$(CC)" CXX="$(CXX)" CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0) |
| endef |
| |
| feature_set = $(eval $(feature_set_code)) |
| -- |
| 2.27.0 |
| |