#Cross Compile C With Zig

1 messages · Page 1 of 1 (latest)

vale lintel
#

Hi
How to cross compile c source code with zig.

I have make file. CC =cc changed to CC=zig cc. I want compile to Linux and Mac m1 chip arm64. Please give me details about it.

languid briar
#

you can do something like zig cc main.c -target aarch64-macos-gnu

#

there's a list of targets you can get by running zig targets

sly geyser
vale lintel
languid briar
#

what's it saying?

vale lintel
sly geyser
#

x86_64-windows-gnu

vale lintel
#

CC = zig cc -target x86_64-windows-gnu main/php_config.h:2274:10: fatal error: 'sys/select.h' file not found
#include <sys/select.h>

wind mural
#

posix headers won't be available on windows

vale lintel
#

How to fix this type of errors ?

sly geyser
#

since they arent available on windows

vale lintel
#

I tried for Linux from mac. CC = zig cc -target x86_64-linux-gnu I am compiling php source code. Headers issues. Any solusions?