diff mbox series

[meta-darwin] Fix dylib paths for gdb and lldb

Message ID 20260202155852.76192-2-dev@qinc.tv
State New
Headers show
Series [meta-darwin] Fix dylib paths for gdb and lldb | expand

Commit Message

Eric L. Hernes Feb. 2, 2026, 3:58 p.m. UTC
The installed path to expat and liblldb are wrong.  This results in
the binaries not running on the macOS host. With gdb, we have

$ ./aarch64-oe-linux-gdb
dyld[...]: Library not loaded: libexpat.1.dylib
  Referenced from: <4F097B37-76EC-308F-8022-448023624AD3> /.../aarch64-oe-linux-gdb
  Reason: tried: 'libexpat.1.dylib' (no such file),
  '/System/Volumes/Preboot/Cryptexes/OSlibexpat.1.dylib' (no such
  file), 'libexpat.1.dylib' (no such file), '....'

Running otool shows (some output omitted for clarity):
$ otool -L ./aarch64-oe-linux-gdb
./aarch64-oe-linux-gdb:
	libexpat.1.dylib (compatibility version 12.0.0, current version 12.0.0)
	@loader_path/../../lib/libmpfr.6.dylib (compatibility version 9.0.0, current

One fix would be to patch the configure/build/install scripts to have
the proper path to expat.

The macOS tools give us a simpler option to just run
`install_name_tool` to set it correctly.

lldb-dap has a similar problem with `liblldb`.

Signed-off-by: Eric L. Hernes <dev@qinc.tv>
---
 recipes-devtools/clang/clang_%.bbappend            | 4 ++++
 recipes-devtools/gdb/gdb-cross-canadian_%.bbappend | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Etienne Cordonnier Feb. 25, 2026, 12:15 p.m. UTC | #1
Hi Eric,

Thanks for the patch!
Merged to main as
https://git.yoctoproject.org/meta-darwin/commit/?id=11f796b19e30c20b7f432b3a11d501e1e66f4956

On Mon, Feb 2, 2026 at 4:59 PM Eric L. Hernes via lists.yoctoproject.org
<dev=qinc.tv@lists.yoctoproject.org> wrote:

> The installed path to expat and liblldb are wrong.  This results in
> the binaries not running on the macOS host. With gdb, we have
>
> $ ./aarch64-oe-linux-gdb
> dyld[...]: Library not loaded: libexpat.1.dylib
>   Referenced from: <4F097B37-76EC-308F-8022-448023624AD3>
> /.../aarch64-oe-linux-gdb
>   Reason: tried: 'libexpat.1.dylib' (no such file),
>   '/System/Volumes/Preboot/Cryptexes/OSlibexpat.1.dylib' (no such
>   file), 'libexpat.1.dylib' (no such file), '....'
>
> Running otool shows (some output omitted for clarity):
> $ otool -L ./aarch64-oe-linux-gdb
> ./aarch64-oe-linux-gdb:
>         libexpat.1.dylib (compatibility version 12.0.0, current version
> 12.0.0)
>         @loader_path/../../lib/libmpfr.6.dylib (compatibility version
> 9.0.0, current
>
> One fix would be to patch the configure/build/install scripts to have
> the proper path to expat.
>
> The macOS tools give us a simpler option to just run
> `install_name_tool` to set it correctly.
>
> lldb-dap has a similar problem with `liblldb`.
>
> Signed-off-by: Eric L. Hernes <dev@qinc.tv>
> ---
>  recipes-devtools/clang/clang_%.bbappend            | 4 ++++
>  recipes-devtools/gdb/gdb-cross-canadian_%.bbappend | 8 +++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/recipes-devtools/clang/clang_%.bbappend
> b/recipes-devtools/clang/clang_%.bbappend
> index e55dff6..9aa2c83 100644
> --- a/recipes-devtools/clang/clang_%.bbappend
> +++ b/recipes-devtools/clang/clang_%.bbappend
> @@ -83,4 +83,8 @@ FILES:${PN} += " \
>     ${libdir}/LLVMgold.dylib \
>  "
>
> +do_compile:append:class-nativesdk:darwin21() {
> +    ${SDK_PREFIX}install_name_tool -change liblldb.${PV}.dylib
> @loader_path/../lib/liblldb.${PV}.dylib ${B}/bin/lldb-dap
> +}
> +
>  INSANE_SKIP:${PN}:class-nativesdk:darwin21 += " file-rdeps"
> diff --git a/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
> b/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
> index 3f69019..8d30ffb 100644
> --- a/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
> +++ b/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
> @@ -16,4 +16,10 @@ EXTRA_OECONF:remove:darwinsdk = "--with-system-readline"
>  # Remove -rpath-link and -rpath
>  LDFLAGS:darwinsdk = "${BUILDSDK_LDFLAGS}"
>
> -INSANE_SKIP:append:darwin21 = " buildpaths"
> +do_compile:append:darwinsdk() {
> +    ${SDK_PREFIX}install_name_tool -change libexpat.1.dylib
> @loader_path/../../lib/libexpat.1.dylib ${B}/gdb/gdb
> +}
> +
> +DEPENDS:append:darwinsdk = " nativesdk-zlib "
> +
> +INSANE_SKIP:append:darwinsdk = " buildpaths"
> --
> 2.50.1 (Apple Git-155)
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#3168):
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_yocto-2Dpatches_message_3168&d=DwIFAg&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=DnnaXiF2bjQKM8-IDWXut7OR6YYymC-9FFg1oCZNLUcdV64-OGGRKx_9gy78azAW&s=TLgX480aR6uD74bbLAUYHubl1Gonl_cEleuc6hdcpWs&e=
> Mute This Topic:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_mt_117598468_7048771&d=DwIFAg&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=DnnaXiF2bjQKM8-IDWXut7OR6YYymC-9FFg1oCZNLUcdV64-OGGRKx_9gy78azAW&s=DzvuKyl9Gzy0y3mKfDYl2vuXLIjSF7z7Uwl5TJFa9cc&e=
> Group Owner: yocto-patches+owner@lists.yoctoproject.org
> Unsubscribe:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.yoctoproject.org_g_yocto-2Dpatches_leave_13184993_7048771_1814342232_xyzzy&d=DwIFAg&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=DnnaXiF2bjQKM8-IDWXut7OR6YYymC-9FFg1oCZNLUcdV64-OGGRKx_9gy78azAW&s=Uq4tnTshRts6qa5baONv8242u3SWFU2ydn5U_gRKMto&e=
> [ecordonnier@snap.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
>
diff mbox series

Patch

diff --git a/recipes-devtools/clang/clang_%.bbappend b/recipes-devtools/clang/clang_%.bbappend
index e55dff6..9aa2c83 100644
--- a/recipes-devtools/clang/clang_%.bbappend
+++ b/recipes-devtools/clang/clang_%.bbappend
@@ -83,4 +83,8 @@  FILES:${PN} += " \
    ${libdir}/LLVMgold.dylib \
 "
 
+do_compile:append:class-nativesdk:darwin21() {
+    ${SDK_PREFIX}install_name_tool -change liblldb.${PV}.dylib @loader_path/../lib/liblldb.${PV}.dylib ${B}/bin/lldb-dap
+}
+
 INSANE_SKIP:${PN}:class-nativesdk:darwin21 += " file-rdeps"
diff --git a/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend b/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
index 3f69019..8d30ffb 100644
--- a/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
+++ b/recipes-devtools/gdb/gdb-cross-canadian_%.bbappend
@@ -16,4 +16,10 @@  EXTRA_OECONF:remove:darwinsdk = "--with-system-readline"
 # Remove -rpath-link and -rpath
 LDFLAGS:darwinsdk = "${BUILDSDK_LDFLAGS}"
 
-INSANE_SKIP:append:darwin21 = " buildpaths"
+do_compile:append:darwinsdk() {
+    ${SDK_PREFIX}install_name_tool -change libexpat.1.dylib @loader_path/../../lib/libexpat.1.dylib ${B}/gdb/gdb
+}
+
+DEPENDS:append:darwinsdk = " nativesdk-zlib "
+
+INSANE_SKIP:append:darwinsdk = " buildpaths"