Odin
Odin copied to clipboard
[macOS] `__ulock_wait2` usage build error on macOS 10.15 (and probably older)
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- Operating System & Odin Version: macOS 10.15, Odin dev-2022-05, Homebrew (https://github.com/Homebrew/homebrew-core/pull/97679)
- Please paste
odin reportoutput: N/A
Expected Behavior
Successfully build on macOS 10.15 or document supported macOS versions.
Current Behavior
In Homebrew (https://github.com/Homebrew/homebrew-core/pull/97679), we see that build fails on macOS 10.15 at run_demo due to __ulock_wait2 usage.
https://github.com/odin-lang/Odin/blob/df233aee942bd85a5162a36a82bf33fe74d2f2ad/core/sync/futex_darwin.odin#L33
Didn't find much info online, but it sounds like __ulock_wait2 might be only available on macOS 11+ based on zig's usage https://github.com/ziglang/zig/blob/master/lib/std/Thread/Futex.zig#L166-L174
Failure Information (for bugs)
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- On macOS 10.15, run
make releaseor./build_odin.sh release.
Failure Logs
+ clang src/main.cpp src/libtommath.cpp -Wno-switch -Wno-macro-redefined -Wno-unused-value -std=c++14 '-DGIT_SHA="df233aee"' '-DODIN_VERSION_RAW="dev-2022-05"' -I/usr/local/Cellar/llvm/13.0.1_1/include -std=c++14 -stdlib=libc++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -L/usr/local/Cellar/llvm/13.0.1_1/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -O3 -pthread -lm -lstdc++ -liconv -ldl -lLLVM-C -o odin
+ set +x
Undefined symbols for architecture x86_64:
"___ulock_wait2", referenced from:
_sync._futex_wait_with_timeout-3463 in demo.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: *** [release] Error 1
Also both my mac's both catalina
I have almost the same,
_sync._futex_wait_with_timeout-3858 in demo.o
or
_sync._futex_wait_with_timeout-2886 in demo.o
depending on if I use make release or ./build_odin.sh.
I really hope I can use odin some day :)
Ok, I did some digging, I posted it here, it should fix it for you.
https://github.com/odin-lang/Odin/issues/1959
Closing as fixed by #2015