capy-ui / capy

💻Build one codebase and get native UI on Windows, Linux and Web
https://capy-ui.org
Mozilla Public License 2.0
1.6k stars 60 forks source link

Can't compile on ubuntu specifying x86_64-linux-gnu #87

Open josuigoa opened 2 months ago

josuigoa commented 2 months ago

Hi!

first of all, thank you for creating capy, I'm very excited about it!

I'm on Ubuntu 22.10 and I've ran the default application from zig-template in ubuntu using zig build run with no problem, very nice!

But, if I run zig build -Dtarget=x86_64-linux-gnu, I have this output:

warning: 'many-counters' is broken (disabled by default)
install
└─ install capy-template
   └─ zig build-exe capy-template Debug x86_64-linux-gnu failure
error: error: unable to find dynamic system library 'gtk-4' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'pangocairo-1.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'pango-1.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'harfbuzz' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'gdk_pixbuf-2.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'cairo-gobject' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'cairo' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'graphene-1.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'gio-2.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'gobject-2.0' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'glib-2.0' using strategy 'paths_first'. searched paths: none

error: the following command exited with error code 1:
/home/josu/development/zig-linux-x86_64/zig build-exe -ODebug -target x86_64-linux-gnu -mcpu baseline --dep capy -Mroot=/home/josu/git/zig-template/src/main.zig -I/usr/include/gtk-4.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/graphene-1.0 -I/usr/lib/x86_64-linux-gnu/graphene-1.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -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 -ODebug -target x86_64-linux-gnu -mcpu baseline --dep zigimg -Mcapy=/home/josu/.cache/zig/p/1220d8f9dd36cf19cbbee3cc87d7ec89eafb6f262eff9ee784ee2095c82c465f57f3/src/main.zig -Mzigimg=/home/josu/.cache/zig/p/1220dc313944ea71a87b4f54f26b1427ad2992a721a221cb42f7f80b8eee4e4944b7/zigimg.zig -lc --cache-dir /home/josu/git/zig-template/.zig-cache --global-cache-dir /home/josu/.cache/zig --name capy-template --subsystem native --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install capy-template transitive failure
   └─ zig build-exe capy-template Debug x86_64-linux-gnu failure
error: the following build command failed with exit code 1:
/home/josu/git/zig-template/.zig-cache/o/7bbab9f4678b5c76046456d10e52a20f/build /home/josu/development/zig-linux-x86_64/zig /home/josu/git/zig-template /home/josu/git/zig-template/.zig-cache /home/josu/.cache/zig --seed 0x63eb04ba -Zef1b1e51c8ceea4b -Dtarget=x86_64-linux-gnu

Is it an error of capy or is more zig thing?

thanks in advance

zenith391 commented 2 months ago

It's more of a Capy error. When you add -Dtarget=x86_64-linux-gnu you make Zig use a barebones Linux environment, which doesn't include the GTK+ 4 development libraries that Capy requires.

Long term, I plan to make it so Capy compiles GTK+ 4 itself using the Zig build system (so it doesn't depend on the development libraries) but the GTK build process is quite complex and requires a LOT of libraries, which means I end up having to convert a dozen of projects to use the Zig build system (which is very time-consuming). This hasn't been high on my priority list so far, so, I haven't implemented it yet.