Skip to contentSkip to conversation

arm/gn: don't build with clang

PATCH New Ross Burton 1 participant 4 messages Oct 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 arm/gn: don't build with clang

It appears that GN doesn't like to be built with Clang, so disable that for now.

Change-Id I01d1d2bf0d646d0841c5f291f07de80837a9a998
---
 meta-arm/recipes-devtools/gn/gn_git.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-arm/recipes-devtools/gn/gn_git.bb +5 -0
index 5962b2d5..d20428b7 100644
@@ -13,6 +13,11 @@ B = "${WORKDIR}/build"
 
 # TODO: os map like meson. mingw32 -> mingw
 
+# Currently fails to build with clang, eg:
+# https://errors.yoctoproject.org/Errors/Details/610602/
+# https://errors.yoctoproject.org/Errors/Details/610486/
+TOOLCHAIN = "gcc"
+
 do_configure[cleandirs] += "${B}"
 do_configure() {
     python3 ${S}/build/gen.py \
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/4 arm/gn: remove nativesdk

Building GN in a SDK environment isn't as trivial, as it needs to know the target configuration it should inherit cross-canadian. Also, building for mingw32 hosts breaks the build.

For now there's no immediate need for GN in nativesdk, so remove it.

Change-Id I3b969639fa8ad7780c53ae2bc8a3f166773ee4b9
---
 meta-arm/recipes-devtools/gn/gn_git.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta-arm/recipes-devtools/gn/gn_git.bb +1 -2
index d20428b7..93c3dc01 100644
@@ -22,7 +22,6 @@ do_configure[cleandirs] += "${B}"
 do_configure() {
     python3 ${S}/build/gen.py \
         --platform=${TARGET_OS} \
-        --host=${HOST_OS} \
         --out-path=${B} \
         --no-strip
 }
@@ -36,4 +35,4 @@ do_install() {
     install ${B}/gn ${D}${bindir}
 }
 
-BBCLASSEXTEND = "native nativesdk"
+BBCLASSEXTEND = "native"
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 arm/gn: map the platform identifiers

In reply to Ross Burton

GN uses its own platform identifiers, so map from our GNU-style names to the names it expects.

Change-Id I361536c43f2a9cc5c6dc0a9ad4138433399781d2
---
 meta-arm/recipes-devtools/gn/gn_git.bb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
meta-arm/recipes-devtools/gn/gn_git.bb +11 -3
index 93c3dc01..522a7efe 100644
@@ -11,17 +11,25 @@ PV = "0+git${SRCPV}"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-# TODO: os map like meson. mingw32 -> mingw
-
 # Currently fails to build with clang, eg:
 # https://errors.yoctoproject.org/Errors/Details/610602/
 # https://errors.yoctoproject.org/Errors/Details/610486/
 TOOLCHAIN = "gcc"
 
+# Map from our _OS strings to the GN's platform values.
+def gn_platform(variable, d):
+    os = d.getVar(variable)
+    if "linux" in os:
+        return "linux"
+    elif "mingw" in os:
+        return "mingw"
+    else:
+        return os
+
 do_configure[cleandirs] += "${B}"
 do_configure() {
     python3 ${S}/build/gen.py \
-        --platform=${TARGET_OS} \
+        --platform=${@gn_platform("TARGET_OS", d)} \
         --out-path=${B} \
         --no-strip
 }
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 arm/gn: don't statically link libstdc++

In reply to Ross Burton

As we're building whole systems and not binaries that are expected to be copied around, we can dynamically link to libstdc++.

Change-Id I1e54ca519b069388226f40c489c9194b870a6d3c
---
 meta-arm/recipes-devtools/gn/gn_git.bb | 1 +
 1 file changed, 1 insertion(+)
meta-arm/recipes-devtools/gn/gn_git.bb +1 -0
index 522a7efe..56002229 100644
@@ -31,6 +31,7 @@ do_configure() {
     python3 ${S}/build/gen.py \
         --platform=${@gn_platform("TARGET_OS", d)} \
         --out-path=${B} \
+        --no-static-libstdc++ \
         --no-strip
 }
 
Signature · 1 line
2.25.1