Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add musl libc CI using Alpine Linux container on Ubuntu GHA #4650

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

@JohanEngelen
Copy link
Member Author

Is there a good way to disable all gdb-related tests? (the gdb version on Alpine is too new and there are no alpine packages for older gdb versions)

@kinke
Copy link
Member

kinke commented May 8, 2024

Yeah, we have this which should take care of most dmd-testsuite failures:

version (LDC)
{
if (test_base_name.startsWith("gdb") && environment.get("GDB_FLAGS") == "OFF")
{
writefln(" ... %-30s [DISABLED due to GDB_FLAGS=OFF]", input_file);
return 0;
}
}

@JohanEngelen JohanEngelen force-pushed the musl_alles branch 2 times, most recently from 666b612 to 0f089fd Compare May 19, 2024 13:59
@JohanEngelen
Copy link
Member Author

The tester on Alpine Linux with musl is green now :))

set(sharedstatic "--link-shared")
else()
set(sharedstatic "--link-static")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this stuff really required? Is the alpine llvm package misconfigured?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, optionally definable manually now, just seen the TODO in the yaml.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But judging from the ldd output, LLVM is linked statically just fine already, but the other deps aren't (lib{z,zstd,unwind} etc.).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[I'm pretty sure this broke the FreeBSD job, where explicitly using --link-shared apparently causes libzstd to be dragged in, which isn't installed (so no dependency of the installed official llvm package on that library either) - probably misconfigured by FreeBSD.]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some trouble in shared/static linking of LLVM. The installation defaults to shared linking on Alpine (llvm-config default output), that's why I added this code here. It's perhaps not needed right now (no static linked build).
Fully static linking is not possible yet, because of the libunwind dependency. libunwind is incompatible with g++ static linking, because of conflicting symbols between libgcc_eh and libunwind. I think the only option is to make the libunwind dependency of druntime optional, and disable it for a fully statically linked LDC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to link into this: libunwind/libunwind#405 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you wanna link fully statically anyway? As preparation for an official musl-x86_64 LDC package? That would be quite a bit more work anyway, and would ideally be integrated in the main.yml workflow then, as that performs the upload to GitHub etc. So I'd suggest deferring that to another PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Btw a friend recently told me that the Alpine gcc is patched in a way that it doesn't emit the x86_64 cmpxch16b instruction. They noticed a ~20% overall performance improvement of glibc vs. musl because of that.]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer the static stuff to a different PR. It also requires / will include further simplification / fix of the libunwind backtrace handling. It turns out we can use the same code as what we use on Darwin. Which should then work hopefully for the many different versions of libunwind packages that I'm encountering...

ninja obj/ldc2.o all ldc2-unittest all-test-runners
bin/ldc2 --version
ldd bin/ldc2
shell: alpine.sh {0}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to write it explicit for each step, so it is more clear that the commands are running in the alpine container inside the ubuntu container.

@kinke
Copy link
Member

kinke commented May 19, 2024

Currently it doesn't find any compiler-rt libs, so LDC_INSTALL_LLVM_RUNTIME_LIBS_OS might need tweaking.

@JohanEngelen JohanEngelen marked this pull request as ready for review May 24, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants