I have zig installed under /usr/local/bin/zig
, zig version 0.11.0.
I have environment variables $ZIGCC = 'zig cc'
and $ZIGCPP = 'zig c++'
set in my Fish shell config, and I tried setting my default compiler for a C language project with meson as:
CC=$ZIGCC meson setup build-zig
...for a build directory with zig as the C compiler.
I get this error:
meson.build:1:0: ERROR: Unable to detect linker for compiler `zig cc -Wl,--version -L/usr/local/opt/qt@5/lib -I/usr/local/opt/qt@5/include
I should note /usr/local/opt/qt@5
is a directory on my fish_user_paths environment variable.
I thought zig was a drop-in compiler for gcc and clang. On Makefiles, I could just do:
make CXX=$ZIGCC MyExecutable.exe
or
make CXX=$ZIGCPP MyExecutable.exe
...for C++ and it would just work no need to specify a linker.
workaround for c++:
CXX
(clang++/g++) this will generate a directory with a build.ninja
file...build.ninja
all the references of your defalut compiler (clang++
in my case) with zig c++
(im my case are just 2 replacement but you can automate with script)ninja
in the setup dir as usualfor me it work