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

crossdev: Bootstrap the full LLVM toolchain #24

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vadorovsky
Copy link
Contributor

Include llvm-libunwind and libcxx in the LLVM-based cross environments,
so they are fully ready to build any package.

@vadorovsky vadorovsky marked this pull request as draft November 11, 2024 23:26
@@ -0,0 +1,55 @@
name: CI
Copy link
Member

Choose a reason for hiding this comment

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

Nice! I think @Arniiiii is interested in doing some work on this as well.

@vadorovsky
Copy link
Contributor Author

Depends on gentoo/gentoo#39280

@thesamesam I added a GitHub Actions workflow which should be able to test crossdev. But it seems like actions need to be enabled for this repo.

@thesamesam
Copy link
Member

I think it'll Just Work once it's merged.

@vadorovsky
Copy link
Contributor Author

Usually when I'm adding workflows to new repos, they start executing already in the PR introducing them. I would double-check if there is any setting to enable.

But if that doesn't work, I can try making an another PR, where I could start with testing GNU targets.

@vadorovsky vadorovsky marked this pull request as ready for review November 11, 2024 23:56
@vadorovsky vadorovsky marked this pull request as draft November 11, 2024 23:56
@thesamesam
Copy link
Member

Checking the settings is awkward because of how we have things setup. But right now, it looks to me the same as every other repo we have in gentoo. Please do make that other PR and I'll merge it.

@Arniiiii
Copy link

Depends on gentoo/gentoo#39280

@thesamesam I added a GitHub Actions workflow which should be able to test crossdev. But it seems like actions need to be enabled for this repo.

AFAIK you can enable GitHub actions for your fork somewhere in settings of your fork.

Nice! I think @Arniiiii is interested in doing some work on this as well.

Definitely ! Thanks for mentioning!

In current upstream we see checking next setups:
- aarch64-unknown-linux-gnu on openrc+gcc+glibc
- aarch64-unknown-linux-gnu on openrc+gcc+musl
- aarch64-unknown-linux-musl on openrc+gcc+glibc
- aarch64-unknown-linux-musl on openrc+gcc+musl

I think this is small amount of setups. Even your work on enabling cross-compiling with llvm via the crossdev script is not checked.

I guess there's a small problem with automatic testing of the project: checking valuable amount of targets requires a lot of time. I wrote a bash script for all of this, you can check at my fork: https://github.com/Arniiiii/crossdev/blob/master/test.bash . It took on a laptop with Intel's i7-13700HX at 4-5 GHz around 600 mins IIRC.

Now there's a problem: GitHub allows only 2000 mins of Linux CI/CD per month per user.

So only 1,2 or maybe 3 such checks can be done per month per user. That's not good.

AFAIK there's a relatively newly added feature in GitHub called self-hosted runners. Gitea, Forgejo, Gitlab have this feature and I can confirm it works there, but I haven't setup it on GitHub yet.

In a week or in a month I can provide a laptop with znver2 CPU with 12 threads and 16GB as a self-hosted runner. It can solve the problem at least partially. I guess after this it would be logically to consider what targets going to be checked and when ( at push or at merge or whenever).

@vadorovsky
Copy link
Contributor Author

@Arniiiii check out this PR #28 - I'm adding more architectures there. And we could discuss the details about CI there. 🙂

I don't think there is a limit of 2000 hours per month for free repos, or at least I wasn't able to find any information about that. According to https://docs.github.com/en/actions/administering-github-actions/usage-limits-billing-and-administration#usage-limits, the only limitation relevant to us is 6h limit per job - which we are not exceeding in any case so far.

@Arniiiii
Copy link

Arniiiii commented Nov 20, 2024

I don't think there is a limit of 2000 hours per month for free repos, or at least I wasn't able to find any information about that. According to https://docs.github.com/en/actions/administering-github-actions/usage-limits-billing-and-administration#usage-limits, the only limitation relevant to us is 6h limit per job - which we are not exceeding in any case so far.

Indeed. I was misled by their documentation at a github's CI/CD documentation page.

It seems for public repositories there's no such limit.

Then it seems that the only problem is to write a good enough CI script

@Arniiiii check out this PR #28 - I'm adding more architectures there. And we could discuss the details about CI there. 🙂

Indeed. I see you did a good job. I'm currently busy, maybe next weekends I can take a better look at what else can be done.

@vadorovsky vadorovsky force-pushed the full-llvm-toolchain branch 9 times, most recently from 71e83e5 to b83987f Compare November 29, 2024 10:39
@thesamesam
Copy link
Member

The CI failure at https://github.com/gentoo/crossdev/actions/runs/12083265774/job/33696034437?pr=24#step:3:3479 is really odd:

 >>> Emerging (3 of 9) dev-libs/libunistring-1.3::gentoo for /usr/aarch64-unknown-linux-gnu/
Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox")
!!! Fetched file: libunistring-1.3.tar.xz VERIFY FAILED!
!!! Reason: Insufficient data for checksum verification
!!! Got:      
!!! Expected: BLAKE2B BLAKE2S MD5 RMD160 SHA1 SHA256 SHA3_256 SHA3_512 SHA512 WHIRLPOOL

>>> Failed to emerge dev-libs/libunistring-1.3 for /usr/aarch64-unknown-linux-gnu/, Log file:

I don't see how that can happen unless the tree is broken, but it wasn't. I committed that ebuild in 1e31a6372a27b3d2508a5b9fd357cc23b320989d and the Manifest was there, and nothing changed afterwards either.

@vadorovsky
Copy link
Contributor Author

I'm wondering if it has something to do to the fact I'm fetching my custom branch from github here:

# FIXME(vadorovsky): Remove once https://github.com/gentoo/gentoo/pull/39280 is
# merged.
run_in_container bash -c "curl -L https://github.com/vadorovsky/gentoo/archive/cross-llvm.tar.gz | tar -xzf - --strip-components 1 -C /var/db/repos/gentoo"

I'm doing this to test my changes from gentoo/gentoo#39280 - it contains the necessary changes to bootstrap the full LLVM toolchain with crossdev.

Let my try rebasing my branch, but I still don't understand the error. It would mean that this ebuild is somehow broken on my branch.

I'm wondering if I have to do something else apart from unpacking the tarball to /var/db/repos/gentoo.

@thesamesam
Copy link
Member

emerge-webrsync will use non-thin manifests, whereas yours will use thin.

@vadorovsky
Copy link
Contributor Author

I see. Any ideas how to use my branch correctly then? I would like to avoid emerging git and eselect-repository. But if it's really necessary, I can follow https://wiki.gentoo.org/wiki/Portage_with_Git

@thesamesam
Copy link
Member

I don't have a particularly good idea for now. Maybe have the CI script fetch from https://github.com/gentoo-mirror/gentoo (as a tarball) for now.

@vadorovsky
Copy link
Contributor Author

Good idea. If we ditch emerge-websync all together and just use the tarballs from github, we could add an argument to the script for using a custom repo and branch, so testing custom trees would be possible without modifying the script itself.

@thesamesam
Copy link
Member

That'd work for me. No real attachment to emerge-webrsync for this, it was just the first thing I thought of wrt the problem we had before.

@vadorovsky vadorovsky force-pushed the full-llvm-toolchain branch 3 times, most recently from 975610b to 189cc71 Compare December 2, 2024 14:27
compiler-rt and llvm were moved to llvm-core and llvm-runtimes.
Include llvm-libunwind and libcxx in the LLVM-based cross environments,
so they are fully ready to build any package.

Signed-off-by: Michal Rostecki <[email protected]>
That's what sys-apps/baselayout does for all systems, with and without
multilib.

Not doing so breaks behavior of several packages, including
sys-libs/libcxx.

Signed-off-by: Michal Rostecki <[email protected]>
Split the script into functions, to make it more modular.

Introduce two subcommands:

* `run`, which runs `crossdev` and emerges `@system` in one run.
* `shell`, which spawns a container with an interactive shell, letting
  the caller to run custom commands and debug issues.

Add LLVM support by introducing the `--llvm` option (in `run` command).

Use tarballs from GitHub to fetch the potage tree. Allow callers to
specify a custom repository and branch.

Signed-off-by: Michal Rostecki <[email protected]>
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.

3 participants