I'm wondering if someone could help me navigate the rust build script to build the platform into an object ready for linking?
@Luke Boswell perhaps you already tried this but does running the debug compiler (cargo build --bin roc
) with ROC_PRINT_BUILD_COMMANDS=1 ./target/debug/roc file.roc
help clear things up?
I haven't forgotten this. I've spent some time today looking at this, but haven't made much progress.
I've been exploring the changes which will be required to basic-cli and basic-webserver to make this change #6414.
I've made a separete (demo) platform, and have the following script which cross-compiles a release for various targets. It seems to be working well, but I've only really tested on my machine.
Before I start asking people to test things out, or progress too far, I just wanted to check if these targets and my process seem ok? I haven't done this before, so am just wonering if there's something else I need to be considering here?
# LEGACY LINKER ARTEFACTS
cargo build --release --target=aarch64-apple-darwin
cp target/aarch64-apple-darwin/release/libhost.a platform/macos-arm64.a
cargo build --release --target=x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/libhost.a platform/linux-x64.a
cargo build --release --target=x86_64-apple-darwin
cp target/aarch64-apple-darwin/release/libhost.a platform/macos-x64.a
cargo build --release --target=aarch64-unknown-linux-musl
cp target/aarch64-unknown-linux-musl/release/libhost.a platform/linux-arm64.a
# SURGICAL LINKER ARTEFACTS
# linux-x64.rh
# metadata_linux-x64.rm
# BUNDLE INTO PACKAGE
roc build --bundle .tar.br platform/main.roc
Also, I've left the surgical linker stuff as a TODO here. I figured Ii can circle back to that as a second step.
Looks good, we do use .o files by default but perhaps we support .a as well I'm not sure
We support .a
now. That was a change Brendan made I think.
Last updated: Jul 06 2025 at 12:14 UTC