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

Zig: MacOS SDK for cross-compile #637

Closed
wants to merge 1 commit into from

Conversation

kassane
Copy link
Contributor

@kassane kassane commented Apr 23, 2024

e.g.: Build Linux to MacOS (both x86_64)

Fix

zig build --summary all -Dtarget=native-macos
install
└─ install gc
   └─ zig build-lib gc Debug native-macos 1 errors
/home/kassane/bdwgc/extra/../os_dep.c:4453:10: error: 'mach/exception.h' file not found
#include <mach/exception.h>
         ^~~~~~~~~~~~~~~~~~~
/home/kassane/bdwgc/extra/gc.c:62:10: note: in file included from /home/kassane/bdwgc/extra/gc.c:62:
#include "../os_dep.c"
         ^

cc: @ivmai

Reference

@ivmai
Copy link
Owner

ivmai commented Apr 24, 2024

Please see commit 9eae294 - this is existing W/A for MacOS.
Is your solution another workaround or the right solution of the issue?

@ivmai
Copy link
Owner

ivmai commented Apr 24, 2024

Why do we need .zon file?

@kassane
Copy link
Contributor Author

kassane commented Apr 24, 2024

Why do we need .zon file?

Zig's package manager (since v0.11.0) requests zon as an additional way to port external packages to build.zig.

The biggest difference between the previous version and the latest v0.12.0 is that you no longer need to add build.zig to all external packages. You can now access the root_path of the packages and compile directly in the build.zig of the main project.

@kassane
Copy link
Contributor Author

kassane commented Apr 24, 2024

Please see commit 9eae294 - this is existing W/A for MacOS. Is your solution another workaround or the right solution of the issue?

remake & rebased!!

ivmai pushed a commit that referenced this pull request Apr 27, 2024
…cript

PR #637 (bdwgc).

* build.zig [t.isDarwin && !target.query.isNative] (build): Define
MISSING_MACH_O_GETSECT_H and NO_MPROTECT_VDB macros; add TODO item.
ivmai added a commit that referenced this pull request Apr 27, 2024
PR #637 (bdwgc).

The workaround already exists in build.zig file.
@ivmai
Copy link
Owner

ivmai commented Apr 27, 2024

BTW: Just in case you did not know of - https://github.com/lycus/libgc-d

@ivmai
Copy link
Owner

ivmai commented Apr 27, 2024

Merged.

@ivmai ivmai closed this Apr 27, 2024
@kassane kassane deleted the zig-macos_sdk branch April 27, 2024 16:04
@kassane
Copy link
Contributor Author

kassane commented Apr 27, 2024

BTW: Just in case you did not know of - https://github.com/lycus/libgc-d

I see. Just chose importC over manual binding.
Thanks for the reminder. I'll add it to the bdwgc-d readme for reference.

Merged.

Thanks, again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants