Skip to content
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

___ulock_wait2 Undefined symbols for architecture x86_64 referenced from _std.Thread.Futex.DarwinImpl.wait in zig2.o #13313

Closed
SamuelMarks opened this issue Oct 26, 2022 · 10 comments
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior downstream An issue with a third party project that uses Zig. os-macos
Milestone

Comments

@SamuelMarks
Copy link

Zig Version

875e98a

Steps to Reproduce

  1. brew install zig --HEAD (for me, that's commit: 875e98a)

Expected Behavior

Install success

Actual Behavior

==> Installing dependencies for zig: six, z3, lz4, zstd and llvm
==> Installing zig dependency: six
==> Pouring six--1.16.0_2.all.bottle.1.tar.gz
🍺  /usr/local/Cellar/six/1.16.0_2: 20 files, 122.4KB
==> Installing zig dependency: z3
==> Pouring z3--4.11.2.catalina.bottle.2.tar.gz
🍺  /usr/local/Cellar/z3/4.11.2: 142 files, 31.3MB
==> Installing zig dependency: lz4
==> Pouring lz4--1.9.4.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/lz4/1.9.4: 22 files, 680.4KB
==> Installing zig dependency: zstd
==> Pouring zstd--1.5.2.catalina.bottle.3.tar.gz
🍺  /usr/local/Cellar/zstd/1.5.2: 31 files, 2.4MB
==> Installing zig dependency: llvm
==> Pouring llvm--15.0.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/llvm/15.0.3: 6,408 files, 1GB
==> Installing zig --HEAD
==> cmake -S . -B build -DZIG_STATIC_LLVM=ON
==> cmake --build build
Last 15 lines from ~/Library/Logs/Homebrew/zig/02.cmake:
cd /tmp/zig-20221026-99316-12urpmy/build && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/zig-20221026-99316-12urpmy /tmp/zig-20221026-99316-12urpmy /tmp/zig-20221026-99316-12urpmy/build /tmp/zig-20221026-99316-12urpmy/build /tmp/zig-20221026-99316-12urpmy/build/CMakeFiles/zig2.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/zig2.dir/build.make CMakeFiles/zig2.dir/build
[ 99%] Building CXX object CMakeFiles/zig2.dir/src/stage1/empty.cpp.o
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++  -I/tmp/zig-20221026-99316-12urpmy/deps/SoftFloat-3e/source/include -I/tmp/zig-20221026-99316-12urpmy -I/tmp/zig-20221026-99316-12urpmy/build -I/tmp/zig-20221026-99316-12urpmy/src -I/tmp/zig-20221026-99316-12urpmy/src/stage1 -I/tmp/zig-20221026-99316-12urpmy/deps/SoftFloat-3e-prebuilt -I/tmp/zig-20221026-99316-12urpmy/deps/SoftFloat-3e/source/8086 -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -std=c++14 -DZIG_LINK_MODE=Dynamic -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Werror=type-limits -Wno-missing-braces -Wno-comment -MD -MT CMakeFiles/zig2.dir/src/stage1/empty.cpp.o -MF CMakeFiles/zig2.dir/src/stage1/empty.cpp.o.d -o CMakeFiles/zig2.dir/src/stage1/empty.cpp.o -c /tmp/zig-20221026-99316-12urpmy/src/stage1/empty.cpp
[100%] Linking CXX executable zig2
/usr/local/Cellar/cmake/3.24.2/bin/cmake -E cmake_link_script CMakeFiles/zig2.dir/link.txt --verbose=1
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/zig2.dir/src/stage1/empty.cpp.o zig2.o -o zig2  zigcpp/libzigstage1.a zigcpp/libopt_c_util.a zigcpp/libembedded_softfloat.a zigcpp/libzigcpp.a /usr/local/opt/llvm/lib/libclangFrontendTool.a /usr/local/opt/llvm/lib/libclangCodeGen.a /usr/local/opt/llvm/lib/libclangFrontend.a /usr/local/opt/llvm/lib/libclangDriver.a /usr/local/opt/llvm/lib/libclangSerialization.a /usr/local/opt/llvm/lib/libclangSema.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerFrontend.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerCheckers.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerCore.a /usr/local/opt/llvm/lib/libclangAnalysis.a /usr/local/opt/llvm/lib/libclangASTMatchers.a /usr/local/opt/llvm/lib/libclangAST.a /usr/local/opt/llvm/lib/libclangParse.a /usr/local/opt/llvm/lib/libclangSema.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerFrontend.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerCheckers.a /usr/local/opt/llvm/lib/libclangStaticAnalyzerCore.a /usr/local/opt/llvm/lib/libclangAnalysis.a /usr/local/opt/llvm/lib/libclangASTMatchers.a /usr/local/opt/llvm/lib/libclangAST.a /usr/local/opt/llvm/lib/libclangParse.a /usr/local/opt/llvm/lib/libclangBasic.a /usr/local/opt/llvm/lib/libclangEdit.a /usr/local/opt/llvm/lib/libclangLex.a /usr/local/opt/llvm/lib/libclangARCMigrate.a /usr/local/opt/llvm/lib/libclangRewriteFrontend.a /usr/local/opt/llvm/lib/libclangRewrite.a /usr/local/opt/llvm/lib/libclangCrossTU.a /usr/local/opt/llvm/lib/libclangIndex.a /usr/local/opt/llvm/lib/libclangToolingCore.a /usr/local/opt/llvm/lib/libclangExtractAPI.a /usr/local/opt/llvm/lib/libclangSupport.a /usr/local/opt/llvm/lib/liblldMinGW.a /usr/local/opt/llvm/lib/liblldELF.a /usr/local/opt/llvm/lib/liblldCOFF.a /usr/local/opt/llvm/lib/liblldWasm.a /usr/local/opt/llvm/lib/liblldMachO.a /usr/local/opt/llvm/lib/liblldCommon.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWindowsManifest.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWindowsDriver.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMXRay.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLibDriver.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDlltoolDriver.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMCoverage.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLineEditor.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMXCoreDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMXCoreCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMXCoreDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMXCoreInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86TargetMCA.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86Disassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86AsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86CodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86Desc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMX86Info.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyUtils.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMWebAssemblyInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVEDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVEAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVECodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVEDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVEInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSystemZDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSystemZAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSystemZCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSystemZDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSystemZInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSparcDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSparcAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSparcCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSparcDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSparcInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRISCVDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRISCVAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRISCVCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRISCVDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRISCVInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPowerPCDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPowerPCAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPowerPCCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPowerPCDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPowerPCInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMNVPTXCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMNVPTXDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMNVPTXInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMSP430Disassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMSP430AsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMSP430CodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMSP430Desc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMSP430Info.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMipsDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMipsAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMipsCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMipsDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMipsInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLanaiDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLanaiCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLanaiAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLanaiDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLanaiInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMHexagonDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMHexagonCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMHexagonAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMHexagonDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMHexagonInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBPFDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBPFAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBPFCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBPFDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBPFInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAVRDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAVRAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAVRCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAVRDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAVRInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMUtils.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMARMInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUTargetMCA.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUDesc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUUtils.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAMDGPUInfo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64Disassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64AsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64CodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64Desc.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64Utils.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAArch64Info.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMOrcJIT.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMCJIT.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMJITLink.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMInterpreter.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMExecutionEngine.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRuntimeDyld.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMOrcTargetProcess.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMOrcShared.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDWP.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDebugInfoGSYM.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMOption.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMObjectYAML.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMObjCopy.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMCA.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMCDisassembler.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLTO.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMCFGuard.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMFrontendOpenACC.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMExtensions.a /usr/local/Cellar/llvm/15.0.3/lib/libPolly.a /usr/local/Cellar/llvm/15.0.3/lib/libPollyISL.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMPasses.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMObjCARCOpts.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMCoroutines.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMipo.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMInstrumentation.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMVectorize.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMLinker.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMFrontendOpenMP.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDWARFLinker.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMGlobalISel.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMIRParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAsmPrinter.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSelectionDAG.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMCodeGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMIRReader.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAsmParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMInterfaceStub.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMFileCheck.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMFuzzMutate.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMTarget.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMScalarOpts.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMInstCombine.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAggressiveInstCombine.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMTransformUtils.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBitWriter.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMAnalysis.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMProfileData.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSymbolize.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDebugInfoPDB.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDebugInfoMSF.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDebugInfoDWARF.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMObject.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMTextAPI.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMCParser.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMMC.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDebugInfoCodeView.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBitReader.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMFuzzerCLI.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMCore.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMRemarks.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBitstreamReader.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMBinaryFormat.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMTableGen.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMSupport.a /usr/local/Cellar/llvm/15.0.3/lib/libLLVMDemangle.a -lm /usr/local/lib/libz3.dylib -lz -lzstd -lcurses -lxml2 
Undefined symbols for architecture x86_64:
  "___ulock_wait2", referenced from:
      _std.Thread.Futex.DarwinImpl.wait in zig2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [zig2] Error 1
make[1]: *** [CMakeFiles/zig2.dir/all] Error 2
make: *** [all] Error 2
@SamuelMarks SamuelMarks added the bug Observed behavior contradicts documented or intended behavior label Oct 26, 2022
@andrewrk andrewrk added os-macos arch-x86_64 64-bit x86 downstream An issue with a third party project that uses Zig. labels Oct 31, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Oct 31, 2022
@andrewrk
Copy link
Member

Sorry, Catalina support was dropped in 2d03f38.

@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2022
@SamuelMarks
Copy link
Author

All good, but could there be a more informative error when the platform it's attempting to build on is unsupported—or better still, known unable—to build on?

@andrewrk
Copy link
Member

This is what happens if I run brew upgrade on an old laptop running Catalina:

andy@Andrews-Air-2:~$ brew upgrade
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from MacHomebrew on Twitter.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

@SamuelMarks
Copy link
Author

Ok well I've upgraded to 13.0 (Ventura) in the meantime and will report a new bug about the issue it gets

Still would be good to have a better error message IMHO, for building from cmake

@jlfaucher
Copy link

I'm using High Sierra 10.13.6 because my laptop is old and can't be upgraded to a more recent version.
Zig 0.9.0 works good, and I was able to use Ziglyph in a C++ project.
Zig 0.10.0 doesn't work, whereas I don't have such problem with a recent clang (15.0.3) and a recent Rust (1.64.0).
Sharing with you, in the hope you may reconsider your decision to not fix if other people have the same wish.
Thanks for your great work!

@ghost
Copy link

ghost commented Oct 13, 2023

We see this on a supported MacOS, a.k.a. Ventura 13.5 (22G74) x86_64.

Steps to reproduce:

$ wget https://raw.githubusercontent.com/uber/hermetic_cc_toolchain/v2.1.2/toolchain/zig-wrapper.zig
$ zig version
0.11.0
$ zig build-exe -mcpu=baseline -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=error(link): undefined reference to symbol '___ulock_wait2'
error(link):   first referenced in '/private/var/tmp/_bazel_daliuss/c6dc5d0dd222b922da30f070f514354c/external/zig_sdk/tools/zig-wrapper.o'
error: UndefinedSymbolReference

Note that lib/libc/darwin/libSystem.13.tbd contains:

tbd-version:     4
targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
                   arm64e-macos, arm64e-maccatalyst ]
install-name:    '/usr/lib/system/libsystem_kernel.dylib'
current-version: 8796.101.5
parent-umbrella:
  - targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
                       arm64e-macos, arm64e-maccatalyst ]
    umbrella:        System
exports:
<...>
  - targets:         [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 
                       arm64e-macos, arm64e-maccatalyst ]
    symbols:         [ <...>___ulock_wait, ___ulock_wait2, <...> ]

(similarly to master)

... which leads me to believe that .. is there something wrong with the tbd files? Looking.

@ghost
Copy link

ghost commented Oct 13, 2023

Failing run on nightly:

$ zig-macos-x86_64-0.12.0-dev.891+2254882eb/zig build-exe --verbose-link -mcpu=baseline -OReleaseSafe zig-wrapper.zig
MachO Flush... zig ld -dynamic -platform_version macos 13.5.0 10.15 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dead_strip zig-wrapper.o /Users/daliuss/.cache/zig/o/ba147a5c62fd8633b18fba12f685b24a/libcompiler_rt.a -o zig-wrapper -lSystem
error: undefined reference to symbol ___ulock_wait2
    note: referenced in zig-wrapper.o
➜  toolchain git:(main) ✗

Successful run:

$ zig-macos-x86_64-0.12.0-dev.891+2254882eb/zig build-exe --verbose-link -mcpu=baseline -OReleaseSafe zig-wrapper.zig
LLVM Emit Object... ar rcs /Users/pauliusj/.cache/zig/o/35953b6456f967f5ab506ebe532cf55b/libcompiler_rt.a /Users/pauliusj/.cache/zig/o/35953b6456f967f5ab506ebe532cf55b/libcompiler_rt.a.o
MachO Flush... zig ld -dynamic -platform_version macos 12.5.1 12.3 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dead_strip zig-wrapper.o /Users/pauliusj/.cache/zig/o/35953b6456f967f5ab506ebe532cf55b/libcompiler_rt.a -o zig-wrapper -lSystem

@ghost
Copy link

ghost commented Oct 13, 2023

The "other system" is detecting 10.15 for some reason, but I couldn't understand why it is the case from only reading inferSdkVersion.

Since this is happening to a single colleague across the whole company and not on my machine, capacity of poking around and asking someone to run the commands is limited. cc @daliuss.

ghost pushed a commit to uber/hermetic_cc_toolchain that referenced this issue Oct 16, 2023
Sometimes the on-host toolchain may not be detected correctly on OSX[1].
Since we are interested only in a *hermetic* toolchain, we are meant to
use cross-compilation mode by invoking `-target`. Let's do it.

[1]: ziglang/zig#13313 (comment)
ghost pushed a commit to uber/hermetic_cc_toolchain that referenced this issue Oct 16, 2023
Sometimes the on-host toolchain may not be detected correctly on OSX[1].
Since we are interested only in a *hermetic* toolchain, we are meant to
use cross-compilation mode by invoking `-target`. Let's do it.

[1]: ziglang/zig#13313 (comment)
ghost pushed a commit to uber/hermetic_cc_toolchain that referenced this issue Oct 16, 2023
Sometimes the on-host toolchain may not be detected correctly on OSX[1].
Since we are interested only in a *hermetic* toolchain, we are meant to
use cross-compilation mode by invoking `-target`. Let's do it.

[1]: ziglang/zig#13313 (comment)
motiejus pushed a commit to uber/hermetic_cc_toolchain that referenced this issue Oct 16, 2023
Sometimes the on-host toolchain may not be detected correctly on OSX[1].
Since we are interested only in a *hermetic* toolchain, we are meant to
use cross-compilation mode by invoking `-target`. Let's do it.

[1]: ziglang/zig#13313 (comment)
@firepartyx
Copy link

install xcode will fix it

@mikdusan
Copy link
Member

to have any chance of building zig for 10.13 (anything older than macos 11.0):

  1. accept that it is not supported
  2. configure w/ cmake -DZIG_HOST_TARGET_TRIPLE=x86_64-macos.10.13

Several months ago I efforted building zig on macos as far as possible, mostly out of curiosity and a 10.15 issue. This was my experience for 10.13:

  1. Forget about building the llvm dependency on 10.12 or older. This is a system libc++ issue, and it is missing some critical bits for CLOCK_MONOTONIC iirc and probably other things. Building a new libc++ won't work, because libSystem is actually missing that support.
  2. Building llvm17 can be done by bootstrapping with llvm15+clang and a few other bits but what a chore.
  3. I avoided the brew rabbit hole. This was all done avoiding brew 100% which is probably the only reason it worked.
  4. Had to build cmake, python, and other prereqs to a local tools hierarchy.
  5. Used Xcode 10.1 to produce the tools and llvm15
  6. 10.13 was the oldest macos I managed to bootstrap zig

I anticipate building zig without embedded llvm support will make such endeavours easier and perhaps even older macos may just work but always remain aware of supported OS versions, even if things happen to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior downstream An issue with a third party project that uses Zig. os-macos
Projects
None yet
Development

No branches or pull requests

5 participants