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

Create linux-musl.yml #2548

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

Create linux-musl.yml #2548

wants to merge 4 commits into from

Conversation

userdocs
Copy link

@userdocs userdocs commented Jan 1, 2025

A static musl crossbuild binaries workflow to test building against musl cc across a range of arch targets,

A continuation of this; #2426

It uses a variation of this https://github.com/richfelker/musl-cross-make via https://github.com/userdocs/qbt-musl-cross-make which provides the crossbuild toolchains on demand, here using the docker images.

They are using alpine linux settings from here https://git.alpinelinux.org/aports/tree/main/gcc/APKBUILD#n287

You could also release the static binaries using this.

Take about 3 minutes per build https://github.com/userdocs/ninja/actions/runs/12575349270

@userdocs userdocs force-pushed the master branch 2 times, most recently from 518386a to 24b2705 Compare January 3, 2025 20:01
Update linux-musl.yml

Update linux-musl.yml

Create linux-musl.yml

static musl crossbuild binaries

Update linux-musl.yml

Update linux-musl.yml

Update linux-musl.yml

Update linux-musl.yml
@userdocs
Copy link
Author

userdocs commented Jan 3, 2025

sorry about the job spam. I was trying to add the tests to the builds from the existing Linux workflow but I guess I'm missing something as can't seem to reproduce the python ones in full.

So now it does the python and cmake builds with some cmake failures in testing https://github.com/userdocs/ninja/actions/runs/12604320560

@jhasse
Copy link
Collaborator

jhasse commented Jan 15, 2025

Why though?

@userdocs
Copy link
Author

#2426 (comment)

@jhasse
Copy link
Collaborator

jhasse commented Jan 17, 2025

Ah I remember now. Can you simplify this? I think one job is more than enough. As Ninja is C++ I would suspect musl fans are already crying their eyes out anyway and will prefer https://github.com/michaelforney/samurai.

@userdocs
Copy link
Author

userdocs commented Jan 17, 2025

I think the simplest way to do this is just using an alpine container on x86_64. No external requirements.

If you added more arch in the future it would be via emulation which is not that fast but if you don't mind the time taken, it does the job ( similar to this job aarch64 linux

So if you want just one arch on x86_64 i'll do it via alpine container and it should also work fine with the cmake lto thing, which appears to be a crossbuild bug on their side.

@userdocs
Copy link
Author

@userdocs
Copy link
Author

Pretty fast as well.

mnNFU7J

note: I don't install gtest so it uses this

ninja/CMakeLists.txt

Lines 255 to 264 in 6b5d7a7

find_package(GTest)
if(NOT GTest_FOUND)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz
URL_HASH SHA256=81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2
)
FetchContent_MakeAvailable(googletest)
endif()
and builds it statically otherwise it attempts to link to it dynamically breaks things.

I also tested it with googletest-1.15.2.tar.gz in the CMakeLists.txt and it worked

  find_package(GTest)
  if(NOT GTest_FOUND)
    include(FetchContent)
    FetchContent_Declare(
      googletest
      URL https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz
      URL_HASH SHA256=7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926
    )
    FetchContent_MakeAvailable(googletest)
  endif()

@userdocs
Copy link
Author

@jhasse

So the action can't run in a pr workflow - actions/attest-build-provenance#99

I pushed on tag only if: startsWith(github.ref, 'refs/tags/v') but we could also use github.ref == 'refs/heads/main' if you want signed artifacts when you push?

Do you have a preference?

@jhasse
Copy link
Collaborator

jhasse commented Jan 21, 2025

Actually I don't want any artifacts for musl.

@userdocs
Copy link
Author

@jhasse done: removed artifacts/attestation and updated permissions

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.

2 participants