All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools
@ 2021-03-23 21:28 Ross Burton
  2021-03-23 21:28 ` [PATCH 2/2] meson: use native-file instead of environment variables Ross Burton
  2021-03-23 21:52 ` [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Andre McCurdy
  0 siblings, 2 replies; 6+ messages in thread
From: Ross Burton @ 2021-03-23 21:28 UTC (permalink / raw)
  To: openembedded-core

Add a few more tools to the BUILD_* list, to match the target tool list.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/conf/bitbake.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index ecd4d1638e..d4bda80736 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -541,7 +541,10 @@ export BUILD_AR = "${BUILD_PREFIX}ar"
 export BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
 export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
 export BUILD_STRIP = "${BUILD_PREFIX}strip"
+export BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
+export BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
 export BUILD_NM = "${BUILD_PREFIX}nm"
+export BUILD_READELF = "${BUILD_PREFIX}readelf"
 
 export MAKE = "make"
 EXTRA_OEMAKE = ""
-- 
2.25.1


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

* [PATCH 2/2] meson: use native-file instead of environment variables
  2021-03-23 21:28 [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Ross Burton
@ 2021-03-23 21:28 ` Ross Burton
  2021-03-25 19:05   ` [OE-core] " Ross Burton
  2021-03-23 21:52 ` [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Andre McCurdy
  1 sibling, 1 reply; 6+ messages in thread
From: Ross Burton @ 2021-03-23 21:28 UTC (permalink / raw)
  To: openembedded-core

Meson now supports native-files, which are the same as cross files but
describe the native build.

By writing and using a native file which describes the tools to use, we
can drop the environment variable overriding.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/meson.bbclass | 49 ++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index a7644e70cb..290b39e1e0 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -26,7 +26,8 @@ MESONOPTS = " --prefix ${prefix} \
               --sysconfdir ${sysconfdir} \
               --localstatedir ${localstatedir} \
               --sharedstatedir ${sharedstatedir} \
-              --wrap-mode nodownload"
+              --wrap-mode nodownload \
+              --native-file ${WORKDIR}/native.cross"
 
 EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
 
@@ -121,9 +122,28 @@ system = '${@meson_operating_system('TARGET_OS', d)}'
 cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
 cpu = '${TARGET_ARCH}'
 endian = '${@meson_endian('TARGET', d)}'
+EOF
+
+    cat >${WORKDIR}/native.cross <<EOF
+[binaries]
+c = ${@meson_array('BUILD_CC', d)}
+cpp = ${@meson_array('BUILD_CXX', d)}
+ar = ${@meson_array('BUILD_AR', d)}
+nm = ${@meson_array('BUILD_NM', d)}
+strip = ${@meson_array('BUILD_STRIP', d)}
+readelf = ${@meson_array('BUILD_READELF', d)}
+pkgconfig = 'pkg-config-native'
+
+[properties]
+needs_exe_wrapper = false
+c_args = ${@meson_array('BUILD_CFLAGS', d)}
+c_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
+cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)}
+cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
 EOF
 }
 
+# Tell externalsrc that changes to this file require a reconfigure
 CONFIGURE_FILES = "meson.build"
 
 meson_do_configure() {
@@ -140,33 +160,6 @@ meson_do_configure() {
     fi
 }
 
-override_native_tools() {
-    # Set these so that meson uses the native tools for its build sanity tests,
-    # which require executables to be runnable. The cross file will still
-    # override these for the target build.
-    export CC="${BUILD_CC}"
-    export CXX="${BUILD_CXX}"
-    export LD="${BUILD_LD}"
-    export AR="${BUILD_AR}"
-    export STRIP="${BUILD_STRIP}"
-    # These contain *target* flags but will be used as *native* flags.  The
-    # correct native flags will be passed via -Dc_args and so on, unset them so
-    # they don't interfere with tools invoked by Meson (such as g-ir-scanner)
-    unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
-}
-
-meson_do_configure_prepend_class-target() {
-    override_native_tools
-}
-
-meson_do_configure_prepend_class-nativesdk() {
-    override_native_tools
-}
-
-meson_do_configure_prepend_class-native() {
-    export PKG_CONFIG="pkg-config-native"
-}
-
 python meson_do_qa_configure() {
     import re
     warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
-- 
2.25.1


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

* Re: [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools
  2021-03-23 21:28 [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Ross Burton
  2021-03-23 21:28 ` [PATCH 2/2] meson: use native-file instead of environment variables Ross Burton
@ 2021-03-23 21:52 ` Andre McCurdy
  2021-03-24  9:41   ` Ross Burton
  1 sibling, 1 reply; 6+ messages in thread
From: Andre McCurdy @ 2021-03-23 21:52 UTC (permalink / raw)
  To: Ross Burton; +Cc: OE Core mailing list

On Tue, Mar 23, 2021 at 2:29 PM Ross Burton <ross@burtonini.com> wrote:
>
> Add a few more tools to the BUILD_* list, to match the target tool list.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  meta/conf/bitbake.conf | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index ecd4d1638e..d4bda80736 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -541,7 +541,10 @@ export BUILD_AR = "${BUILD_PREFIX}ar"
>  export BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
>  export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
>  export BUILD_STRIP = "${BUILD_PREFIX}strip"
> +export BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
> +export BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
>  export BUILD_NM = "${BUILD_PREFIX}nm"
> +export BUILD_READELF = "${BUILD_PREFIX}readelf"

Do these new variables need to be exported?

As far as I remember a few of the BUILD_xxx variables are "official"
autotools variables which some autotools packages may expect to find
in the environment (although googling now doesn't find any
references).

If so then the rest (i.e. most of them, and certainly these newly
added ones) are OE specific and only used in OE recipes and classes...
and therefore don't need to be exported here.

>  export MAKE = "make"
>  EXTRA_OEMAKE = ""
> --
> 2.25.1
>
>
> 
>

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

* Re: [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools
  2021-03-23 21:52 ` [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Andre McCurdy
@ 2021-03-24  9:41   ` Ross Burton
  2021-03-24 10:37     ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Burton @ 2021-03-24  9:41 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Tue, 23 Mar 2021 at 21:53, Andre McCurdy <armccurdy@gmail.com> wrote:
> > @@ -541,7 +541,10 @@ export BUILD_AR = "${BUILD_PREFIX}ar"
> >  export BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
> >  export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
> >  export BUILD_STRIP = "${BUILD_PREFIX}strip"
> > +export BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
> > +export BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
> >  export BUILD_NM = "${BUILD_PREFIX}nm"
> > +export BUILD_READELF = "${BUILD_PREFIX}readelf"
>
> Do these new variables need to be exported?
>
> As far as I remember a few of the BUILD_xxx variables are "official"
> autotools variables which some autotools packages may expect to find
> in the environment (although googling now doesn't find any
> references).
>
> If so then the rest (i.e. most of them, and certainly these newly
> added ones) are OE specific and only used in OE recipes and classes...
> and therefore don't need to be exported here.

It was all in the name of consistency.

The Meson cross-file sets readelf, so to mirror the new native-file
also sets readelf.  There wasn't a BUILD_READELF and if someone is
changing BUILD_CC there's a good chance they'll be changing the entire
toochain, so I added any missing entries.

Yes, BUILD_* are effectively OE-specific so we could unexport the
entire set.  I'd prefer to do that than have some exported and some
not.

Ross

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

* Re: [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools
  2021-03-24  9:41   ` Ross Burton
@ 2021-03-24 10:37     ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2021-03-24 10:37 UTC (permalink / raw)
  To: Ross Burton, Andre McCurdy; +Cc: OE Core mailing list

On Wed, 2021-03-24 at 09:41 +0000, Ross Burton wrote:
> On Tue, 23 Mar 2021 at 21:53, Andre McCurdy <armccurdy@gmail.com> wrote:
> > > @@ -541,7 +541,10 @@ export BUILD_AR = "${BUILD_PREFIX}ar"
> > >  export BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
> > >  export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
> > >  export BUILD_STRIP = "${BUILD_PREFIX}strip"
> > > +export BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
> > > +export BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
> > >  export BUILD_NM = "${BUILD_PREFIX}nm"
> > > +export BUILD_READELF = "${BUILD_PREFIX}readelf"
> > 
> > Do these new variables need to be exported?
> > 
> > As far as I remember a few of the BUILD_xxx variables are "official"
> > autotools variables which some autotools packages may expect to find
> > in the environment (although googling now doesn't find any
> > references).
> > 
> > If so then the rest (i.e. most of them, and certainly these newly
> > added ones) are OE specific and only used in OE recipes and classes...
> > and therefore don't need to be exported here.
> 
> It was all in the name of consistency.
> 
> The Meson cross-file sets readelf, so to mirror the new native-file
> also sets readelf.  There wasn't a BUILD_READELF and if someone is
> changing BUILD_CC there's a good chance they'll be changing the entire
> toochain, so I added any missing entries.
> 
> Yes, BUILD_* are effectively OE-specific so we could unexport the
> entire set.  I'd prefer to do that than have some exported and some
> not.

It is really hard to determine if we can unexport something so whilst I
appreciate the symmetry desire, lets not add any exports we don't need.
Exports are pretty ugly from a signatures standpoint as they have to be
added to all shell tasks.

Cheers,

Richard


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

* Re: [OE-core] [PATCH 2/2] meson: use native-file instead of environment variables
  2021-03-23 21:28 ` [PATCH 2/2] meson: use native-file instead of environment variables Ross Burton
@ 2021-03-25 19:05   ` Ross Burton
  0 siblings, 0 replies; 6+ messages in thread
From: Ross Burton @ 2021-03-25 19:05 UTC (permalink / raw)
  Cc: OE-core

So v1 failed all over the AB, the root cause being that in master
Meson doesn't know that there's a specific pkg-config binary for all
native builds, but with this series it does.  In master it only uses
pkg-config-native in native *recipes* but now it uses it for all
native lookups in target recipes too.

This means that when the G-I code uses a native pkgconfig lookup to
get target library dependencies, it goes terribly wrong.

Upstream are basically confused as to how "cross" and "G-I" are meant
to work, because they from a glance can't easily, so I expect to be
able to get this patch upstream as it doesn't break what already works
and is a step towards the correct model.

Ross

On Tue, 23 Mar 2021 at 21:28, Ross Burton via lists.openembedded.org
<ross=burtonini.com@lists.openembedded.org> wrote:
>
> Meson now supports native-files, which are the same as cross files but
> describe the native build.
>
> By writing and using a native file which describes the tools to use, we
> can drop the environment variable overriding.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  meta/classes/meson.bbclass | 49 ++++++++++++++++----------------------
>  1 file changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
> index a7644e70cb..290b39e1e0 100644
> --- a/meta/classes/meson.bbclass
> +++ b/meta/classes/meson.bbclass
> @@ -26,7 +26,8 @@ MESONOPTS = " --prefix ${prefix} \
>                --sysconfdir ${sysconfdir} \
>                --localstatedir ${localstatedir} \
>                --sharedstatedir ${sharedstatedir} \
> -              --wrap-mode nodownload"
> +              --wrap-mode nodownload \
> +              --native-file ${WORKDIR}/native.cross"
>
>  EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
>
> @@ -121,9 +122,28 @@ system = '${@meson_operating_system('TARGET_OS', d)}'
>  cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
>  cpu = '${TARGET_ARCH}'
>  endian = '${@meson_endian('TARGET', d)}'
> +EOF
> +
> +    cat >${WORKDIR}/native.cross <<EOF
> +[binaries]
> +c = ${@meson_array('BUILD_CC', d)}
> +cpp = ${@meson_array('BUILD_CXX', d)}
> +ar = ${@meson_array('BUILD_AR', d)}
> +nm = ${@meson_array('BUILD_NM', d)}
> +strip = ${@meson_array('BUILD_STRIP', d)}
> +readelf = ${@meson_array('BUILD_READELF', d)}
> +pkgconfig = 'pkg-config-native'
> +
> +[properties]
> +needs_exe_wrapper = false
> +c_args = ${@meson_array('BUILD_CFLAGS', d)}
> +c_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
> +cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)}
> +cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
>  EOF
>  }
>
> +# Tell externalsrc that changes to this file require a reconfigure
>  CONFIGURE_FILES = "meson.build"
>
>  meson_do_configure() {
> @@ -140,33 +160,6 @@ meson_do_configure() {
>      fi
>  }
>
> -override_native_tools() {
> -    # Set these so that meson uses the native tools for its build sanity tests,
> -    # which require executables to be runnable. The cross file will still
> -    # override these for the target build.
> -    export CC="${BUILD_CC}"
> -    export CXX="${BUILD_CXX}"
> -    export LD="${BUILD_LD}"
> -    export AR="${BUILD_AR}"
> -    export STRIP="${BUILD_STRIP}"
> -    # These contain *target* flags but will be used as *native* flags.  The
> -    # correct native flags will be passed via -Dc_args and so on, unset them so
> -    # they don't interfere with tools invoked by Meson (such as g-ir-scanner)
> -    unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
> -}
> -
> -meson_do_configure_prepend_class-target() {
> -    override_native_tools
> -}
> -
> -meson_do_configure_prepend_class-nativesdk() {
> -    override_native_tools
> -}
> -
> -meson_do_configure_prepend_class-native() {
> -    export PKG_CONFIG="pkg-config-native"
> -}
> -
>  python meson_do_qa_configure() {
>      import re
>      warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)
> --
> 2.25.1
>
>
> 
>

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

end of thread, other threads:[~2021-03-25 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 21:28 [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Ross Burton
2021-03-23 21:28 ` [PATCH 2/2] meson: use native-file instead of environment variables Ross Burton
2021-03-25 19:05   ` [OE-core] " Ross Burton
2021-03-23 21:52 ` [OE-core] [PATCH 1/2] bitbake.conf: ensure BUILD_* tools match target tools Andre McCurdy
2021-03-24  9:41   ` Ross Burton
2021-03-24 10:37     ` Richard Purdie

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.