LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] tools build feature: Quote CC and CXX for their arguments
@ 2020-08-12 22:15 Daniel Díaz
  2020-08-13  2:31 ` Tom Hebb
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Díaz @ 2020-08-12 22:15 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Arnaldo Carvalho de Melo, Jiri Olsa, Thomas Hebb,
	Daniel Díaz, Stephane Eranian, Namhyung Kim, open list,
	open list:BPF (Safe dynamic programs and tools),
	open list:BPF (Safe dynamic programs and tools)

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>
---
 tools/build/Makefile.feature | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 774f0b0ca28a..e7818b44b48e 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.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools build feature: Quote CC and CXX for their arguments
  2020-08-12 22:15 [PATCH] tools build feature: Quote CC and CXX for their arguments Daniel Díaz
@ 2020-08-13  2:31 ` Tom Hebb
  2020-08-13 13:01   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Hebb @ 2020-08-13  2:31 UTC (permalink / raw)
  To: Daniel Díaz
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Arnaldo Carvalho de Melo, Jiri Olsa, Stephane Eranian,
	Namhyung Kim, open list,
	open list:BPF (Safe dynamic programs and tools),
	open list:BPF (Safe dynamic programs and tools)

On Wed, Aug 12, 2020 at 3:15 PM Daniel Díaz <daniel.diaz@linaro.org> wrote:
>
> 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>

Whoops, I'm the one who introduced this issue. Fix looks good, thanks!

Reviewed-by: Thomas Hebb <tommyhebb@gmail.com>
Fixes: e3232c2f39ac ("tools build feature: Use CC and CXX from parent")

> ---
>  tools/build/Makefile.feature | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 774f0b0ca28a..e7818b44b48e 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)

We should probably also be quoting the arguments that expand $(OUTPUT_FEATURES)
too, although trying to handle path names with spaces is probably a
lost cause anyway.

>  endef
>
>  feature_set = $(eval $(feature_set_code))
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools build feature: Quote CC and CXX for their arguments
  2020-08-13  2:31 ` Tom Hebb
@ 2020-08-13 13:01   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-08-13 13:01 UTC (permalink / raw)
  To: Tom Hebb
  Cc: Daniel Díaz, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
	John Fastabend, KP Singh, Arnaldo Carvalho de Melo, Jiri Olsa,
	Stephane Eranian, Namhyung Kim, open list,
	open list:BPF (Safe dynamic programs and tools),
	open list:BPF (Safe dynamic programs and tools)

Em Wed, Aug 12, 2020 at 07:31:32PM -0700, Tom Hebb escreveu:
> On Wed, Aug 12, 2020 at 3:15 PM Daniel Díaz <daniel.diaz@linaro.org> wrote:
> >   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>
> 
> Whoops, I'm the one who introduced this issue. Fix looks good, thanks!
> 
> Reviewed-by: Thomas Hebb <tommyhebb@gmail.com>
> Fixes: e3232c2f39ac ("tools build feature: Use CC and CXX from parent")

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 22:15 [PATCH] tools build feature: Quote CC and CXX for their arguments Daniel Díaz
2020-08-13  2:31 ` Tom Hebb
2020-08-13 13:01   ` Arnaldo Carvalho de Melo

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git