-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
x86_64-macos-gnu #38
Comments
I see this when cross compiling from linux:
|
I get a bit further with ziglang/zig#7035:
With a native build (with ZIG_SYSTEM_LINKER_HACK=1) I got all the way to the end, and then failure:
|
Not sure if this is helpful, but you classically get similar errors when compiling programs with an old OSX target. |
Nice, I believe that clue is going to lead us towards a solution:
So let me try a patch where we pass the option to clang. |
With this patch, it's working :-) diff --git a/src/Compilation.zig b/src/Compilation.zig
index 65fa296ca..5438bb742 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -613,6 +613,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
cache.hash.addBytes(options.target.cpu.model.name);
cache.hash.add(options.target.cpu.features.ints);
cache.hash.add(options.target.os.tag);
+ cache.hash.add(options.target.os.getVersionRange());
cache.hash.add(options.is_native_os);
cache.hash.add(options.target.abi);
cache.hash.add(ofmt);
@@ -642,7 +643,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
hash.addOptionalBytes(root_pkg.root_src_directory.path);
hash.add(valgrind);
hash.add(single_threaded);
- hash.add(options.target.os.getVersionRange());
hash.add(dll_export_fns);
hash.add(options.is_test);
hash.add(options.is_compiler_rt_or_libc);
@@ -1855,6 +1855,33 @@ pub fn addCCArgs(
try argv.append("-Wno-pragma-pack");
}
+ // Pass the proper -m<os>-version-min argument for darwin.
+ switch (target.os.tag) {
+ .macos => {
+ const ver = target.os.version_range.semver.min;
+ try argv.append(try std.fmt.allocPrint(arena, "-mmacos-version-min={d}.{d}.{d}", .{
+ ver.major, ver.minor, ver.patch,
+ }));
+ },
+ .ios, .tvos, .watchos => switch (target.cpu.arch) {
+ .i386, .x86_64 => {
+ const ver = target.os.version_range.semver.min;
+ try argv.append(try std.fmt.allocPrint(
+ arena,
+ "-m{s}-simulator-version-min={d}.{d}.{d}",
+ .{ @tagName(target.os.tag), ver.major, ver.minor, ver.patch },
+ ));
+ },
+ else => {
+ const ver = target.os.version_range.semver.min;
+ try argv.append(try std.fmt.allocPrint(arena, "-m{s}-version-min={d}.{d}.{d}", .{
+ @tagName(target.os.tag), ver.major, ver.minor, ver.patch,
+ }));
+ },
+ },
+ else => {},
+ }
+
if (!comp.bin_file.options.strip) {
try argv.append("-g");
} It's still building, the next question is what happens when it gets to the link step. |
It worked :D
now to see if the executable is viable when copied over to a macos |
OK now we're hitting ziglang/zig#3295 |
This one, for some weird reason, is hanging for me during second pass at the linking stage. Anyhow, @andrewrk if you've got the temp artefacts lying around, you might wanna retry this with latest Zig I'll give this one a go again tomorrow on |
Good news, |
For those tracking this issue, |
This is failing because of ziglang/zig#5828. The workaround is to use
native
instead ofmacos
.The text was updated successfully, but these errors were encountered: