[OE-core] Possible patch for build issue (mostly affects mingw, but see below)

Peter Seebach peter.seebach at windriver.com
Fri Oct 16 02:27:04 UTC 2015


I'd like a second opinion on this. Without this, we had very strange build
failures which ended up being using the build system g++ with the mingw
"host" (in cross-canadian land, this would be the machine the compiler will
run on) headers. On study, the issue seems to be that libcpp is now being
built for the build machine, but it's using C++ as of 5.2.0... But
EXTRA_BUILD_FLAGS does not override CXXFLAGS, only CFLAGS and LDFLAGS, so
you end up with the regular host system CFLAGS, which are the mingw ones,
being used with the build system compiler.

Without this, I couldn't build gcc 5.2 for mingw. With this (and adding
libgomp to the RUNTIMETARGET_remove_mingw32 in meta-mingw), I could.

However, I don't think this is actually mingw specific. I think that,
without this fix, *every* build ends up using the host system's CXXFLAGS
to build a build-system libcpp, instead of the build system's. It's just
that, since they're usually compatible-enough for libcpp, no one ever
noticed.

(Sending it out to the list as a plain patch because it's easier to read; if
people want a pretty formatted gcc patch for oe-core, I can do that, and I
think this one should go upstream too.)

Author: Peter Seebach <peter.seebach at windriver.com>
Date:   Wed Oct 14 17:10:10 2015 -0500

    Makefile.tpl: Also pass CXXFLAGS_FOR_BUILD
    
    When doing a FOR_BUILD thing, you have to override CFLAGS with
    CFLAGS_FOR_BUILD. And if you use C++, you also have to override
    CXXFLAGS with CXXFLAGS_FOR_BUILD, or you end up trying to use the
    mingw headers for a host build.
    
    Signed-off-by: Peter Seebach <peter.seebach at windriver.com>

diff --git a/Makefile.in b/Makefile.in
index 36b4008..b64ef77 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -169,6 +169,7 @@ BUILD_EXPORTS = \
 # built for the build system to override those in BASE_FLAGS_TO_PASS.
 EXTRA_BUILD_FLAGS = \
 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
+	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
 
 # This is the list of directories to built for the host system.
diff --git a/Makefile.tpl b/Makefile.tpl
index 1ea1954..4f73d66 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -172,6 +172,7 @@ BUILD_EXPORTS = \
 # built for the build system to override those in BASE_FLAGS_TO_PASS.
 EXTRA_BUILD_FLAGS = \
 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
+	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
 
 # This is the list of directories to built for the host system.
-- 
Listen, get this.  Nobody with a good compiler needs to be justified.



More information about the Openembedded-core mailing list