-
-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zig build problem #3837
Comments
zig not found, did you add zig to %PATH%? |
zig not found, did you add zig to %PATH%? |
I think the zig compiler is no longer named zc |
Here, working: xmake v2.7.9+20230515 [kassane@Catarino Documentos]$ xmake create -l zig -t console hello
create hello ...
[+]: src/main.zig
[+]: src/test.zig
[+]: xmake.lua
[+]: .gitignore
create ok!
[kassane@Catarino Documentos]$ cd hello/
[kassane@Catarino hello]$ xmake -rv
checking for platform ... linux
checking for architecture ... x86_64
checking for gcc ... /usr/bin/gcc
checking for zig ... /home/kassane/zig/master/files/zig
checking for /home/kassane/zig/master/files/zig ... ok
checking for the zig compiler (zc) ... zig
checking for /home/kassane/zig/master/files/zig ... ok
checking for the zig compiler (zc) ... zig
checking for flags (-O ReleaseFast) ... ok
checking for flags (--cache-dir build/.objs/hello/linux/x86_64/release/zig-cache) ... ok
[ 20%]: compiling.release src/main.zig
/home/kassane/zig/master/files/zig build-obj -target x86_64-linux-gnu -O ReleaseFast --cache-dir build/.objs/hello/linux/x86_64/release/zig-cache -femit-bin=build/.objs/hello/linux/x86_64/release/src/main.zig.o src/main.zig
[ 20%]: compiling.release src/test.zig
/home/kassane/zig/master/files/zig build-obj -target x86_64-linux-gnu -O ReleaseFast --cache-dir build/.objs/hello/linux/x86_64/release/zig-cache -femit-bin=build/.objs/hello/linux/x86_64/release/src/test.zig.o src/test.zig
checking for /home/kassane/zig/master/files/zig ... ok
checking for the zig linker (zcld) ... zig
[ 60%]: linking.release hello
/home/kassane/zig/master/files/zig build-exe -target x86_64-linux-gnu -fstrip -dead_strip -femit-bin=build/linux/x86_64/release/hello build/.objs/hello/linux/x86_64/release/src/main.zig.o build/.objs/hello/linux/x86_64/release/src/test.zig.o
[100%]: build ok, spent 6,673s @waruqi , why zig cc not use |
It has nothing to do with zc, that's just an internal name for xmake, as long as you add zig to the PATH, xmake will automatically set zig to zc. Of course, you can also set it manually. xmake f --zc=/xxx/zig --ld=/xxx/zig --sh=/xxx/zig --ar=xxx/zig zc: zig compiler |
or you try zig package. https://github.com/xmake-io/xmake/blob/master/tests/projects/package/toolchain_zig/xmake.lua xmake will download zig and use it automatically. |
clang is also inherit("gcc") There is not much difference. |
Works after reloading shell, closing. |
Zig links automatically through the
and const std = @import("std");
const guile = @cImport({
@cInclude("libguile.h");
});
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {s}!\n", .{"world"});
try stdout.print("hello {s}\n", guile);
} |
add_linkdirs, add_links, add_syslinks |
you did not add |
|
The problem is that xmake is not passing the header files to the zig compiler, this is the generated command with
|
waruqi do you have any suggestions? |
Does zig support using c/c++ header files? Can you provide some examples? |
You can see the raylib example here: |
Xmake Version
v2.7.9+20230612
Operating System Version and Architecture
Windows 10 Subsystem for Linux, Ubuntu 22.04
Describe Bug
Zig compiler support no longer works with the latest version of zig.
With Zig 0.10.1 and following the getting started guide:
results in the following error:
Expected Behavior
Project Configuration
No response
Additional Information and Error Logs
Detailed logs:
The text was updated successfully, but these errors were encountered: