[---] Build docker executable with musl libc.#751
[---] Build docker executable with musl libc.#751looked-at-me wants to merge 7 commits intodlang-tour:masterfrom
Conversation
wilzbach
left a comment
There was a problem hiding this comment.
Thanks a lot for your help!
I don't have much time, but I wanted to drop a few notes:
- there's an alpine package for ldc (https://pkgs.alpinelinux.org/package/edge/community/x86_64/ldc)
- IIRC the gists were broken because of an API/token issue (GitHub blocking the requests)
dub.sdl
Outdated
| lflags "-lz" "-lssl" "-lcrypto" "-ldl" platform="posix" | ||
| dflags "-static" platform="posix" | ||
|
|
||
| // gcc on alpine has issues with the ld.gold linker, use bfd instead |
There was a problem hiding this comment.
Would be better to pass this as DFLAGS from alpine as ld.gold does drastically speed-up the build time locally.
There was a problem hiding this comment.
Unfortunately ld.gold has some issues on musl, so either BFD or LLD has to be used.
|
@Cogitri and myself maintain the Alpine packages. |
ci/Dockerfile
Outdated
| @@ -0,0 +1,10 @@ | |||
| FROM alpine:edge | |||
|
|
|||
| RUN apk add --no-cache g++ binutils-gold clang \ | |||
There was a problem hiding this comment.
I don't think you need gold though, LDC doesn't use it (doesn't quite work on Alpine).
See https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/ldc/01-conf.patch
ci/docker.build.sh
Outdated
| set -e -u | ||
|
|
||
| cd /core/ | ||
| DFLAGS="-linker=bfd" dub build -c static --compiler=ldc2 |
There was a problem hiding this comment.
bfd is the default, see my above comment.
|
Got called back into work, has been a bit hectic. I'll see if I can get this building now. @Geod24 How often do you update the packages? Is it a lot of work to maintain? Could be automated when LDC2 does a release? Preferably it would be nice to be able to select a specific version of LDC2. |
dd00dd5 to
8d0f876
Compare
|
Alright looks to be good to go? |
It is fairly trivial to do, except that there are still some quirks (read: bugs) to be worked out. There's quite a few things that could be automated, not only on the Alpine side, but also other package managers (e.g. Homebrew, Nix...). |
|
@wilzbach Any ETA on when this will be merged? Github links are still broken, though for a different reason than you mentioned. Right now it's crashing due to a bug in glibc with local thread variables not being accessible as the binary doesn't have a dynamic table for lookup for by the dynamic glibc library that is still loaded dynamically. |
|
@wilzbach Plonk. Is there someone else I can ping? |
| if [[ "${DC}" == "ldc2" ]]; then | ||
| dub build -c static --compiler=${DC} | ||
| docker build -t dlangtour_build ./ci/ | ||
| docker run --rm -v `pwd`:/core/ -ti dlangtour_build |
There was a problem hiding this comment.
Copied from the docker run below.
|
|
||
| # remove dub folder generated with build | ||
| # as it has root permissions from docker in the build folder | ||
| rm -rf ./.dub/ |
There was a problem hiding this comment.
Why the rm inside of the docker image ? It doesn't make much sense to me.
There was a problem hiding this comment.
docker is run with a root user, the folder is generated inside the build folder it is connected to. Without this the remove outside would need root access, which it doesn't have.
|
@looked-at-me : This is still listed as a WIP tho |
Co-authored-by: Mathias LANG <geod24@gmail.com>
|
@looked-at-me @Geod24 what's the state of this? |
The issue with gist not working seems to be related to a bug in glibc when it is used as a static library in a static executable. Possibly something related to the shared binaries not being able to access TLS of the executable. Found a few issues related to this, that were years old. Don't imagine using glibc as a static library is high on their list.
This should work now, this needs the regression in vibe-d fixed first though as it uses a newer ldc2, which is required for musl libc support.
Bit messy to build, the dockerfile will be much simpler if LDC2 starts releasing musl libc builds again.
Also not 100% on the tracis script, so WIP for now to test..