Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947059 - x11-terms/ghostty: error: unable to find dynamic system library 'gtk4' using strategy 'mode_first'
Summary: x11-terms/ghostty: error: unable to find dynamic system library 'gtk4' using ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: sin-ack
URL: https://paste.gentoo.zip/v2k56eKY
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-12-28 07:35 UTC by Leo Douglas
Modified: 2025-01-13 03:54 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (ghostty.log,67.11 KB, text/plain)
2024-12-28 07:35 UTC, Leo Douglas
Details
Force pkg-config usage in build.zig (ghostty-force-pkg-config.patch,869 bytes, patch)
2024-12-29 06:08 UTC, sin-ack
Details | Diff
Enable verbose pkg-config failures in zig stdlib (zig-0.13.0-verbose-pkg-config-failure.patch,1.78 KB, patch)
2024-12-29 06:09 UTC, sin-ack
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Douglas 2024-12-28 07:35:14 UTC
I used a clean stage3 stable environment and couldn't compile successfully. Please refer to the attached detailed build log.

Reproducible: Always
Comment 1 Leo Douglas 2024-12-28 07:35:35 UTC
Created attachment 915344 [details]
build.log
Comment 2 sin-ack 2024-12-28 19:09:24 UTC
Unable to reproduce with a clean stage3 build using the default/linux/amd64/23.0/desktop profile. Is the file /usr/lib64/pkgconfig/gtk4.pc available on your computer?
Comment 3 Leo Douglas 2024-12-29 03:05:33 UTC
yes, /usr/lib64/pkgconfig/gtk4.pc exists. I tested it with default/linux/amd64/23.0/systemd not a desktop profile.
Comment 4 sin-ack 2024-12-29 04:12:00 UTC
Is virtual/pkgconfig installed on your system? What is the output of
"pkg-config --libs gtk4"?
Comment 5 Leo Douglas 2024-12-29 05:29:47 UTC
yes, virtual/pkgconfig is a base package of `default/linux/amd64/23.0/systemd`.

$ pkg-config --libs gtk4
-lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
Comment 6 sin-ack 2024-12-29 05:37:29 UTC
This is certainly strange. This error happens because by default, Zig falls back to trying to link the a shared library with the exact name directly after a pkg-config failure. Could you please try building Ghostty from source with

    git clone https://github.com/ghostty-org/ghostty
    git checkout v1.0.0
    zig-0.13.0 build --release=fast -Dapp-runtime=gtk -Dgtk-adwaita=true

and see whether this fails with the same error?
Comment 7 Leo Douglas 2024-12-29 05:46:17 UTC
same error:

$ zig-bin-0.13.0 build --release=fast -Dapp-runtime=gtk -Dgtk-adwaita=true

install
└─ install ghostty
   └─ zig build-exe ghostty ReleaseFast native failure
error: error: unable to find dynamic system library 'gtk4' using strategy 'mode_first'. searched paths:
  /usr/lib/x86_64-linux-gnu/libgtk4.so
  /usr/local/lib64/libgtk4.so
  /usr/local/lib/libgtk4.so
  /usr/lib/x86_64-linux-gnu/libgtk4.so
  /lib64/libgtk4.so
  /lib/libgtk4.so
  /usr/lib64/libgtk4.so
  /usr/lib/libgtk4.so
  /lib/x86_64-linux-gnu/libgtk4.so
  /usr/lib/x86_64-linux-gnu/libgtk4.a
  /usr/local/lib64/libgtk4.a
  /usr/local/lib/libgtk4.a
  /usr/lib/x86_64-linux-gnu/libgtk4.a
  /lib64/libgtk4.a
  /lib/libgtk4.a
  /usr/lib64/libgtk4.a
  /usr/lib/libgtk4.a
  /lib/x86_64-linux-gnu/libgtk4.a

error: the following command exited with error code 1:
/opt/zig-bin-0.13.0/zig build-exe /root/ghostty/.zig-cache/o/a2ddf59d646a648a7e9565a94a581c18/libfreetype.a /root/ghostty/.zig-cache/o/257078f493144e4d1d914fa8a97e4b41/libharfbuzz.a /root/ghostty/.zig-cache/o/3c48db4e8bdd8f4a876be077d135ed7d/libfontconfig.a /root/ghostty/.zig-cache/o/74160ee31d65d32a6ce52697f694cfba/libpng.a /root/ghostty/.zig-cache/o/225026491713707dadc389649a6f66f9/libz.a /root/ghostty/.zig-cache/o/96ac90ee240e5cbf0c8bb5297a0ba585/liboniguruma.a /root/ghostty/.zig-cache/o/e12be2cac3116e2454c67fd961a920ff/libglslang.a /root/ghostty/.zig-cache/o/361a73b4c097c3e9239d1537a4ed5c1e/libspirv_cross.a /root/ghostty/.zig-cache/o/99ab65a31398a7b0dc12c72f89abb52b/libsimdutf.a /root/ghostty/.zig-cache/o/2130bf3df8c6cd3bae4586c325d6b16a/libsentry.a /root/ghostty/src/stb/stb.c -cflags -DHWY_DISABLED_TARGETS=464 -- /root/ghostty/src/simd/base64.cpp /root/ghostty/src/simd/codepoint_width.cpp /root/ghostty/src/simd/index_of.cpp /root/ghostty/src/simd/vt.cpp /root/ghostty/.zig-cache/o/9198687c51c90fe54de457f0c0dfdd66/libcimgui.a /root/ghostty/.zig-cache/o/9d2ed9e49e6ae9e63b8dbfff4723b8f8/libhighway.a /root/ghostty/.zig-cache/o/1d83b26c9615486baa53511d1dc1d1e8/libutfcpp.a -cflags -- /root/ghostty/vendor/glad/src/gl.c -search_dylibs_first -lgtk4 -ladwaita-1 /root/ghostty/.zig-cache/o/186bdbd6c211006d6109ac1beba09814/ghostty_resources.c -fstrip -OReleaseFast -I /root/ghostty/.zig-cache/o/015dd18bd47de965175979132aa6c3c4 -I /root/ghostty/.zig-cache/o/013d509f10ef928ce6bf1772e3b7979f -I /root/ghostty/.zig-cache/o/2f2a648b3e2cc6e863e174b7bf8a39b6 -I /root/ghostty/.zig-cache/o/86c69efeb213127d2cdbdb2116fffffa -I /root/ghostty/.zig-cache/o/4854957d9535010714ef4d443401bade -I /root/ghostty/.zig-cache/o/b2c02eb667c2b5a9ee76b7059bd5e60b -I /root/ghostty/.zig-cache/o/55c59dab6f46c4bb5538507f2b8e87a5 -I /root/ghostty/.zig-cache/o/64ae27ef2bc71904e105a9d62007327f -I /root/ghostty/.zig-cache/o/339f052510751b64e191b2aead6b3aef -I /root/ghostty/.zig-cache/o/e48d180b733bd26459cf998600b83a31 -I /root/ghostty/src/stb -I /root/ghostty/src/apprt/gtk -I /root/ghostty/src -I /root/ghostty/.zig-cache/o/9e2bda7c9db45099ca7a80dfd665708e -I /root/ghostty/.zig-cache/o/eb793169750e01ad84a344359164a6fd -I /root/ghostty/.zig-cache/o/eb4c9e8423b7def0c115e4b6200537f2 -I /root/ghostty/vendor/glad/include -I /root/ghostty/.zig-cache/o/fdf7a319742ece99d23668f4f3420aa4 -L /usr/lib/x86_64-linux-gnu --dep build_options --dep freetype --dep harfbuzz --dep fontconfig --dep oniguruma --dep glslang --dep spirv_cross --dep sentry --dep opengl --dep vaxis --dep wuffs --dep xev --dep z2d --dep ziglyph --dep zf --dep cimgui --dep help_strings --dep unicode_tables -Mroot=/root/ghostty/src/main.zig -Mbuild_options=/root/ghostty/.zig-cache/c/46e311d46ab6d69db92265b52c987301/options.zig -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include -I /root/ghostty/pkg/freetype -Mfreetype=/root/ghostty/pkg/freetype/main.zig -OReleaseFast -I /root/.cache/zig/p/1220b8588f106c996af10249bfa092c6fb2f35fbacb1505ef477a0b04a7dd1063122/src -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include --dep freetype --dep macos -Mharfbuzz=/root/ghostty/pkg/harfbuzz/main.zig -I /root/.cache/zig/p/12201149afb3326c56c05bb0a577f54f76ac20deece63aa2f5cd6ff31a4fa4fcb3b7 -I /root/ghostty/pkg/fontconfig/override/include -Mfontconfig=/root/ghostty/pkg/fontconfig/main.zig -I /root/.cache/zig/p/1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb/src -Moniguruma=/root/ghostty/pkg/oniguruma/main.zig -OReleaseFast -I /root/.cache/zig/p/12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1 -I /root/ghostty/pkg/glslang/override -Mglslang=/root/ghostty/pkg/glslang/main.zig -I /root/.cache/zig/p/1220fb3b5586e8be67bc3feb34cbe749cf42a60d628d2953632c2f8141302748c8da -Mspirv_cross=/root/ghostty/pkg/spirv-cross/main.zig -OReleaseFast -I /root/.cache/zig/p/1220446be831adcca918167647c06c7b825849fa3fba5f22da394667974537a9c77e/include -Msentry=/root/ghostty/pkg/sentry/main.zig -I /root/ghostty/vendor/glad/include -Mopengl=/root/ghostty/pkg/opengl/main.zig -OReleaseFast --dep code_point --dep grapheme --dep DisplayWidth --dep zigimg -Mvaxis=/root/.cache/zig/p/12200df4ebeaed45de26cb2c9f3b6f3746d8013b604e035dae658f86f586c8c91d2f/src/main.zig -cflags -DWUFFS_IMPLEMENTATION -DWUFFS_CONFIG__MODULES -DWUFFS_CONFIG__MODULE__AUX__BASE -DWUFFS_CONFIG__MODULE__AUX__IMAGE -DWUFFS_CONFIG__MODULE__BASE -DWUFFS_CONFIG__MODULE__ADLER32 -DWUFFS_CONFIG__MODULE__CRC32 -DWUFFS_CONFIG__MODULE__DEFLATE -DWUFFS_CONFIG__MODULE__JPEG -DWUFFS_CONFIG__MODULE__PNG -DWUFFS_CONFIG__MODULE__ZLIB -- /root/.cache/zig/p/12200984439edc817fbcbbaff564020e5104a0d04a2d0f53080700827052de700462/release/c/wuffs-v0.4.c -OReleaseFast -I /root/.cache/zig/p/12200984439edc817fbcbbaff564020e5104a0d04a2d0f53080700827052de700462/release/c -Mwuffs=/root/ghostty/pkg/wuffs/src/main.zig -Mxev=/root/.cache/zig/p/12206029de146b685739f69b10a6f08baee86b3d0a5f9a659fa2b2b66c9602078bbf/src/main.zig -OReleaseFast -Mz2d=/root/.cache/zig/p/12201f0d542e7541cf492a001d4d0d0155c92f58212fbcb0d224e95edeba06b5416a/src/z2d.zig -Mziglyph=/root/.cache/zig/p/12207831bce7d4abce57b5a98e8f3635811cfefd160bca022eb91fe905d36a02cf25/src/ziglyph.zig -Mzf=/root/.cache/zig/p/1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8/src/zf/zf.zig -OReleaseFast -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include -I /root/ghostty/pkg/cimgui/vendor -Mcimgui=/root/ghostty/pkg/cimgui/main.zig -Mhelp_strings=/root/ghostty/.zig-cache/o/38b7201d1a986eaf9d35f254f7c4fbb1/stdout -Municode_tables=/root/ghostty/.zig-cache/o/0a6f22e5d6b4f1f542be44f246ba0664/stdout /root/ghostty/.zig-cache/o/225026491713707dadc389649a6f66f9/libz.a /root/ghostty/.zig-cache/o/74160ee31d65d32a6ce52697f694cfba/libpng.a /root/ghostty/.zig-cache/o/a2ddf59d646a648a7e9565a94a581c18/libfreetype.a /root/ghostty/.zig-cache/o/65784ee1cfa8959b2f4c4cb9f15b99f2/libfreetype.a /root/ghostty/.zig-cache/o/0aa7682ab00c64ef95ca45caad969b99/libxml2.a /root/ghostty/.zig-cache/o/225026491713707dadc389649a6f66f9/libz.a /root/ghostty/.zig-cache/o/72c87a63f45a4be0156977fc8c3c048b/libbreakpad.a /root/ghostty/.zig-cache/o/a2ddf59d646a648a7e9565a94a581c18/libfreetype.a -OReleaseFast -Mmacos=/root/ghostty/pkg/macos/main.zig -OReleaseFast -Mcode_point=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/code_point.zig -OReleaseFast --dep code_point --dep GraphemeData -Mgrapheme=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/grapheme.zig -OReleaseFast --dep ascii --dep code_point --dep grapheme --dep DisplayWidthData -MDisplayWidth=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/DisplayWidth.zig -Mzigimg=/root/.cache/zig/p/1220dd654ef941fc76fd96f9ec6adadf83f69b9887a0d3f4ee5ac0a1a3e11be35cf5/zigimg.zig /root/ghostty/.zig-cache/o/225026491713707dadc389649a6f66f9/libz.a -OReleaseFast --dep gbp -MGraphemeData=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/GraphemeData.zig -OReleaseFast -Mascii=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/ascii.zig -OReleaseFast --dep dwp --dep GraphemeData -MDisplayWidthData=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/WidthData.zig -Mgbp=/root/ghostty/.zig-cache/o/ae6ae9710ec8bfc99c8a0236426737c8/gbp.bin.z -Mdwp=/root/ghostty/.zig-cache/o/78e95821bb1803b7cd96017ba8e51f4f/dwp.bin.z -lc++ -lc --cache-dir /root/ghostty/.zig-cache --global-cache-dir /root/.cache/zig --name ghostty --listen=- 
Build Summary: 80/83 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install ghostty transitive failure
   └─ zig build-exe ghostty ReleaseFast native failure
error: the following build command failed with exit code 1:
/root/ghostty/.zig-cache/o/ec2afc7cf8392813fdd4c51d06edb349/build /opt/zig-bin-0.13.0/zig /root/ghostty /root/ghostty/.zig-cache /root/.cache/zig --seed 0x86fee619 -Zddc4a125c37a2497 --release=fast -Dapp-runtime=gtk -Dgtk-adwaita=true
Comment 8 sin-ack 2024-12-29 06:08:52 UTC
Created attachment 915416 [details, diff]
Force pkg-config usage in build.zig

Okay, so I think this is either an issue with Zig or your particular system configuration. I've attached a patch; can you please apply it to the Ghostty source tree and see what it says? (expectation: "pkg-config failed for library gtk4")

If that's the case then you'll have to follow these steps to get more information:

1. Download the patch below.
2. Clone Zig 0.13:

    git clone https://github.com/ziglang/zig zig-0.13.0 -b 0.13.0
    cd zig-0.13.0

3. Apply the patch.
4. Build Ghostty using the patched std:

    cd ghostty
    zig build --zig-lib-dir path/to/zig-0.13.0/lib -Dapp-runtime=gtk -Dgtk-adwaita=true

This should give us more details about why pkg-config fails.
Comment 9 sin-ack 2024-12-29 06:09:23 UTC
Created attachment 915417 [details, diff]
Enable verbose pkg-config failures in zig stdlib
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-29 06:16:28 UTC
Why not have them patch zig via /etc/portage/patches?
Comment 11 Leo Douglas 2024-12-29 06:18:00 UTC
(In reply to sin-ack from comment #8)
> Created attachment 915416 [details, diff] [details, diff]
> Force pkg-config usage in build.zig
> 
> Okay, so I think this is either an issue with Zig or your particular system
> configuration. I've attached a patch; can you please apply it to the Ghostty
> source tree and see what it says? (expectation: "pkg-config failed for
> library gtk4")
> 
> If that's the case then you'll have to follow these steps to get more
> information:
> 
> 1. Download the patch below.
> 2. Clone Zig 0.13:
> 
>     git clone https://github.com/ziglang/zig zig-0.13.0 -b 0.13.0
>     cd zig-0.13.0
> 
> 3. Apply the patch.
> 4. Build Ghostty using the patched std:
> 
>     cd ghostty
>     zig build --zig-lib-dir path/to/zig-0.13.0/lib -Dapp-runtime=gtk
> -Dgtk-adwaita=true
> 
> This should give us more details about why pkg-config fails.

anyway, i got this:

# zig-bin-0.13.0 build --zig-lib-dir /root/zig-0.13.0/lib -Dapp-runtime=gtk -Dgtk-adwaita=true
Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xproto', required by 'x11', not found
Package 'kbproto', required by 'x11', not found
Package 'xextproto', required by 'xext', not found
Package 'xproto', required by 'xrender', not found
Package 'renderproto', required by 'xrender', not found
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found
install
+- install ghostty
   +- zig build-exe ghostty Debug native failure
error: error: unable to find dynamic system library 'gtk4' using strategy 'mode_first'. searched paths:
  /usr/lib/x86_64-linux-gnu/libgtk4.so
  /usr/local/lib64/libgtk4.so
  /usr/local/lib/libgtk4.so
  /usr/lib/x86_64-linux-gnu/libgtk4.so
  /lib64/libgtk4.so
  /lib/libgtk4.so
  /usr/lib64/libgtk4.so
  /usr/lib/libgtk4.so
  /lib/x86_64-linux-gnu/libgtk4.so
  /usr/lib/x86_64-linux-gnu/libgtk4.a
  /usr/local/lib64/libgtk4.a
  /usr/local/lib/libgtk4.a
  /usr/lib/x86_64-linux-gnu/libgtk4.a
  /lib64/libgtk4.a
  /lib/libgtk4.a
  /usr/lib64/libgtk4.a
  /usr/lib/libgtk4.a
  /lib/x86_64-linux-gnu/libgtk4.a

error: the following command exited with error code 1:
/opt/zig-bin-0.13.0/zig build-exe /root/ghostty/.zig-cache/o/0d892cf7915fd7be336ee43f6a608f21/libfreetype.a /root/ghostty/.zig-cache/o/c9316a427f7144704c8b109a69f97127/libharfbuzz.a /root/ghostty/.zig-cache/o/6d989f38b1395289e91569085a5cea2a/libfontconfig.a /root/ghostty/.zig-cache/o/42c41ab813219ad9d48cad36ef9b32fe/libpng.a /root/ghostty/.zig-cache/o/b855ce723ee15d88b8a19442f0b58394/libz.a /root/ghostty/.zig-cache/o/5137a5f458e5292f3522109286f7781b/liboniguruma.a /root/ghostty/.zig-cache/o/a8a83d69bcd7953b1937e49d4f660019/libglslang.a /root/ghostty/.zig-cache/o/68bef1cfcb314f1098ca6c5131562e21/libspirv_cross.a /root/ghostty/.zig-cache/o/1ce1d57524a6108190563c422abac759/libsimdutf.a /root/ghostty/.zig-cache/o/6cd9ba03391682ffd0aa045ee386fa28/libsentry.a /root/ghostty/src/stb/stb.c -cflags -DHWY_DISABLED_TARGETS=464 -- /root/ghostty/src/simd/base64.cpp /root/ghostty/src/simd/codepoint_width.cpp /root/ghostty/src/simd/index_of.cpp /root/ghostty/src/simd/vt.cpp /root/ghostty/.zig-cache/o/b9b43fd3d27f306ee9ed5c0681e65a0d/libcimgui.a /root/ghostty/.zig-cache/o/ea44bed52b802593b46c1a5f2f5d96e9/libhighway.a /root/ghostty/.zig-cache/o/fccc5da33feb61ab1c596a3861e4b25e/libutfcpp.a -cflags -- /root/ghostty/vendor/glad/src/gl.c -search_dylibs_first -lgtk4 -ladwaita-1 /root/ghostty/.zig-cache/o/186bdbd6c211006d6109ac1beba09814/ghostty_resources.c -fno-strip -ODebug -I /root/ghostty/.zig-cache/o/015dd18bd47de965175979132aa6c3c4 -I /root/ghostty/.zig-cache/o/013d509f10ef928ce6bf1772e3b7979f -I /root/ghostty/.zig-cache/o/2f2a648b3e2cc6e863e174b7bf8a39b6 -I /root/ghostty/.zig-cache/o/86c69efeb213127d2cdbdb2116fffffa -I /root/ghostty/.zig-cache/o/4854957d9535010714ef4d443401bade -I /root/ghostty/.zig-cache/o/b2c02eb667c2b5a9ee76b7059bd5e60b -I /root/ghostty/.zig-cache/o/55c59dab6f46c4bb5538507f2b8e87a5 -I /root/ghostty/.zig-cache/o/64ae27ef2bc71904e105a9d62007327f -I /root/ghostty/.zig-cache/o/339f052510751b64e191b2aead6b3aef -I /root/ghostty/.zig-cache/o/e48d180b733bd26459cf998600b83a31 -I /root/ghostty/src/stb -I /root/ghostty/src/apprt/gtk -I /root/ghostty/src -I /root/ghostty/.zig-cache/o/9e2bda7c9db45099ca7a80dfd665708e -I /root/ghostty/.zig-cache/o/eb793169750e01ad84a344359164a6fd -I /root/ghostty/.zig-cache/o/eb4c9e8423b7def0c115e4b6200537f2 -I /root/ghostty/vendor/glad/include -I /root/ghostty/.zig-cache/o/fdf7a319742ece99d23668f4f3420aa4 -L /usr/lib/x86_64-linux-gnu --dep build_options --dep freetype --dep harfbuzz --dep fontconfig --dep oniguruma --dep glslang --dep spirv_cross --dep sentry --dep opengl --dep vaxis --dep wuffs --dep xev --dep z2d --dep ziglyph --dep zf --dep cimgui --dep help_strings --dep unicode_tables -Mroot=/root/ghostty/src/main.zig -Mbuild_options=/root/ghostty/.zig-cache/c/46e311d46ab6d69db92265b52c987301/options.zig -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include -I /root/ghostty/pkg/freetype -Mfreetype=/root/ghostty/pkg/freetype/main.zig -ODebug -I /root/.cache/zig/p/1220b8588f106c996af10249bfa092c6fb2f35fbacb1505ef477a0b04a7dd1063122/src -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include --dep freetype --dep macos -Mharfbuzz=/root/ghostty/pkg/harfbuzz/main.zig -I /root/.cache/zig/p/12201149afb3326c56c05bb0a577f54f76ac20deece63aa2f5cd6ff31a4fa4fcb3b7 -I /root/ghostty/pkg/fontconfig/override/include -Mfontconfig=/root/ghostty/pkg/fontconfig/main.zig -I /root/.cache/zig/p/1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb/src -Moniguruma=/root/ghostty/pkg/oniguruma/main.zig -ODebug -I /root/.cache/zig/p/12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1 -I /root/ghostty/pkg/glslang/override -Mglslang=/root/ghostty/pkg/glslang/main.zig -I /root/.cache/zig/p/1220fb3b5586e8be67bc3feb34cbe749cf42a60d628d2953632c2f8141302748c8da -Mspirv_cross=/root/ghostty/pkg/spirv-cross/main.zig -ODebug -I /root/.cache/zig/p/1220446be831adcca918167647c06c7b825849fa3fba5f22da394667974537a9c77e/include -Msentry=/root/ghostty/pkg/sentry/main.zig -I /root/ghostty/vendor/glad/include -Mopengl=/root/ghostty/pkg/opengl/main.zig -ODebug --dep code_point --dep grapheme --dep DisplayWidth --dep zigimg -Mvaxis=/root/.cache/zig/p/12200df4ebeaed45de26cb2c9f3b6f3746d8013b604e035dae658f86f586c8c91d2f/src/main.zig -cflags -DWUFFS_IMPLEMENTATION -DWUFFS_CONFIG__MODULES -DWUFFS_CONFIG__MODULE__AUX__BASE -DWUFFS_CONFIG__MODULE__AUX__IMAGE -DWUFFS_CONFIG__MODULE__BASE -DWUFFS_CONFIG__MODULE__ADLER32 -DWUFFS_CONFIG__MODULE__CRC32 -DWUFFS_CONFIG__MODULE__DEFLATE -DWUFFS_CONFIG__MODULE__JPEG -DWUFFS_CONFIG__MODULE__PNG -DWUFFS_CONFIG__MODULE__ZLIB -- /root/.cache/zig/p/12200984439edc817fbcbbaff564020e5104a0d04a2d0f53080700827052de700462/release/c/wuffs-v0.4.c -ODebug -I /root/.cache/zig/p/12200984439edc817fbcbbaff564020e5104a0d04a2d0f53080700827052de700462/release/c -Mwuffs=/root/ghostty/pkg/wuffs/src/main.zig -Mxev=/root/.cache/zig/p/12206029de146b685739f69b10a6f08baee86b3d0a5f9a659fa2b2b66c9602078bbf/src/main.zig -ODebug -Mz2d=/root/.cache/zig/p/12201f0d542e7541cf492a001d4d0d0155c92f58212fbcb0d224e95edeba06b5416a/src/z2d.zig -Mziglyph=/root/.cache/zig/p/12207831bce7d4abce57b5a98e8f3635811cfefd160bca022eb91fe905d36a02cf25/src/ziglyph.zig -Mzf=/root/.cache/zig/p/1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8/src/zf/zf.zig -ODebug -I /root/.cache/zig/p/1220b81f6ecfb3fd222f76cf9106fecfa6554ab07ec7fdc4124b9bb063ae2adf969d/include -I /root/ghostty/pkg/cimgui/vendor -Mcimgui=/root/ghostty/pkg/cimgui/main.zig -Mhelp_strings=/root/ghostty/.zig-cache/o/bb982d767578d07ff857abc02557cdf9/stdout -Municode_tables=/root/ghostty/.zig-cache/o/b6e82f0c9d7d4cad6bfda1faf4f8fa04/stdout /root/ghostty/.zig-cache/o/b855ce723ee15d88b8a19442f0b58394/libz.a /root/ghostty/.zig-cache/o/42c41ab813219ad9d48cad36ef9b32fe/libpng.a /root/ghostty/.zig-cache/o/0d892cf7915fd7be336ee43f6a608f21/libfreetype.a /root/ghostty/.zig-cache/o/013aefd1da89d460b79cb43ca5d3351f/libfreetype.a /root/ghostty/.zig-cache/o/e84abee8ae467c2a989300b558998156/libxml2.a /root/ghostty/.zig-cache/o/b855ce723ee15d88b8a19442f0b58394/libz.a /root/ghostty/.zig-cache/o/29f2cfe487f14871e8b954269dcea66a/libbreakpad.a /root/ghostty/.zig-cache/o/0d892cf7915fd7be336ee43f6a608f21/libfreetype.a -ODebug -Mmacos=/root/ghostty/pkg/macos/main.zig -ODebug -Mcode_point=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/code_point.zig -ODebug --dep code_point --dep GraphemeData -Mgrapheme=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/grapheme.zig -ODebug --dep ascii --dep code_point --dep grapheme --dep DisplayWidthData -MDisplayWidth=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/DisplayWidth.zig -Mzigimg=/root/.cache/zig/p/1220dd654ef941fc76fd96f9ec6adadf83f69b9887a0d3f4ee5ac0a1a3e11be35cf5/zigimg.zig /root/ghostty/.zig-cache/o/b855ce723ee15d88b8a19442f0b58394/libz.a -ODebug --dep gbp -MGraphemeData=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/GraphemeData.zig -ODebug -Mascii=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/ascii.zig -ODebug --dep dwp --dep GraphemeData -MDisplayWidthData=/root/.cache/zig/p/122055beff332830a391e9895c044d33b15ea21063779557024b46169fb1984c6e40/src/WidthData.zig -Mgbp=/root/ghostty/.zig-cache/o/de434894cc9dd5709c3a338bdef2d6bf/gbp.bin.z -Mdwp=/root/ghostty/.zig-cache/o/879cac19c53dc8beb3cd2453695777ea/dwp.bin.z -lc++ -lc --cache-dir /root/ghostty/.zig-cache --global-cache-dir /root/.cache/zig --name ghostty --zig-lib-dir /root/zig-0.13.0/lib --listen=- 
Build Summary: 80/83 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
+- install ghostty transitive failure
   +- zig build-exe ghostty Debug native failure
error: the following build command failed with exit code 1:
/root/ghostty/.zig-cache/o/b80fedc3c3c820508755fed21b90799c/build /opt/zig-bin-0.13.0/zig /root/ghostty /root/ghostty/.zig-cache /root/.cache/zig --seed 0x41e6c0c1 -Z62487773fc5bd479 --zig-lib-dir /root/zig-0.13.0/lib -Dapp-runtime=gtk -Dgtk-adwaita=true
Comment 12 Leo Douglas 2024-12-29 06:21:29 UTC
we need xorg-proto as deps.
Comment 13 Leo Douglas 2024-12-29 06:22:59 UTC
non desktop profile has no x11-base/xorg-proto. after installing this package, the compilation succeeded.
Comment 14 sin-ack 2024-12-29 06:35:41 UTC
(In reply to Sam James from comment #10)
> Why not have them patch zig via /etc/portage/patches?

I forgot zig-bin was in use. I was trying to avoid a Zig rebuild (it takes quite a bit).

(In reply to Leo Douglas from comment #13)
> non desktop profile has no x11-base/xorg-proto. after installing this
> package, the compilation succeeded.

This is strange because you're building with USE="adwaita", and that pulls in
gui-libs/libadwaita which unconditionally depends on x11-base/xorg-proto.
Comment 15 Leo Douglas 2024-12-29 06:41:54 UTC
(In reply to sin-ack from comment #14)
> (In reply to Sam James from comment #10)
> > Why not have them patch zig via /etc/portage/patches?
> 
> I forgot zig-bin was in use. I was trying to avoid a Zig rebuild (it takes
> quite a bit).
> 
> (In reply to Leo Douglas from comment #13)
> > non desktop profile has no x11-base/xorg-proto. after installing this
> > package, the compilation succeeded.
> 
> This is strange because you're building with USE="adwaita", and that pulls in
> gui-libs/libadwaita which unconditionally depends on x11-base/xorg-proto.

It is indeed very strange, but I am using binhost and prioritizing the installation of binary packages instead of source compilation. Will this have any impact?
Comment 16 sin-ack 2024-12-29 06:48:09 UTC
(In reply to Leo Douglas from comment #15)
> It is indeed very strange, but I am using binhost and prioritizing the
> installation of binary packages instead of source compilation. Will this
> have any impact?

Oh, this is probably it, yes. libadwaita depends on xorg-proto only in DEPEND and not in RDEPEND. I'm not sure what the right course of action is, however: xorg-proto is not our direct dependency so I'd rather not include it directly as a BDEPEND. The Gentoo dev manual says that anything that needs to be found in the target system should be placed in DEPEND. I'm gonna see whether this gives us the correct dependencies when using binpkgs.
Comment 17 Leo Douglas 2024-12-29 07:29:17 UTC
(In reply to sin-ack from comment #16)
> (In reply to Leo Douglas from comment #15)
> > It is indeed very strange, but I am using binhost and prioritizing the
> > installation of binary packages instead of source compilation. Will this
> > have any impact?
> 
> Oh, this is probably it, yes. libadwaita depends on xorg-proto only in
> DEPEND and not in RDEPEND. I'm not sure what the right course of action is,
> however: xorg-proto is not our direct dependency so I'd rather not include
> it directly as a BDEPEND. The Gentoo dev manual says that anything that
> needs to be found in the target system should be placed in DEPEND. I'm gonna
> see whether this gives us the correct dependencies when using binpkgs.

I think the packaging of gtk and adwaita did not take binpkg into account, which should be considered a mistake. https://devmanual.gentoo.org/general-concepts/dependencies/#runtime-dependencies says:```Note that when installing from a binary package, only RDEPEND will be checked. It is therefore necessary to include items even if they are also listed in DEPEND. ``` , but the packaging of gtk and adwaita put rdepends into depends.
Comment 18 sin-ack 2024-12-29 07:35:25 UTC
(In reply to Leo Douglas from comment #17)
> I think the packaging of gtk and adwaita did not take binpkg into account,
> which should be considered a mistake.
> https://devmanual.gentoo.org/general-concepts/dependencies/#runtime-
> dependencies says:```Note that when installing from a binary package, only
> RDEPEND will be checked. It is therefore necessary to include items even if
> they are also listed in DEPEND. ``` , but the packaging of gtk and adwaita
> put rdepends into depends.

GTK and Adwaita do not need xorg-proto at runtime, so I think its placement in DEPEND is correct. I think there's another solution needed here.

Tangentially, I just nuked and re-created my chroot with the stage3 systemd tarball and tried to use binpkgs only, and I'm unable to get the system into a state where xorg-proto is not pulled in even with binpkgs. Are you sure that it's not being automatically pulled in? What does your /var/lib/portage/world contain? At this point I'm starting to suspect something funky is going on with your system.
Comment 19 Leo Douglas 2024-12-29 07:39:12 UTC
(In reply to sin-ack from comment #18)
> (In reply to Leo Douglas from comment #17)
> > I think the packaging of gtk and adwaita did not take binpkg into account,
> > which should be considered a mistake.
> > https://devmanual.gentoo.org/general-concepts/dependencies/#runtime-
> > dependencies says:```Note that when installing from a binary package, only
> > RDEPEND will be checked. It is therefore necessary to include items even if
> > they are also listed in DEPEND. ``` , but the packaging of gtk and adwaita
> > put rdepends into depends.
> 
> GTK and Adwaita do not need xorg-proto at runtime, so I think its placement
> in DEPEND is correct. I think there's another solution needed here.
> 
> Tangentially, I just nuked and re-created my chroot with the stage3 systemd
> tarball and tried to use binpkgs only, and I'm unable to get the system into
> a state where xorg-proto is not pulled in even with binpkgs. Are you sure
> that it's not being automatically pulled in? What does your
> /var/lib/portage/world contain? At this point I'm starting to suspect
> something funky is going on with your system.

I use systemd-nspawn to create a stage3 chroot: https://wiki.gentoo.org/wiki/User:Ajak/systemd-nspawn_for_Development_and_Update_Automation . if GTK and Adwaita do not need xorg-proto at runtime, why its deps are written to DEPEND not BDEPEND? My understanding is that if a dependency is written into DEPEND, then it belongs to both build-time and run-time dependencies, right?
Comment 20 sin-ack 2024-12-29 07:46:14 UTC
(In reply to Leo Douglas from comment #19)
> I use systemd-nspawn to create a stage3 chroot:

Hmm, I'm unable to test with this setup as my host machine uses OpenRC, although I doubt it's fundamentally different from a regular chroot so I don't think it matters here.

> if GTK and Adwaita do not
> need xorg-proto at runtime, why its deps are written to DEPEND not BDEPEND?
> My understanding is that if a dependency is written into DEPEND, then it
> belongs to both build-time and run-time dependencies, right?

The dev manual says:

> Starting with EAPI 7, build dependencies are split into two variables:
> BDEPEND and DEPEND. BDEPEND specifies dependencies applicable to CBUILD,
> i.e. programs that need to be executed during the build, e.g.
> virtual/pkgconfig. DEPEND specifies dependencies for CHOST, i.e.
> packages that need to be found on built system, e.g. libraries and
> headers.

In this particular case, xorg-proto is needed in DEPEND and not BDEPEND because its .pc file specifies which libraries to use and where to find them in CHOST, i.e. what the package is built to target. You can think of it as one machine building a package for another, and the target is the one that needs to provide its configuration so that the build machine can know what to link against.

Anyway, Sam just said this on IRC:

<@sam_> this is "we need a BADEPEND" again
<@sam_> every ebuild here is kind of correct 
<@sam_> however
<@sam_> until we have build-against-depend
<@sam_> gtk should probably have xorg-proto in RDEPEND

I'll make a patch for this.
Comment 21 Leo Douglas 2024-12-29 09:58:10 UTC
(In reply to sin-ack from comment #20)
> (In reply to Leo Douglas from comment #19)
> > I use systemd-nspawn to create a stage3 chroot:
> 
> Hmm, I'm unable to test with this setup as my host machine uses OpenRC,
> although I doubt it's fundamentally different from a regular chroot so I
> don't think it matters here.
> 
> > if GTK and Adwaita do not
> > need xorg-proto at runtime, why its deps are written to DEPEND not BDEPEND?
> > My understanding is that if a dependency is written into DEPEND, then it
> > belongs to both build-time and run-time dependencies, right?
> 
> The dev manual says:
> 
> > Starting with EAPI 7, build dependencies are split into two variables:
> > BDEPEND and DEPEND. BDEPEND specifies dependencies applicable to CBUILD,
> > i.e. programs that need to be executed during the build, e.g.
> > virtual/pkgconfig. DEPEND specifies dependencies for CHOST, i.e.
> > packages that need to be found on built system, e.g. libraries and
> > headers.
> 
> In this particular case, xorg-proto is needed in DEPEND and not BDEPEND
> because its .pc file specifies which libraries to use and where to find them
> in CHOST, i.e. what the package is built to target. You can think of it as
> one machine building a package for another, and the target is the one that
> needs to provide its configuration so that the build machine can know what
> to link against.
> 
> Anyway, Sam just said this on IRC:
> 
> <@sam_> this is "we need a BADEPEND" again
> <@sam_> every ebuild here is kind of correct 
> <@sam_> however
> <@sam_> until we have build-against-depend
> <@sam_> gtk should probably have xorg-proto in RDEPEND
> 
> I'll make a patch for this.

Say a bit more, how to understand this BADEPEND, does it mean that gtk depends on xproto when building as ghostty, if there is such an option?
Comment 22 sin-ack 2024-12-29 10:09:02 UTC
(In reply to Leo Douglas from comment #21)
> Say a bit more, how to understand this BADEPEND, does it mean that gtk
> depends on xproto when building as ghostty, if there is such an option?

Ghostty depends on GTK, and to find its dependencies it uses pkg-config
(pkgconf being the de-facto implementation on Gentoo). GTK installs a
file called gtk4.pc. This file references other .pc files, which recursively creates a dependency tree of all the libraries and include paths you need in
order to successfully build a binary against GTK. These .pc files are not
required at runtime; however, most of the .pc files are part of packages
which also have runtime components (e.g. shared objects) so they are placed
in RDEPEND. xorg-proto is an exception in that it is a header-only library;
it has no runtime components so there's no reason to install it if you only
use binary packages, and thus it is placed in DEPEND. However, there is an
edge case which isn't handled in this setup: If you install a binary package,
and then try to build a source package against that binary package, you will
need dependencies part of DEPEND as well. This is the edge case we're hitting
here. The solution is to have a new kind of dependency that gets pulled in
when a source package depends on a binary package, which is the proposed
BADEPEND.
Comment 23 Leo Douglas 2024-12-29 10:40:03 UTC
(In reply to sin-ack from comment #22)
> (In reply to Leo Douglas from comment #21)
> > Say a bit more, how to understand this BADEPEND, does it mean that gtk
> > depends on xproto when building as ghostty, if there is such an option?
> 
> Ghostty depends on GTK, and to find its dependencies it uses pkg-config
> (pkgconf being the de-facto implementation on Gentoo). GTK installs a
> file called gtk4.pc. This file references other .pc files, which recursively
> creates a dependency tree of all the libraries and include paths you need in
> order to successfully build a binary against GTK. These .pc files are not
> required at runtime; however, most of the .pc files are part of packages
> which also have runtime components (e.g. shared objects) so they are placed
> in RDEPEND. xorg-proto is an exception in that it is a header-only library;
> it has no runtime components so there's no reason to install it if you only
> use binary packages, and thus it is placed in DEPEND. However, there is an
> edge case which isn't handled in this setup: If you install a binary package,
> and then try to build a source package against that binary package, you will
> need dependencies part of DEPEND as well. This is the edge case we're hitting
> here. The solution is to have a new kind of dependency that gets pulled in
> when a source package depends on a binary package, which is the proposed
> BADEPEND.

Thank you very much for the detailed explanation of this edge case, it deepened my understanding of the dependencies. Thanks again.
Comment 24 Leo Douglas 2024-12-29 12:01:02 UTC
I found that this has been an old issue for binary distributions, such as Arch: https://gitlab.archlinux.org/archlinux/packaging/packages/libx11/-/blob/main/PKGBUILD?ref_type=heads#L9 , around 2019, xproto was made a runtime dependency to avoid annoying build issues. This dependency conflict was only mitigated because the support for gentoo binpkg was slowly rolled out.
Comment 25 Larry the Git Cow gentoo-dev 2025-01-13 03:54:17 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2c8a65fb6252b1c1b974d6a9bdd46a1309d8dd7

commit c2c8a65fb6252b1c1b974d6a9bdd46a1309d8dd7
Author:     sin-ack <sin-ack@protonmail.com>
AuthorDate: 2024-12-29 09:02:09 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2025-01-13 03:54:10 +0000

    x11-libs/libX11: RDEPEND on x11-base/xorg-proto
    
    Without this, source packages fail to build against libX11 when
    installed as a binpkg due to missing transitive dependencies.
    
    Closes: https://bugs.gentoo.org/903707
    Closes: https://bugs.gentoo.org/947059
    Closes: https://bugs.gentoo.org/947999
    Closes: https://github.com/gentoo/gentoo/pull/39886
    Signed-off-by: sin-ack <sin-ack@protonmail.com>
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 .../libX11/{libX11-1.8.10.ebuild => libX11-1.8.10-r1.ebuild}     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)