#Problem building my code

1 messages · Page 1 of 1 (latest)

reef magnet
#

Hello guys, I'm new to Zig and I wanted to try the language out.
I created a repo on github, cloned it, and ran the command zig init-exe (I'm following the language reference). It worked fine, created the files it was supposed to create, and then I ran the command zig build run and this is where I'm stuck at. I get the following output:

➜  src git:(main) ✗ zig build run
MachO Flush... error(link): undefined reference to symbol '_isatty'
error(link):   first referenced in '/Users/dryfish/git/markovchain/zig-cache/o/74d3948c6911a108eadc40af9ccbec19/build.o'
error(link): undefined reference to symbol '_dup2'
error(link):   first referenced in '/Users/dryfish/git/markovchain/zig-cache/o/74d3948c6911a108eadc40af9ccbec19/build.o'
error(link): undefined reference to symbol '_pthread_attr_destroy'
(...)

The (...) part is just more references to symbols that it fails to find. So the Linker is a bit messed up. I'm running on a Macbook M1 machine, I tried adding the flag -target aarch64-macos but same issues. Does someone know what I'm missing?

#

This is my Zig version:

0.11.0-dev.3892+0a6cd257b
glacial torrent
#

You should probably use a stable version of the 0.11.0 compiler.

quartz aurora
reef magnet
#

Ah, It was a dev build

reef magnet
glacial torrent
#

I for some reason went to get the binaries from the github releases, which was not the right way to get them.

#

Has all the prebuilt binaries you need!

reef magnet
#

@quartz aurora @glacial torrent problem is now solved. Downloading a stable build and running zig build run gives me no problems and the code works as expected.
Thank you both