Stream: contributing

Topic: platform building without compiler


view this post on Zulip Anton (Mar 18 2024 at 14:07):

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?

view this post on Zulip Luke Boswell (Mar 23 2024 at 04:59):

I haven't forgotten this. I've spent some time today looking at this, but haven't made much progress.

view this post on Zulip Luke Boswell (Apr 23 2024 at 20:53):

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

view this post on Zulip Luke Boswell (Apr 23 2024 at 20:54):

Also, I've left the surgical linker stuff as a TODO here. I figured Ii can circle back to that as a second step.

view this post on Zulip Anton (Apr 24 2024 at 09:02):

Looks good, we do use .o files by default but perhaps we support .a as well I'm not sure

view this post on Zulip Luke Boswell (Apr 24 2024 at 09:20):

We support .a now. That was a change Brendan made I think.


Last updated: Jul 06 2025 at 12:14 UTC