Thread overview
Comping a Musl-linked druntime & phobos?
Aug 25, 2022
TheGag96
Aug 25, 2022
Mathias LANG
Aug 26, 2022
TheGag96
August 25, 2022

Hi, all. Has anyone had any success compiling a Musl-linked druntime and phobos? I haven't had any luck so far. I'm running Linux Mint x64.

Somewhat related - using -target=x86_64-linux-musl with dmd master doesn't even set the version CRuntime_Musl. I asked about this in the Discord, and I was told by Horo:

>

dmd 2.096 worked well for me. Same for gdc, haven't tried ldc. There is/was a bug that was introduced recently in druntime that broke musl but the older versions should work fine

2.096 doesn't have the -target option, and 2.097.0-2.098.0 don't even build properly for me. Using LDC to build works of course, but only with -betterC (i.e. no druntime/phobos).

August 25, 2022

On Thursday, 25 August 2022 at 01:45:50 UTC, TheGag96 wrote:

>

Hi, all. Has anyone had any success compiling a Musl-linked druntime and phobos? I haven't had any luck so far. I'm running Linux Mint x64.

Somewhat related - using -target=x86_64-linux-musl with dmd master doesn't even set the version CRuntime_Musl. I asked about this in the Discord, and I was told by Horo:

>

dmd 2.096 worked well for me. Same for gdc, haven't tried ldc. There is/was a bug that was introduced recently in druntime that broke musl but the older versions should work fine

2.096 doesn't have the -target option, and 2.097.0-2.098.0 don't even build properly for me. Using LDC to build works of course, but only with -betterC (i.e. no druntime/phobos).

Hi!
Thinks should mostly work. There is some issues with stack traces, but I don't remember the details. Check what Alpine Linux is doing: https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/dmd

Note that the target should not be required: https://github.com/dlang/dmd/blob/09d04945bdbc0cba36f7bb1e19d5bd009d4b0ff2/compiler/src/dmd/target.d#L1177-L1180

August 26, 2022

On Thursday, 25 August 2022 at 01:52:15 UTC, Mathias LANG wrote:

>

(snip)

Hmmm... Maybe I don't understand. What exactly is Alpine Linux doing? That .patch file didn't contain anything substantial. It looks like it has some version of LDC on hand to use, probably already set up properly to use Musl. You're saying that you shouldn't need to pass in -target because if the compiler was compiled with CRuntime_Musl, it will just use that automatically. But that requires exactly what I don't have: a compiler that uses Musl. Am I missing something?