All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] [poky-contrib] meson bugfix
@ 2017-11-15 17:53 Martin Kelly
  2017-11-15 17:53 ` [PATCH 1/1] meson: export native env only for native build Martin Kelly
  2017-11-15 18:02 ` ✗ patchtest: failure for meson bugfix Patchwork
  0 siblings, 2 replies; 7+ messages in thread
From: Martin Kelly @ 2017-11-15 17:53 UTC (permalink / raw)
  To: openembedded-core

This patch is intended to be applied on top of Alexander Kanavin's poky-contrib
branch akanavin/meson in preparation for meson moving into OE-core.

Martin Kelly (1):
  meson: export native env only for native build

 meta/classes/meson.bbclass | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

--
2.11.0



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

* [PATCH 1/1] meson: export native env only for native build
  2017-11-15 17:53 [PATCH 0/1] [poky-contrib] meson bugfix Martin Kelly
@ 2017-11-15 17:53 ` Martin Kelly
  2017-11-16 10:14   ` Alexander Kanavin
  2017-11-16 17:52   ` Alexander Kanavin
  2017-11-15 18:02 ` ✗ patchtest: failure for meson bugfix Patchwork
  1 sibling, 2 replies; 7+ messages in thread
From: Martin Kelly @ 2017-11-15 17:53 UTC (permalink / raw)
  To: openembedded-core

Although the meson crossfile should take care of setting the right cross
environment for a target build, meson slurps any set CFLAGS, CXXFLAGS,
LDFLAGS, and CPPFLAGS from the environment and injects them into the
build (see mesonbuild/environment.py:get_args_from_envvars for details).

This means that we are seeing native CFLAGS, CXXFLAGS, LDFLAGS, and
CPPFLAGS in the target build, which is wrong and causes build failures
when target and native have libraries in common (the linker gets
confused and bails).

That said, we *do* need to set certain vars for all builds so that meson
can find the right build tools. Without this, meson will fail during its
sanity checking step because it will determine the build tools to be
unrunnable since they output target instead of native artifacts.

The solution to all of this is to set CC, CXX, LD, and AR globally to
the native tools while setting the other native vars *only* for the
native build. For target builds, these vars will get overridden by the
cross file as we expect.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
---
 meta/classes/meson.bbclass | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index f6cf24c33a7..f64377efcba 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -9,13 +9,6 @@ do_configure[cleandirs] = "${B}"
 # Where the meson.build build configuration is
 MESON_SOURCEPATH = "${S}"
 
-# These variables in the environment override meson's *native* tools settings.
-# We have to unset them, so that meson doesn't pick up the cross tools and
-# use them for native builds.
-unset CC
-unset CXX
-unset AR
-
 def noprefix(var, d):
     return d.getVar(var, True).replace(d.getVar('prefix', True) + '/', '', 1)
 
@@ -91,6 +84,22 @@ meson_do_configure() {
     fi
 }
 
+meson_do_configure_prepend_class-target() {
+    # 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. Note that we do *not* set CFLAGS,
+    # LDFLAGS, etc. as they will be slurped in by meson and applied to the
+    # target build, causing errors.
+    export CC="${BUILD_CC}"
+    export CXX="${BUILD_CXX}"
+    export LD="${BUILD_LD}"
+    export AR="${BUILD_AR}"
+}
+
+meson_do_configure_prepend_class-native() {
+    export PKG_CONFIG="pkg-config-native"
+}
+
 do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
 meson_do_compile() {
     ninja ${PARALLEL_MAKE}
-- 
2.11.0



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

* ✗ patchtest: failure for meson bugfix
  2017-11-15 17:53 [PATCH 0/1] [poky-contrib] meson bugfix Martin Kelly
  2017-11-15 17:53 ` [PATCH 1/1] meson: export native env only for native build Martin Kelly
@ 2017-11-15 18:02 ` Patchwork
  2017-11-15 18:09   ` Martin Kelly
  1 sibling, 1 reply; 7+ messages in thread
From: Patchwork @ 2017-11-15 18:02 UTC (permalink / raw)
  To: Martin Kelly; +Cc: openembedded-core

== Series Details ==

Series: meson bugfix
Revision: 1
URL   : https://patchwork.openembedded.org/series/9809/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at a17f3ec910)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

* Re: ✗ patchtest: failure for meson bugfix
  2017-11-15 18:02 ` ✗ patchtest: failure for meson bugfix Patchwork
@ 2017-11-15 18:09   ` Martin Kelly
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Kelly @ 2017-11-15 18:09 UTC (permalink / raw)
  To: openembedded-core

This is expected, as the patch is intended to apply to Alexander 
Kanavin's poky-contrib akanavin/meson branch, not oe-core master.

On 11/15/2017 10:02 AM, Patchwork wrote:
> == Series Details ==
> 
> Series: meson bugfix
> Revision: 1
> URL   : https://patchwork.openembedded.org/series/9809/
> State : failure
> 
> == Summary ==
> 
> 
> Thank you for submitting this patch series to OpenEmbedded Core. This is
> an automated response. Several tests have been executed on the proposed
> series by patchtest resulting in the following failures:
> 
> 
> 
> * Issue             Series does not apply on top of target branch [test_series_merge_on_head]
>    Suggested fix    Rebase your series on top of targeted branch
>    Targeted branch  master (currently at a17f3ec910)
> 
> 
> 
> If you believe any of these test results are incorrect, please reply to the
> mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
> Otherwise we would appreciate you correcting the issues and submitting a new
> version of the patchset if applicable. Please ensure you add/increment the
> version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
> [PATCH v3] -> ...).
> 
> ---
> Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
> Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
> Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
> 


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

* Re: [PATCH 1/1] meson: export native env only for native build
  2017-11-15 17:53 ` [PATCH 1/1] meson: export native env only for native build Martin Kelly
@ 2017-11-16 10:14   ` Alexander Kanavin
  2017-11-16 17:52   ` Alexander Kanavin
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2017-11-16 10:14 UTC (permalink / raw)
  To: Martin Kelly, openembedded-core

On 11/15/2017 07:53 PM, Martin Kelly wrote:
> Although the meson crossfile should take care of setting the right cross
> environment for a target build, meson slurps any set CFLAGS, CXXFLAGS,
> LDFLAGS, and CPPFLAGS from the environment and injects them into the
> build (see mesonbuild/environment.py:get_args_from_envvars for details).
> 
> This means that we are seeing native CFLAGS, CXXFLAGS, LDFLAGS, and
> CPPFLAGS in the target build, which is wrong and causes build failures
> when target and native have libraries in common (the linker gets
> confused and bails).
> 
> That said, we *do* need to set certain vars for all builds so that meson
> can find the right build tools. Without this, meson will fail during its
> sanity checking step because it will determine the build tools to be
> unrunnable since they output target instead of native artifacts.
> 
> The solution to all of this is to set CC, CXX, LD, and AR globally to
> the native tools while setting the other native vars *only* for the
> native build. For target builds, these vars will get overridden by the
> cross file as we expect.

Thanks; I will add this patch to my branch (so you get the credit for 
it). There's still a few failures to sort first though, discovered by AB 
(see Ross' email).

Alex


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

* Re: [PATCH 1/1] meson: export native env only for native build
  2017-11-15 17:53 ` [PATCH 1/1] meson: export native env only for native build Martin Kelly
  2017-11-16 10:14   ` Alexander Kanavin
@ 2017-11-16 17:52   ` Alexander Kanavin
  2017-11-16 18:17     ` Martin Kelly
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Kanavin @ 2017-11-16 17:52 UTC (permalink / raw)
  To: Martin Kelly, openembedded-core

On 11/15/2017 07:53 PM, Martin Kelly wrote:

> +meson_do_configure_prepend_class-native() {
> +    export PKG_CONFIG="pkg-config-native"
> +}
> +

What does this bit do? Should it go to a separate patch?

Alex


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

* Re: [PATCH 1/1] meson: export native env only for native build
  2017-11-16 17:52   ` Alexander Kanavin
@ 2017-11-16 18:17     ` Martin Kelly
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Kelly @ 2017-11-16 18:17 UTC (permalink / raw)
  To: Alexander Kanavin, openembedded-core

On 11/16/2017 09:52 AM, Alexander Kanavin wrote:
> On 11/15/2017 07:53 PM, Martin Kelly wrote:
> 
>> +meson_do_configure_prepend_class-native() {
>> +    export PKG_CONFIG="pkg-config-native"
>> +}
>> +
> 
> What does this bit do? Should it go to a separate patch?
> 
> Alex

This is from Ross Burton's patch to meta-oe 
6e2d975fc16f4228a2d952bde1a874f337281ada ("meson: export PKG_CONFIG to 
use pkg-config-native for native builds").

Since it's already present in meta-oe, this logic doesn't need a 
separate patch for meta-oe; I just moved the line into 
meson_do_configure instead of making it global. However, your branch 
doesn't have Ross's patch. Ideally, I think you should first cherry-pick 
Ross Burton's patch into your branch and then put my patch on top of it.


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

end of thread, other threads:[~2017-11-16 18:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 17:53 [PATCH 0/1] [poky-contrib] meson bugfix Martin Kelly
2017-11-15 17:53 ` [PATCH 1/1] meson: export native env only for native build Martin Kelly
2017-11-16 10:14   ` Alexander Kanavin
2017-11-16 17:52   ` Alexander Kanavin
2017-11-16 18:17     ` Martin Kelly
2017-11-15 18:02 ` ✗ patchtest: failure for meson bugfix Patchwork
2017-11-15 18:09   ` Martin Kelly

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.