I would like to continue the work on roc-turtle. The next step would be, to cross compile it, so it can be used not only on linux.
I have a version, that uses the legacy linker. So it should be possible, to run it on mac. But I am not able to cross compile it. When I call zig build legacy -Dtarget=x86_64-macos
(here is the build.zig-file). I get the following errors:
error: error: unable to find framework 'Foundation'. searched paths: none
error: unable to find framework 'CoreServices'. searched paths: none
error: unable to find framework 'CoreGraphics'. searched paths: none
error: unable to find framework 'AppKit'. searched paths: none
error: unable to find framework 'IOKit'. searched paths: none
It seems, that is a problem with the zig-raylib dependency: https://github.com/Not-Nik/raylib-zig/issues/158
I don't know, how I can go forward. Is this an error I can fix by installing some dependencies? Should I switch the gui from raylib to something even simpler?
Do you have an idea how I could solve this?
@Luke Boswell was able to make cross-compiling work in the past
I don't understand, how he is doing it. This seems to be the last version, before switching to rust. He is using the same zig-dependency as me. But I can not find anything in his build.zig related to cross compiling
https://github.com/lukewilliamboswell/roc-ray/tree/b1d1865b65e13c36f40c8d1343b27cb70136fe01
Those are the macos frameworks. I'm on a mac so I guess I linked those into my static library. I'm not sure I got cross compiling working for raylib.
After more reading, I found the hint not to compile raylib, but to use there release binary.
This works for linux, but there is a roc specific problem. For the legacy linker, I have to create one static library. So I have to unpack the libraylib.a
and call addObjectFile()
on every .o
file. This is hacky, but it works.
My problem is, that I can not unpack the libraylib.a
file in the macos release. When I call ar x libraylib.a
I get ar: libraylib.a: file format not recognized
.
Do you have any idea, how I get get the object files from the mac release? The release is found here: https://github.com/raysan5/raylib/releases
This is what we were using on roc-ray previously to repackage the object files for roc libtool -static -o platform/macos-arm64.a zig-out/lib/*
Maybe you can use that to combine the raylib release with the prebuilt host so Roc can link it in the final step?
I don't get it. What I currently doing is extracting the .o
files and creating a new .a
file with them and the roc-object-file.
What you are proposing is including the roc-object-file into the .a
file. I don't understand, how this is possible.
Do you know, how to either extract .o
files with libtool or how to include a .o
file to a .a
file with libtool?
Last updated: Jul 06 2025 at 12:14 UTC