Stream: beginners

Topic: ✔ Compiling basic-webserver on macOS and Linux


view this post on Zulip Johannes Rubenz (Oct 20 2025 at 19:00):

I want to compile basic-webserver targeting Ubuntu 24.04.

If I try it on my Mac (M1), I get:

roc build examples/hello-web.roc --target=linux-x64 --linker=legacy
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

If I try it directly on my Ubuntu server, I get:

roc build basic-webserver/examples/hello-web.roc --linker=legacy
Legacy linking failed: Failed to find any legacy linking files; I need one of these three paths to exist:
basic-webserver/examples/../platform/linux-x64.a
basic-webserver/examples/../platform/linux-x64.o
basic-webserver/examples/../platform/libhost.a

TIP: Maybe try surgical linking with the flag --linker=surgical

How can I make this work? I’d be grateful for any help! :smiley:

My Roc version is Roc nightly pre-release, built from commit d73ea109cc2 on Tue Sep 9 10:23:53 UTC 2025.

view this post on Zulip Luke Boswell (Oct 20 2025 at 19:35):

Are you using basic-webserver from a URL or using a relative path in your app header?

Those paths where its looking look to me like its a relative path. If you aren't using a release of the platform you will need to compile the host first.

I can't remember exactly how we do that, just on my phone and can't look rn.

view this post on Zulip Johannes Rubenz (Oct 20 2025 at 19:46):

On the Ubuntu server itself, using the URL fixed the issue — it compiled perfectly.

On macOS – targeting Linux – the error message is still the same:
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

view this post on Zulip Luke Boswell (Oct 20 2025 at 21:44):

Yeah the way we do linking with the current rust design isn't great... this is an example of why we changed the platform hosts to be more explicit I think so the cross compilation will just work reliably.

Are you unblocked with this now?

view this post on Zulip Luke Boswell (Oct 20 2025 at 21:45):

Specially the new zig compiler has a different approach for platform authors which is more explicit and avoids all the sneaky linker headaches.

view this post on Zulip Luke Boswell (Oct 20 2025 at 21:46):

The platform authors are responsible for providing all of the dependencies like c runtime objects for each platform they support.

view this post on Zulip Johannes Rubenz (Oct 21 2025 at 05:17):

Thanks for your help and the background info, Luke — and yes, all unblocked now! :slight_smile:

view this post on Zulip Notification Bot (Oct 21 2025 at 05:17):

Johannes Rubenz has marked this topic as resolved.


Last updated: Nov 09 2025 at 12:14 UTC