All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/zlib-ng: fix arm build
@ 2023-11-29 21:10 Fabrice Fontaine
  2023-12-01 20:25 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Fontaine @ 2023-11-29 21:10 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Set CMAKE_C_COMPILER_TARGET to BR2_ARCH to fix the following arm build
failure raised since bump to version 2.0.6 in commit
d2249821d3f30202ca2a35ad24918378d9a0a0e8:

-- Detecting C compile features - done
-- Arch not recognized, falling back to cmake arch: 'l'
-- Basearch 'l' not recognized, defaulting to 'x86'.
-- Basearch of 'l' has been detected as: 'x86'

[...]

/home/buildroot/autobuild/instance-0/output-1/build/zlib-ng-2.1.3/arch/x86/x86_features.c:17:12: fatal error: cpuid.h: No such file or directory
   17 | #  include <cpuid.h>
      |            ^~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/1551aa69be19239a8d8e081f033e4027d679ab8f
 - http://autobuild.buildroot.org/results/075d704c0f11710353bac43478e4501addcd747d

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/zlib-ng/zlib-ng.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/zlib-ng/zlib-ng.mk b/package/zlib-ng/zlib-ng.mk
index fbb906503a..33e8754c9d 100644
--- a/package/zlib-ng/zlib-ng.mk
+++ b/package/zlib-ng/zlib-ng.mk
@@ -13,6 +13,7 @@ ZLIB_NG_PROVIDES = zlib
 
 # Build with zlib compatible API, gzFile support and optimizations on
 ZLIB_NG_CONF_OPTS += \
+	-DCMAKE_C_COMPILER_TARGET=$(BR2_ARCH) \
 	-DWITH_GZFILEOP=1 \
 	-DWITH_OPTIM=1 \
 	-DZLIB_COMPAT=1 \
-- 
2.42.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zlib-ng: fix arm build
  2023-11-29 21:10 [Buildroot] [PATCH 1/1] package/zlib-ng: fix arm build Fabrice Fontaine
@ 2023-12-01 20:25 ` Peter Korsgaard
  2023-12-23 17:51   ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2023-12-01 20:25 UTC (permalink / raw)
  To: Fabrice Fontaine, romain.naour; +Cc: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Set CMAKE_C_COMPILER_TARGET to BR2_ARCH to fix the following arm build
 > failure raised since bump to version 2.0.6 in commit
 > d2249821d3f30202ca2a35ad24918378d9a0a0e8:

 > -- Detecting C compile features - done
 > -- Arch not recognized, falling back to cmake arch: 'l'
 > -- Basearch 'l' not recognized, defaulting to 'x86'.
 > -- Basearch of 'l' has been detected as: 'x86'

 > [...]

 > /home/buildroot/autobuild/instance-0/output-1/build/zlib-ng-2.1.3/arch/x86/x86_features.c:17:12: fatal error: cpuid.h: No such file or directory
 >    17 | #  include <cpuid.h>
 >       |            ^~~~~~~~~

 > Fixes:
 >  - http://autobuild.buildroot.org/results/1551aa69be19239a8d8e081f033e4027d679ab8f
 >  - http://autobuild.buildroot.org/results/075d704c0f11710353bac43478e4501addcd747d

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 > ---
 >  package/zlib-ng/zlib-ng.mk | 1 +
 >  1 file changed, 1 insertion(+)

 > diff --git a/package/zlib-ng/zlib-ng.mk b/package/zlib-ng/zlib-ng.mk
 > index fbb906503a..33e8754c9d 100644
 > --- a/package/zlib-ng/zlib-ng.mk
 > +++ b/package/zlib-ng/zlib-ng.mk
 > @@ -13,6 +13,7 @@ ZLIB_NG_PROVIDES = zlib
 
 >  # Build with zlib compatible API, gzFile support and optimizations on
 >  ZLIB_NG_CONF_OPTS += \
 > +	-DCMAKE_C_COMPILER_TARGET=$(BR2_ARCH) \

Hmm,
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_TARGET.html
states:

This variable may only be set in a toolchain file specified by the
CMAKE_TOOLCHAIN_FILE variable.

Should we set this in the toolchain file instead? Romain?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zlib-ng: fix arm build
  2023-12-01 20:25 ` Peter Korsgaard
@ 2023-12-23 17:51   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-12-23 17:51 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: romain.naour, Fabrice Fontaine, buildroot

On Fri, 01 Dec 2023 21:25:08 +0100
Peter Korsgaard <peter@korsgaard.com> wrote:

> Hmm,
> https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_TARGET.html
> states:
> 
> This variable may only be set in a toolchain file specified by the
> CMAKE_TOOLCHAIN_FILE variable.
> 
> Should we set this in the toolchain file instead? Romain?

I think zlib-ng usage of CMAKE_C_COMPILER_TARGET is non-standard. I
don't think it's supposed to be used by the CMakeLists.txt machinery of
a particular package.

The link you refer to says:

  Some compiler drivers are inherently cross-compilers, such as clang
  and QNX qcc. These compiler drivers support a command-line argument
  to specify the target to cross-compile for.

We are not using clang nor QNX qcc.
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html also
refers to this variable only for clang
(https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-using-clang)
and QNX
(https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx).

Therefore, my feeling is that zlib-ng's usage of this variable is a bit
of a hack, and it's actually why it works when passed as an argument,
because they are in fact not supposed to use this variable. So I
believe Fabrice's patch is probably the most relevant solution, but
with an improved commit log that details the conversation we've had in
this thread.

Fabrice?

(I'm going to mark the patch as Changes Requested, to have a new
iteration that has a more detailed commit log summarizing this
discussion.)

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-12-23 17:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 21:10 [Buildroot] [PATCH 1/1] package/zlib-ng: fix arm build Fabrice Fontaine
2023-12-01 20:25 ` Peter Korsgaard
2023-12-23 17:51   ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.