foxnne / pixi

Pixel art editor made with Zig.
https://foxnne.github.io/pixi/
MIT License
738 stars 23 forks source link

Problems building on Linux #37

Closed mlaass closed 11 months ago

mlaass commented 12 months ago

Hi, I tried to build on Linux, but so far no success. The problem seems to be in the compilation of the src/deps/zip/src/zip.c file. I tried to play around with the compiler flags in src/deps/zip/build.zig, but so far I didn't have success.

Building with --verbose gives the following output:

zig build-exe pixi Debug native: error: error(compilation): clang failed with stderr: In file included from /home/moritz/workspace/pixi/src/deps/zip/src/zip.c:39:
/home/moritz/workspace/pixi/src/deps/zip/src/miniz.h:4988:9: warning: Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files. [-W#pragma-messages]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:328:16: error: call to undeclared function 'fileno'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:329:14: error: call to undeclared function 'ftruncate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:430:11: error: call to undeclared function 'symlink'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1596:62: error: use of undeclared identifier 'S_ISVTX'
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1609:7: error: call to undeclared function 'S_ISSOCK'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1612:28: error: use of undeclared identifier 'S_IFMT'
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1612:39: error: use of undeclared identifier 'S_IFDIR'
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1995:64: error: use of undeclared identifier 'S_ISVTX'
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:2008:9: error: call to undeclared function 'S_ISSOCK'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:2011:30: error: use of undeclared identifier 'S_IFMT'
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:2011:41: error: use of undeclared identifier 'S_IFDIR'

zig build-exe pixi Debug native: error: the following command failed with 1 compilation errors:
/home/moritz/.zvm/0.11.0/zig build-exe /home/moritz/.cache/zig/p/12206e93994d37b3ce5c790e391736130f2a26bec06eca01ca51ab08a6d8105ab7f9/src/platform/native/main.zig /home/moritz/workspace/pixi/zig-cache/o/24b413b1ee93732ef819956cbc15e503/libglfw.a /home/moritz/workspace/pixi/zig-cache/o/866ee5f3cd50f6a21b2eaf412d05620d/libvulkan-headers.a /home/moritz/workspace/pixi/zig-cache/o/d91e3cdb1eebcfa48768a0283e3a5ce3/libx11-headers.a /home/moritz/workspace/pixi/zig-cache/o/a73a6e599325954e781c94589ebc6a22/libwayland-headers.a /home/moritz/workspace/pixi/zig-cache/o/6368440c09a64a737825bb496b5dfd1e/libvulkan-headers.a /home/moritz/workspace/pixi/zig-cache/o/7131266b8d63acd3a8dfb32082645086/libx11-headers.a /home/moritz/workspace/pixi/zig-cache/o/ddb3369925ede10e1a61d7ada6557a63/libwayland-headers.a -cflags -std=c++17 -- /home/moritz/.cache/zig/p/12209e517b8b459b95fb66f045580a66f8901970e7416f2ae90613df63adb710e19c/src/mach_dawn.cpp /home/moritz/workspace/pixi/zig-cache/o/1e610ab9854fd7e7cc42c5fa99f41699/libnfd.a -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -latk-1.0 -lgobject-2.0 -lglib-2.0 -I/usr/include/gtk-3.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/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lglib-2.0 -lgtk-3 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgobject-2.0 -lglib-2.0 /home/moritz/workspace/pixi/zig-cache/o/8f63f04e226365b5cf6b4137a17f2df2/libzstbi.a /home/moritz/workspace/pixi/zig-cache/o/cd7bc3bc83f85d578a4e400e721a4f6d/libzgui.a -ldawn -cflags -std=c99 -fno-sanitize=undefined -Wno-error -- /home/moritz/workspace/pixi/src/deps/zip/src/zip.c -ldawn -lc++ -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name pixi --mod mach-glfw::/home/moritz/.cache/zig/p/122002e355cf42b8d257efc95229c9ee6be4cca189c1718f86179cb7c21225beeb75/src/main.zig --mod zmath_options::/home/moritz/workspace/pixi/zig-cache/c/e509c24c6875314c018ffd153187081b/options.zig --mod gamemode::/home/moritz/.cache/zig/p/12207678927df42d7895a72fc220a5a18e21f241b42ca6cb6c1c3004a54bdd314d1d/src/main.zig --mod gpu::/home/moritz/.cache/zig/p/12209e517b8b459b95fb66f045580a66f8901970e7416f2ae90613df63adb710e19c/src/main.zig --mod app:core,zstbi,zmath,zgui,nfd=nfd0,zip:/home/moritz/workspace/pixi/src/pixi.zig --mod core:gpu,glfw=mach-glfw,gamemode:/home/moritz/.cache/zig/p/12206e93994d37b3ce5c790e391736130f2a26bec06eca01ca51ab08a6d8105ab7f9/src/main.zig --mod nfd0::/home/moritz/workspace/pixi/src/deps/nfd-zig/src/lib.zig --mod zstbi::/home/moritz/workspace/pixi/src/deps/zig-gamedev/zstbi/src/zstbi.zig --mod nfd::/home/moritz/workspace/pixi/src/deps/nfd-zig/src/lib.zig --mod zgui:zgui_options:/home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/src/main.zig --mod zip::/home/moritz/workspace/pixi/src/deps/zip/zip.zig --mod zgui_options::/home/moritz/workspace/pixi/zig-cache/c/2723cee70181f1b014942fd461e32628/options.zig --mod zmath:zmath_options:/home/moritz/workspace/pixi/src/deps/zig-gamedev/zmath/src/main.zig --deps glfw=mach-glfw,gamemode,core,app,mach-glfw,zstbi,zgui,zmath,nfd,zip -I /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/include -I /home/moritz/workspace/pixi/zig-cache/i/167f9d52e604e61f23eea80a2b9e971a/include -I /home/moritz/workspace/pixi/zig-cache/i/14b46a3e15be19157371235065e51d6b/include -I /home/moritz/workspace/pixi/zig-cache/i/899bf3d5091aaceefe8404027451dafd/include -I /home/moritz/workspace/pixi/zig-cache/i/23b3b26164c3d2226e55e8631241c626/include -I /home/moritz/.cache/zig/p/12209e517b8b459b95fb66f045580a66f8901970e7416f2ae90613df63adb710e19c/src -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/src -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/backends -I /home/moritz/workspace/pixi/src/deps/zip/src -I /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/include -I /home/moritz/.cache/zig/p/122000a081af36ea3c216b7514c390a287b26df1e8d3b1f83b951ab319b51e34acb8/src/dawn -L /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/x86_64-linux-gnu/release-fast --main-pkg-path /home/moritz/.cache/zig/p/12206e93994d37b3ce5c790e391736130f2a26bec06eca01ca51ab08a6d8105ab7f9/src -fno-lto --listen=- 
Build Summary: 31/36 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
├─ install pixi transitive failure
│  └─ zig build-exe pixi Debug native 1 errors
└─ pixi transitive failure
   └─ install pixi transitive failure
      └─ zig build-exe pixi Debug native (+22 more reused dependencies)
/home/moritz/workspace/pixi/src/deps/zip/src/zip.c:1:1: error: unable to build C object: clang exited with code 1

I'm using zig v0.11.0 and run a pretty standard ubuntu 22.04 installation. Any help in resolving this would be greatly appreciated.

foxnne commented 12 months ago

Hello!

Sorry for the trouble getting it to run. I've had a few reports of people on Linux getting it to run fine, but I don't personally currently have a Linux machine to test. I plan on setting one up very soon, so I can test properly. I will say that the version of Zig I'm using is 0.12.0-dev.415+5af5d87ad, a little newer than 0.11.0. I will try to set up Ubuntu on another laptop this weekend if I can and see if I can resolve this.

In the meantime, if anyone here has had success running Pixi on Linux, please let us know what you had to do to get it to build!

foxnne commented 12 months ago

In the meantime, removing "-std=c99" from the cflags in build.zig for the zip library seems to get us past those errors. I'm just using WSL2 on windows though and after that hit this issue, but I don't know if that is just because I'm on WSL2.

root@foxnne-desktop:~/dev/pixi# zig build run
zig build-exe pixi Debug native: error: warning(link): unexpected LLD stderr:
ld.lld: warning: /root/dev/pixi/zig-cache/o/be04080192400bba899b7d1ce08fea66/libzgui.a: archive member '/root/dev/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/x86_64-linux-gnu/release-fast/libdawn.a' is neither ET_REL nor LLVM bitcode

Warning: Couldn't load Vulkan. Searched /root/dev/pixi/zig-out/bin/libvulkan.so.1, /root/dev/pixi/zig-out/bin/libvulkan.so.1, libvulkan.so.1.
    at operator() (/home/runner/work/mach-gpu-dawn/mach-gpu-dawn/libs/dawn/src/dawn/native/vulkan/BackendVk.cpp:299)
    at Initialize (/home/runner/work/mach-gpu-dawn/mach-gpu-dawn/libs/dawn/src/dawn/native/vulkan/BackendVk.cpp:304)
    at Create (/home/runner/work/mach-gpu-dawn/mach-gpu-dawn/libs/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
    at operator() (/home/runner/work/mach-gpu-dawn/mach-gpu-dawn/libs/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)

error(mach): no backend found for CPU adapter
run pixi: error: the following command exited with error code 1:
/root/dev/pixi/zig-out/bin/pixi
Build Summary: 34/36 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run pixi failure
error: the following build command failed with exit code 1:
/root/dev/pixi/zig-cache/o/0782fad0ff632712af3729449642b96d/build /root/.zvm/master/zig /root/dev/pixi /root/dev/pixi/zig-cache /root/.cache/zig run

Just as a note, I also had to install gtk3 to get this far.

Edit: I just pushed a change that removes the c99 flag of you want to pull and try again.

mlaass commented 12 months ago

The reason I was using 0.11.0 is that with 0.12.0-dev.790+ad6f8e3a5 which is the latest, I got error: invalid builtin function: '@fabs' in a bunch of files, which I guess is another issue.

I tried removing the c99 flag which now gives me a linker error. I had to revert back to commit 8b76663 as your latest commit tells me that mach_gpu_dawn is not defined in build.zig.zon

Here is the linker error:

zig build-exe pixi Debug native: error: warning(link): unexpected LLD stderr:
ld.lld: warning: /home/moritz/workspace/pixi/zig-cache/o/7dd919ebbbc0abe3d37a2b4526b82c4e/libzgui.a: archive member '/home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-5aca0bf/x86_64-linux-gnu/release-fast/libdawn.a' is neither ET_REL nor LLVM bitcode
foxnne commented 12 months ago

Understood, I just don't know if 0.11.0 will build at all. I know its annoying to have to use a different version but I just updated mach-core to the latest, so as soon as mach-core supports the latest nightly I'll update again to capture the fabs changes.

Strange, when I just try zig build, I hit the same linker error on the first build, but it successfully builds on the second attempt. Maybe try a second time? Seems something goes wrong with it downloading the dawn dependency.

Also, I didn't have any issue with mach_gpu_dawn not being found. Maybe delete zig-cache and then try building three times? I just started from my latest commit and it took three build attempts to successfully build for some reason...

foxnne commented 12 months ago

Also, sorry for the lousy experience trying to build, you are the first to file any issue with respect to Linux so I haven't had a chance to work through these issues.

mlaass commented 12 months ago

Ok great, I got it to build with the latest version, and running build twice actually does the job. I had to change @fabs to @abs though and another small tweak.

But now it crashes on run:

 zig build run --verbose
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/1220371a61d8bb57fce8ee1741f623cc19b0edd7d1b4adc9918663f8a7ef08aa4f3f/stub.c -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name x11-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/12209aeba80369fa8638b82179b47e6742adb98a3a5b01bc518565504a922baad3e4/stub.c --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name vulkan-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/12205bd95b9cc9cb08dd6b55f5842d8fae67a12eed01092c54f021060931815f711e/stub.c -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name x11-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/1220a8b642edf8ef522e468cfe9a1803507472461b1041be717294ca484d1361afb0/stub.c --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name vulkan-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/12202cf6230788d948e5ee2afa26d4f6cc4994ae1bf0c1c832535b920717a1174223/stub.c --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name wayland-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/.cache/zig/p/12206781cb884fc8e524e90bea3c4a451e1dc78761b534f5dfb40973771a2fd07c22/stub.c --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name wayland-headers -static --listen=- 
/home/moritz/.zvm/master/zig build-lib -cflags -std=c99 -fno-sanitize=undefined -g -O0 -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zstbi/libs/stbi/stb_image.c -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name zstbi -static --listen=- 
/home/moritz/.zvm/master/zig build-lib -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/src/zgui.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui_widgets.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui_tables.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui_draw.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui_demo.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/implot_demo.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/implot.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/implot_items.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/imgui_impl_mach.cpp -ldawn -lc++ -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name zgui -static -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/backends -I /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/include -I /home/moritz/.cache/zig/p/122037f1ecd3b4b4da9bb1b0507984d1d5286720ca8a39d562c3b6178d6dfdd199e4/src/dawn -L /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/x86_64-linux-gnu/release-fast --listen=- 
/home/moritz/.zvm/master/zig build-lib -cflags -D_GLFW_X11 -D_GLFW_WAYLAND -Wno-implicit-function-declaration -Isrc -- /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/context.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/egl_context.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/init.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/input.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/monitor.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/null_init.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/null_joystick.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/null_monitor.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/null_window.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/osmesa_context.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/platform.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/vulkan.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/window.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/linux_joystick.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/posix_module.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/posix_poll.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/posix_thread.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/posix_time.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/xkb_unicode.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/glx_context.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/x11_init.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/x11_monitor.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/x11_window.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/wl_init.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/wl_monitor.c /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/src/wl_window.c -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name glfw -static -I /home/moritz/workspace/pixi/zig-cache/i/65ddddad7be3fb569f6cd125c24b9c71/include -I /home/moritz/workspace/pixi/zig-cache/i/6027fb74de22350b4ddfaf91f358b82b/include -I /home/moritz/workspace/pixi/zig-cache/i/a98df7124717bee56f72c5b64815e3cf/include -D WL_MARSHAL_FLAG_DESTROY=1 --listen=- 
/home/moritz/.zvm/master/zig build-lib /home/moritz/workspace/pixi/src/deps/nfd-zig/src/lib.zig -cflags -m64 -g -Wall -Wextra -fno-exceptions -- /home/moritz/workspace/pixi/src/deps/nfd-zig/nativefiledialog/src/nfd_common.c -cflags -m64 -g -Wall -Wextra -fno-exceptions -- /home/moritz/workspace/pixi/src/deps/nfd-zig/nativefiledialog/src/nfd_gtk.c -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -latk-1.0 -lgobject-2.0 -lglib-2.0 -I/usr/include/gtk-3.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/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lglib-2.0 -lgtk-3 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgobject-2.0 -lglib-2.0 -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name nfd -static -I /home/moritz/workspace/pixi/src/deps/nfd-zig/nativefiledialog/src/include --listen=- 
/home/moritz/.zvm/master/zig build-exe /home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/platform/native/main.zig /home/moritz/workspace/pixi/zig-cache/o/b283f5e8b317575debd8fa786ebfc0f7/libglfw.a /home/moritz/workspace/pixi/zig-cache/o/7e5e087fe9cfd4eb1370a04c43952150/libvulkan-headers.a /home/moritz/workspace/pixi/zig-cache/o/5b136d324627cbbfac5e810c8584beae/libx11-headers.a /home/moritz/workspace/pixi/zig-cache/o/9f4f18db14238d2bf47f99de181c5ce0/libwayland-headers.a /home/moritz/workspace/pixi/zig-cache/o/6b6b149ce840beceb0f94a089c48df17/libvulkan-headers.a /home/moritz/workspace/pixi/zig-cache/o/5c90d59583310b40816f8bd0f577bbda/libx11-headers.a /home/moritz/workspace/pixi/zig-cache/o/75c5d640e8c40a8b48184907ab3643d2/libwayland-headers.a -ldawn -cflags -std=c++17 -- /home/moritz/.cache/zig/p/1220f784698f085674f8c083e9a58728772e35b563c88c43eaecae94bba15cbf2655/src/mach_dawn.cpp /home/moritz/workspace/pixi/zig-cache/o/9d56a1cabe0a5fb53687919c99f79e14/libnfd.a -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -latk-1.0 -lgobject-2.0 -lglib-2.0 -I/usr/include/gtk-3.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/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgobject-2.0 -lglib-2.0 -lgtk-3 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgobject-2.0 -lglib-2.0 /home/moritz/workspace/pixi/zig-cache/o/4c575b0ccec910c0d7364a8d7fefc0ee/libzstbi.a /home/moritz/workspace/pixi/zig-cache/o/6b0a0108fc10e912aba8bfe59ba252cf/libzgui.a -ldawn -cflags -fno-sanitize=undefined -- /home/moritz/workspace/pixi/src/deps/zip/src/zip.c -lc++ -lc --cache-dir /home/moritz/workspace/pixi/zig-cache --global-cache-dir /home/moritz/.cache/zig --name pixi --mod mach-gamemode::/home/moritz/.cache/zig/p/12207678927df42d7895a72fc220a5a18e21f241b42ca6cb6c1c3004a54bdd314d1d/src/main.zig --mod vulkan::/home/moritz/.cache/zig/p/1220789870c34138932c186f50662909b0a3522fb9ea04f7b1c1a1253c5cd5fedc05/vk.zig --mod zmath:zmath_options:/home/moritz/workspace/pixi/src/deps/zig-gamedev/zmath/src/main.zig --mod app:mach-core,zstbi,zmath,zgui,nfd=nfd0,zip:/home/moritz/workspace/pixi/src/pixi.zig --mod zip::/home/moritz/workspace/pixi/src/deps/zip/zip.zig --mod zmath_options::/home/moritz/workspace/pixi/zig-cache/c/322847bed33f9f46fe02acd382f579df/options.zig --mod nfd::/home/moritz/workspace/pixi/src/deps/nfd-zig/src/lib.zig --mod mach-glfw::/home/moritz/.cache/zig/p/122002e355cf42b8d257efc95229c9ee6be4cca189c1718f86179cb7c21225beeb75/src/main.zig --mod mach-core:mach-gpu=gpu,mach-glfw,mach-dusk,mach-gamemode,mach-sysjs:/home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/main.zig --mod objc::/home/moritz/.cache/zig/p/1220d0b67b994c7e0d3c4a91d9541c50b294746602e163ce0728c62b1dbeed450a02/src/main.zig --mod gpu::/home/moritz/.cache/zig/p/1220f784698f085674f8c083e9a58728772e35b563c88c43eaecae94bba15cbf2655/src/main.zig --mod nfd0::/home/moritz/workspace/pixi/src/deps/nfd-zig/src/lib.zig --mod zgui:zgui_options:/home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/src/main.zig --mod mach-dusk:vulkan,gpu,objc:/home/moritz/.cache/zig/p/122088c2bdb79ffbbdd4c3b9f5c71b09625a7d2ab5980b101078622fd40a353f6f34/src/main.zig --mod mach-sysjs::/home/moritz/.cache/zig/p/1220187935c4c5d4cf824927df28e858dcd06cb864bb5d6be4cd349d2836abb4aec4/src/main.zig --mod zgui_options::/home/moritz/workspace/pixi/zig-cache/c/472ef375ab16b4c533b76a5dcad089be/options.zig --mod zstbi::/home/moritz/workspace/pixi/src/deps/zig-gamedev/zstbi/src/zstbi.zig --deps mach-core,app,zstbi,zgui,zmath,nfd,zip -I /home/moritz/.cache/zig/p/12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d/include -I /home/moritz/workspace/pixi/zig-cache/i/2246498d454b1a4906403a8e0e622c63/include -I /home/moritz/workspace/pixi/zig-cache/i/92a2310b172ca67ef02658b30d2ef196/include -I /home/moritz/workspace/pixi/zig-cache/i/1c59b9da8293d3351dc47df4ba4a8242/include -I /home/moritz/workspace/pixi/zig-cache/i/dc2b4e77e24c47fc81a3a1ad27ca9b8a/include -I /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/include -I /home/moritz/.cache/zig/p/12200c2a99cff65ef438c9650f8a50063d074aadd031d16e7274f4b582d9259133d4/src/dawn -I /home/moritz/.cache/zig/p/1220f784698f085674f8c083e9a58728772e35b563c88c43eaecae94bba15cbf2655/src -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/src -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui -I /home/moritz/workspace/pixi/src/deps/zig-gamedev/zgui/libs/imgui/backends -I /home/moritz/workspace/pixi/src/deps/zip/src -L /home/moritz/workspace/pixi/zig-cache/mach/gpu-dawn/release-d7b308b/x86_64-linux-gnu/release-fast --main-pkg-path /home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src -fno-lto --listen=- 
/home/moritz/workspace/pixi/zig-out/bin/pixi 
info(mach): found Vulkan backend on Integrated GPU adapter: Intel(R) UHD Graphics 630 (CFL GT2), Intel open-source Mesa driver: Mesa 23.0.4-0ubuntu1~22.04.1

error(gpa): memory address 0x7f115cace000 leaked: 
/home/moritz/.zvm/master/lib/std/fifo.zig:125:54: 0xbfe874 in ensureTotalCapacity (pixi)
                self.buf = try self.allocator.realloc(self.buf, new_size);
                                                     ^
/home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/platform/native/Core.zig:272:35: 0xc01330 in init (pixi)
    try events.ensureTotalCapacity(2048);
                                  ^
/home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/main.zig:155:27: 0xc04690 in init (pixi)
    try platform.Core.init(
                          ^
/home/moritz/workspace/pixi/src/pixi.zig:119:18: 0xc0aa3a in init (pixi)
    try core.init(.{
                 ^
/home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/platform/native/main.zig:36:17: 0xc10e87 in main (pixi)
    try app.init();
                ^
/home/moritz/.zvm/master/lib/std/start.zig:486:37: 0xc11b4e in main (pixi)
    std.os.argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@as(usize, @intCast(c_argc))];
                                    ^

error: ImageInitFailed
/home/moritz/workspace/pixi/src/deps/zig-gamedev/zstbi/src/zstbi.zig:129:30: 0xc05427 in loadFromFile (pixi)
            if (ptr == null) return error.ImageInitFailed;
                             ^
/home/moritz/workspace/pixi/src/gfx/texture.zig:30:21: 0xc057be in loadFromFile (pixi)
        var image = try zstbi.Image.loadFromFile(file, 4);
                    ^
/home/moritz/workspace/pixi/src/pixi.zig:139:29: 0xc0ac15 in init (pixi)
    const background_logo = try gfx.Texture.loadFromFile(assets.icon1024_png.path, .{});
                            ^
/home/moritz/.cache/zig/p/12203917ad7153ba955004d3b436ead6fc314de29d21ef0a7fda142025dd631c2709/src/platform/native/main.zig:36:5: 0xc10ec9 in main (pixi)
    try app.init();
    ^
run pixi: error: the following command exited with error code 1:
/home/moritz/workspace/pixi/zig-out/bin/pixi 
Build Summary: 34/36 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run pixi failure
error: the following build command failed with exit code 1:
/home/moritz/workspace/pixi/zig-cache/o/30e6e9c31304c9c069872271838cca21/build /home/moritz/.zvm/master/zig /home/moritz/workspace/pixi /home/moritz/workspace/pixi/zig-cache /home/moritz/.cache/zig run --verbose

Maybe you can update your zig version to latest, e.g. using zvm, then we'd be a 100% on the same page.

foxnne commented 12 months ago

I feel like I've seen this error before, I'll look into it. I would be curious if you have a similar error with the mach-core examples.

mlaass commented 12 months ago

good point, I built and ran all the mach-core examples. All of them work except for procedural-primitives, which creates a similar looking error:

zig build run-procedural-primitives
info(mach): found Vulkan backend on Integrated GPU adapter: Intel(R) UHD Graphics 630 (CFL GT2), Intel open-source Mesa driver: Mesa 23.0.4-0ubuntu1~22.04.1

Segmentation fault at address 0x48
???:?:?: 0xabe13f in ??? (???)
???:?:?: 0xabbc40 in ??? (???)
???:?:?: 0xabfc17 in ??? (???)
???:?:?: 0xa98f81 in ??? (???)
???:?:?: 0x4f8fa3 in ??? (???)
???:?:?: 0x4f8e87 in ??? (???)
???:?:?: 0x4a5d2f in ??? (???)
/home/moritz/workspace/mach-core/examples/procedural-primitives/renderer.zig:134:54: 0xb28e8c in createBindBuffer (procedural-primitives)
    uniform_buffer = core.device.createBuffer(&.{
                                                     ^
/home/moritz/workspace/mach-core/examples/procedural-primitives/renderer.zig:89:21: 0xb27f16 in init (procedural-primitives)
    createBindBuffer(bind_group_layout);
                    ^
/home/moritz/workspace/mach-core/examples/procedural-primitives/main.zig:23:22: 0xb29cdc in init (procedural-primitives)
    try renderer.init(allocator, timer);
                     ^
/home/moritz/workspace/mach-core/src/platform/native/main.zig:36:17: 0xb2dc77 in main (procedural-primitives)
    try app.init();
                ^
/home/moritz/.zvm/master/lib/std/start.zig:486:37: 0xb2e67e in main (procedural-primitives)
    std.os.argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@as(usize, @intCast(c_argc))];
                                    ^
../sysdeps/nptl/libc_start_call_main.h:58:16: 0x7fb4451ced8f in __libc_start_call_main (../sysdeps/x86/libc-start.c)
../csu/libc-start.c:392:3: 0x7fb4451cee3f in __libc_start_main_impl (../sysdeps/x86/libc-start.c)
???:?:?: 0x4a46d4 in ??? (???)
???:?:?: 0x0 in ??? (???)
run procedural-primitives: error: the following command terminated unexpectedly:
/home/moritz/workspace/mach-core/zig-out/bin/procedural-primitives 
Build Summary: 27/29 steps succeeded; 1 failed (disable with --summary none)
run-procedural-primitives transitive failure
└─ run procedural-primitives failure
error: the following build command failed with exit code 1:
foxnne commented 12 months ago

Thank you so much for trying them and seeing. As soon as I can ill get a Linux machine up and running so I can diagnose a bit more.

foxnne commented 11 months ago

Maybe you can update your zig version to latest, e.g. using zvm, then we'd be a 100% on the same page.

Hello! I'm not sure if you're still interested in trying Pixi, but I have updated everything I believe needed to run Pixi on the latest zig version used by mach-core. I have updated the readme to include a couple links to mach's zig mirror so hopefully it will be easier in the future to know what version Pixi supports.

Also, I'm not sure if you're in the Zig discord, but a user just recently got Pixi up and running on Linux. It looks like I had an issue where locally some files were named lowercase and git didn't track those as lowercase, as they were previously uppercase. So I think on linux the paths to the assets were incorrect. I have fixed this so hopefully if you pull latest and try you shouldn't have issues.

https://discord.com/channels/605571803288698900/1031814037312380958/1161650992912281730

mlaass commented 11 months ago

Great! It works for me now! Thanks!

foxnne commented 11 months ago

Glad to hear it works now, thank you for your patience!