Open kassane opened 1 year ago
Here's the issue:
zig ld -dynamic -platform_version macos 13.6.0 13.1 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -headerpad_max_install_names -dead_strip -e _main CMakeFiles/cmsysTestDynload.dir/testDynload.c.o /Users/jakubkonka/.cache/zig/o/7cc1d883f1250cf3ba0440c375ea16ee/libcompiler_rt.a -o libcmsysTestDynload.so -lSystem -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks
For some reason, the linker doesn't receive the flag -dylib
that we're really linking a shared object and not an executable.
And here's the reason for the failure:
/Users/jakubkonka/dev/CMake/Scripts/zigcc.sh -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -bundle -Wl,-headerpad_max_install_names -o libcmsysTestDynload.so CMakeFiles/cmsysTestDynload.dir/testDynload.c.o
CMake wants to generate a -bundle
which we don't support yet. I'll move this issue to 0.13 milestone as this will most likely involve a little bit more work.
Zig Version
0.11.0-dev.3301+230ea411f
Steps to Reproduce and Observed Behavior
I was trying building cmake using zig (cc/c++).
MacOS linking error: https://github.com/kassane/CMake/actions/runs/5092120988/jobs/9153051617#step:4:1360
How to run test
My fork has only the zigcc and zigcxx scripts in addition to the CI build test. I haven't done any build.zig experiments yet. https://github.com/Kitware/CMake/compare/master...kassane:CMake:zig
Method 1 - bootstrap
Method 2 - cmake to build cmake
cc: @kubkon
Expected Behavior
Works build same Linux and Windows. See: https://github.com/kassane/CMake/actions/runs/5092120988