Stream: platform development

Topic: Cross compiling from MacOS to Linux


view this post on Zulip Isaac Van Doren (Mar 10 2024 at 03:15):

What is the status of cross compilation? When try to compile a linux shared lib on my apple silicon mac, I get this error:

$ roc build hello.roc --lib --output libapp.so --target linux-x64
Couldn't find libgcc_s.so.1!
You may need to install libgcc

Couldn't find the libc development files!
We need the files crti.o, crtn.o, and Scrt1.o

On Ubuntu/Debian execute:
        sudo apt install libc-dev

On ArchLinux/Manjaro execute:
        sudo pacman -S glibc

On Fedora execute:
        sudo dnf install glibc-devel

We looked in the following directories:
/usr/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib64
/usr/lib

I've tried installing glibc with brew and mac ports but wasn't able to get either working.

Does it seem theoretically possible to cross compile like this? If so, any suggestions?

view this post on Zulip Luke Boswell (Mar 10 2024 at 03:55):

Does it help if you use the dev backend maybe? --dev

view this post on Zulip Luke Boswell (Mar 10 2024 at 03:57):

I can answer my own question... no there is another issue doing that.

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose
thread 'main' panicked at 'failed to find data symbol for "panic_msg"', crates/compiler/gen_dev/src/object_builder.rs:1059:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Isaac Van Doren (Mar 10 2024 at 03:59):

That error might be unrelated, when I use —dev with the command I used above I get the same error message about libc

view this post on Zulip Brendan Hansknecht (Mar 10 2024 at 04:32):

Only the surgical linker does cross compiling currently

view this post on Zulip Brendan Hansknecht (Mar 10 2024 at 04:33):

It only supports Linux and Windows exectutables

view this post on Zulip Brendan Hansknecht (Mar 10 2024 at 04:33):

Doesn't do shared libraries

view this post on Zulip Isaac Van Doren (Mar 10 2024 at 04:48):

Okay gotcha


Last updated: Jul 05 2025 at 12:14 UTC