ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.2k stars 259 forks source link

Include musl libc Release Binaries #3417

Open looked-at-me opened 4 years ago

looked-at-me commented 4 years ago

On systems that use musl libc, the glibc binaries won't run. So it would be convenient, especially for scripts, to have a ldc2 binary built and released with musl libc. This would save anyone that needs to use ldc2 on a musl libc system from having to build the musl libc ldc2 binary themselves.

kinke commented 4 years ago

This would be a manageable CI addition if it weren't for the fact that we'd need a musl-LLVM for linking too, so another CI addition to our LLVM repo.

looked-at-me commented 4 years ago

@kinke

A bit unrelated, but cross compilation should work right with an mtriple? Using dub:

dub build --arch="x86_64-linux-musl" --compiler=ldc2

It does pass the mtriple to the ldc2 commands, but it still links against glibc. I do have the development libraries for musl. Do I need to do anything extra to link against musl?

kinke commented 4 years ago

Yeah, you'll need cross-compiled druntime/Phobos too and tell LDC to use the musl-gcc/clang for linking. See https://wiki.dlang.org/Cross-compiling_with_LDC.

PetarKirov commented 4 years ago

Here's a crazy idea: can ldc actually be a proxy script that invokes ldc-build-runtime in case it can't find druntime and phobos build for the target triple? An of course, if it finds them, it forwards all args to the actual ldc binary?

kinke commented 4 years ago

The example cmdlines in https://wiki.dlang.org/Building_LDC_runtime_libraries indicate that that's not really an option IMO. Once we have something like an ldc-add-target tool which downloads & extracts a prebuilt archive and sets up ldc2.conf, we're in very good shape I'd say.

looked-at-me commented 4 years ago

If I were to add CI to create the binaries, what would be your preference is where to put it? I looked at the travis script and it is already quite large. The easiest way would be to use a docker image, but then it might be faster to compile just by cross compiling, but then testing... I've just been using the prebuilt LLVM binaries so I'd also need to look into your custom LLVM repo.

Once we have something like an ldc-add-target tool which downloads & extracts a prebuilt archive and sets up ldc2.conf, we're in very good shape I'd say.

That sounds incredibly useful. Is it already being worked on?

kinke commented 4 years ago

Travis is too slow, the only feasible option is Azure Pipelines, which generates all packages (LLVM + LDC) except for the AArch64 Linux ones. LLVM would be a prerequisite (our fork is needed to enable Android cross-compilation etc.) and would thus need to be handled first. See https://github.com/ldc-developers/llvm-project/blob/ldc-release/10.x/azure-pipelines.yml and https://github.com/ldc-developers/llvm-project/blob/ldc-release/10.x/.azure-pipelines/posix.yml (and the log to get a better understanding).

Is it already being worked on?

See https://github.com/ldc-developers/ldc/pull/3345#issuecomment-595092399.

Geod24 commented 4 years ago

@kinke : You might also want to consider Github as a CI, given it's quite fast, well integrated, easy to set up, and you don't use it yet.

kinke commented 4 years ago

I've already dismissed that one, as there's no real advantage over Azure Pipelines AFAICT (but e.g. only half as many CPU cores for the Mac machines).

InnotSagg commented 4 years ago

Alpine package still 1.20, add musl release Binaries will be help a lot for alpine users. https://pkgs.alpinelinux.org/package/edge/community/x86_64/ldc

kassane commented 2 months ago

@JohanEngelen , Since #4650. Any chance to add linux-musl binary in CI & final releases?

JohanEngelen commented 2 months ago

@JohanEngelen , Since #4650. Any chance to add linux-musl binary in CI & final releases?

Yes. working on it.