All of lore.kernel.org
 help / color / mirror / Atom feed
From: ecordonnier@snap.com
To: yocto-patches@lists.yoctoproject.org
Cc: Etienne Cordonnier <ecordonnier@snap.com>
Subject: [meta-darwin][PATCH 17/21] darwin-common: add the nativesdk include dir to the header search path
Date: Wed, 14 Oct 2026 16:10:38 +0200	[thread overview]
Message-ID: <20261014141209.488034-17-ecordonnier@snap.com> (raw)
In-Reply-To: <20261014141209.488034-1-ecordonnier@snap.com>

From: Etienne Cordonnier <ecordonnier@snap.com>

gcc-crosssdk's built-in header search on Darwin only covers the OS SDK
tree (.../runtime/usr/include). Headers staged by our own nativesdk
recipes live one level up and are only found via an explicit -I, e.g.
nettle's gmp.h, curl's openssl/ssl.h (pkg-config drops the Cflags as a
"system" path), file's lzma.h and llvm's zstd.h.

Add -I${STAGING_INCDIR} to CPPFLAGS for every nativesdk recipe instead
of per recipe. cmake.bbclass only feeds CFLAGS/CXXFLAGS into the compile
flags, so llvm gets it through those, plus -F for the CoreFoundation
framework that dsymutil needs.

Tested by building nativesdk-nettle, nativesdk-curl, nativesdk-file and
nativesdk-llvm for x86_64-darwin.

AI-Generated: Claude Sonnet 5.5

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
---
 conf/machine-sdk/darwin-common.inc     |  6 ++++++
 recipes-devtools/clang/llvm_%.bbappend | 15 +++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 recipes-devtools/clang/llvm_%.bbappend

diff --git a/conf/machine-sdk/darwin-common.inc b/conf/machine-sdk/darwin-common.inc
index 1e3f03b..a23c605 100644
--- a/conf/machine-sdk/darwin-common.inc
+++ b/conf/machine-sdk/darwin-common.inc
@@ -91,3 +91,9 @@ fakeroot create_macos_img() {
 # every nativesdk/cross-canadian compiler command line, and those end up in
 # headers (e.g. gmp.h's __GMP_CC), libraries and binaries.
 ERROR_QA:remove = "buildpaths"
+
+# gcc's built-in header search on Darwin only covers the OS SDK include tree
+# (.../runtime/usr/include); headers staged by our own nativesdk recipes live
+# one level up and are only found via an explicit -I. Do this for every
+# nativesdk recipe instead of per recipe (see e.g. curl, nettle).
+CPPFLAGS:append:class-nativesdk = " -I${STAGING_INCDIR}"
diff --git a/recipes-devtools/clang/llvm_%.bbappend b/recipes-devtools/clang/llvm_%.bbappend
new file mode 100644
index 0000000..8565d67
--- /dev/null
+++ b/recipes-devtools/clang/llvm_%.bbappend
@@ -0,0 +1,15 @@
+# Unlike autotools recipes (nettle, curl), cmake.bbclass feeds CMAKE_C_FLAGS/
+# CMAKE_CXX_FLAGS from CFLAGS/CXXFLAGS only, not CPPFLAGS, so the usual
+# CPPFLAGS:append trick for missing nativesdk headers has no effect here.
+# zstd's headers are staged in the nested nativesdk sysroot, not the runtime
+# macOS SDK tree gcc's default search covers.
+CFLAGS:append:class-nativesdk:darwin21 = " -I${STAGING_INCDIR}"
+CXXFLAGS:append:class-nativesdk:darwin21 = " -I${STAGING_INCDIR}"
+
+# OSXSDK is only set in clang's own bbappend, which doesn't carry over to this
+# recipe's metadata, so redefine it here too.
+OSXSDK:class-nativesdk:darwin21 = "${STAGING_DIR_TARGET}${SDKPATHNATIVE}/runtime"
+
+# dsymutil (tools/dsymutil/CFBundle.cpp) needs the CoreFoundation framework;
+# frameworks need -F, not -I.
+CXXFLAGS:append:class-nativesdk:darwin21 = " -F${OSXSDK}/System/Library/Frameworks"
-- 
2.43.0



  parent reply	other threads:[~2026-10-14 14:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 14:10 [meta-darwin][PATCH 01/21] meta-darwin: bump layer series to wrynose (6.0.3) ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 03/21] clang: regenerate Darwin SDK fixes patch for the wrynose base ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 04/21] automake: drop obsolete Darwin bbappend ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 05/21] zstd: rebase LC_RPATH patch for upstream's new zstdmt guard, scope to darwin21 ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 06/21] darwin recipes: fix S/WORKDIR/destsuffix breakage from git-fetcher UNPACKDIR relocation ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 07/21] cctools-port-crosssdk: fix stale virtual/binutils provider name ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 08/21] libdispatch-native, libtapi-native, cctools-port-crosssdk: fix ineffective clang selection ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 09/21] gcc: fix Darwin ICE from weak-alias __cpu_indicator_init_local ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 10/21] libgcrypt: drop libcap capabilities support for Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 11/21] sqlite3: fix Darwin nativesdk build (SONAME + shell link) ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 12/21] libarchive: drop acl/xattr PACKAGECONFIGs for Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 13/21] clang: scope -femulated-tls/-Wno-elaborated-enum-base to toolchain-clang ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 14/21] clang: disable clangd's XPC transport for the Darwin nativesdk build ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 15/21] clang/lldb: move LLDB support to its own nativesdk-lldb recipe ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 16/21] darwin-common: don't treat buildpaths QA as an error for the SDK ecordonnier
2026-10-14 14:10 ` ecordonnier [this message]
2026-10-14 14:10 ` [meta-darwin][PATCH 18/21] util-linux-libuuid: fix GCC ICE in uuid_time.c on Darwin nativesdk ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 19/21] libedit: don't include glibc's stdc-predef.h " ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 20/21] bash: link the in-tree readline " ecordonnier
2026-10-14 14:10 ` [meta-darwin][PATCH 21/21] gdb-cross-canadian: point --with-liblzma-prefix at the SDK sysroot prefix ecordonnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261014141209.488034-17-ecordonnier@snap.com \
    --to=ecordonnier@snap.com \
    --cc=yocto-patches@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.