ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
34.96k stars 2.55k forks source link

zig ld: undefined symbols for macOS 14 #16118

Closed haze closed 1 year ago

haze commented 1 year ago

Zig Version

0.11.0-dev.3395+1e7dcaa3a

Steps to Reproduce and Observed Behavior

try to compile any zig program (including the compiler itself) on macOS 14; current output:

error(link): undefined reference to symbol '_isatty'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_dup2'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_attr_destroy'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_getenv'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_writev'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_abort'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__dyld_image_count'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__exit'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_exit'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_attr_init'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___ulock_wait2'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_fstat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_fstatat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_faccessat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_mkdirat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_openat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_unlinkat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_symlinkat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_renameat'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_futimens'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___error'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_fchdir'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_chdir'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__dyld_get_image_header'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_threadid_np'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__tlv_bootstrap'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_munmap'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_mmap'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_bzero'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_environ'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_sigaction'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_join'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_posix_memalign'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_open'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_fcntl'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_poll'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___stack_chk_fail'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_fork'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_lseek'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_os_unfair_lock_trylock'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_os_unfair_lock_unlock'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_flock'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_os_unfair_lock_lock'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_arc4random_buf'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_attr_setstacksize'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_attr_setguardsize'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_malloc_size'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_execve'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pwrite'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_write'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pthread_create'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_ftruncate'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pipe'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_clock_gettime'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_sysctlbyname'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__dyld_get_image_name'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_sendfile'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___ulock_wake'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_free'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__dyld_get_image_vmaddr_slide'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___stack_chk_guard'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_setreuid'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_waitpid'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_setregid'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_pread'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_read'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_msync'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_close$NOCANCEL'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '_wait4'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '___getdirentries64'
error(link):   first referenced in '/Users/haze/zig/zig-cache/o/5c5681b3b424d5ecd0c1eb1c7e88cb9b/build.o'
error(link): undefined reference to symbol '__availability_version_check'
error(link):   first referenced in '/Users/haze/.cache/zig/o/ae5b8bbe07c38d4a9ef82cd52e4ea880/libcompiler_rt.a(/Users/haze/.cache/zig/o/ae5b8bbe07c38d4a9ef82cd52e4ea880/libcompiler_rt.a.o)'
error(link): undefined reference to symbol '_sys_icache_invalidate'
error(link):   first referenced in '/Users/haze/.cache/zig/o/ae5b8bbe07c38d4a9ef82cd52e4ea880/libcompiler_rt.a(/Users/haze/.cache/zig/o/ae5b8bbe07c38d4a9ef82cd52e4ea880/libcompiler_rt.a.o)'
error(link): undefined reference to symbol 'dyld_stub_binder'
error: UndefinedSymbolReference

Expected Behavior

A successful compilation

cc: @kubkon

Solido commented 1 year ago

Stuck even with master release in Mac Ventura. undefined reference to symbol 'dyld_stub_binder'

Should I go back to brew install and 0.10?

haze commented 1 year ago

Stuck even with master release in Mac Ventura. undefined reference to symbol 'dyld_stub_binder'

Should I go back to brew install and 0.10?

Have you tried the workarounds listed in https://github.com/ziglang/zig/issues/15963?