zig icon indicating copy to clipboard operation
zig copied to clipboard

Cross compilation for x86_64-linux-gnu fails

Open CashWasabi opened this issue 1 year ago • 0 comments

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

This is a mirror of a bug I reported in this repo: https://github.com/Not-Nik/raylib-zig https://github.com/Not-Nik/raylib-zig/issues/139

I was testing the generated project I get from executing:

./project_setup.sh demo

I've noticed that whenever I'm trying to cross compile for x86_64-linux-gnu I get the following stack trace:

zig build -Dtarget=x86_64-linux-gnu
install
└─ install demo
   └─ zig build-exe demo Debug x86_64-linux-gnu failure
error: error: unable to find dynamic system library 'GL' using strategy 'paths_first'. searched paths: none
error: unable to find dynamic system library 'X11' using strategy 'paths_first'. searched paths: none

error: the following command exited with error code 1:
/usr/bin/zig build-exe /home/mo/git/projects/demo/.zig-cache/o/c502fb93a46cdb616beac232c7104a1b/libraylib.a -ODebug -target x86_64-linux-gnu -mcpu baseline -I /home/mo/git/projects/demo/.zig-cache/o/a12fe0f75465fc2f91719bc59c04564f --dep raylib -Mroot=/home/mo/git/projects/demo/src/main.zig -ODebug -target x86_64-linux-gnu -mcpu baseline -Mraylib=/home/mo/.cache/zig/p/1220df9aa89d657f5dca24ab0ac3d187f7a992a4d27461fd9e76e934bf0670ca9a90/lib/raylib.zig -lGL -lX11 -lc --cache-dir /home/mo/git/projects/demo/.zig-cache --global-cache-dir /home/mo/.cache/zig --name demo --listen=- 
Build Summary: 3/6 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install demo transitive failure
   └─ zig build-exe demo Debug x86_64-linux-gnu failure
error: the following build command failed with exit code 1:
/home/mo/git/projects/demo/.zig-cache/o/294fd65b2d3c872b8346030ac9f8b9d3/build /usr/bin/zig /home/mo/git/projects/demo /home/mo/git/projects/demo/.zig-cache /home/mo/.cache/zig --seed 0x2b72c6b9 -Z87cd8115588777d1 -Dtarget=x86_64-linux-gnu

Whenever I use the default compilation (which is still the same target as the explicit target I use above) it compiles fine.

It looks like this is somewhat of a known problem: https://github.com/ziglang/zig/issues/16733 https://github.com/ziglang/zig/issues/16733 https://github.com/ziglang/zig/issues/19275

I was wondering if this can be fixed somehow or if there's a workaround for this issue. I've been looking at this problem for 2 days now and I just can't get this to work.

Expected Behavior

The cross compilation should work the same as with the default compilation target.

CashWasabi avatar Aug 23 '24 08:08 CashWasabi