-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Build SDK with musl #40906
Comments
Right now we don't provide a way to build Dart with |
I've looked into this a bit and the initial blocker is the fact that the build process requires a pre-build dart binary dynamically linked to glibc. Thus you'd need to bootstrap Dart without using pre-built binaries, and so far I've not found instructions or any efforts to do so. |
Any update on this? |
Well, Alpine Linux has been shipping Dart for quite a bit. Bootstrapped from the Windows version of Dart through Wine... |
The wine/dart does not help really if you run docker on Mac M1 It would be really nice if dart-SDK would build on alpine. There are quite some other projects that require it and have now real inconvenient situations for users. |
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment)
I agree, it's really, really bad. But it's a way to get something running. Musl itself isn't really a problem, Dart only needs a few small patches to get it working which should be easy enough to upstream. The issue is the bootstrapping. Dart requires Dart to compile, but when Dart doesn't run on the platform... well you need to have a workaround. In Alpine's case this is Wine right now, but I rather do a full from-source bootstrap, starting from the very last version that doesn't require itself to compile (which is as far as I can see Dart 2.0.0-dev.8.0) and then going up version by version till you're on the most recent one. It's a better chain of trust but also makes it easier to compile it for new architectures, as Wine on anything non-x86 is not that great. It's a pain, and I wish Google cared at least a bit about this. 😢 |
* gem: upgrade to Jeyll 4.3 Which means moving to the Debian-based Ruby image because this upgrade pulls in jekyll-sass-converter 3.0, which doesn't support `sassc` anymore[1]. Instead it relies on sass-embedded[2] which is a proxy around the new Dart SASS implementation[3], which doesn't support musl-based distibutions like Alpine[4]. That's all folks! https://www.youtube.com/watch?v=Iv6C8q_8hJU [1]: https://github.com/jekyll/jekyll-sass-converter/releases/tag/v3.0.0 [2]: https://rubygems.org/gems/sass-embedded [3]: https://github.com/sass/dart-sass-embedded/ [4]: dart-lang/sdk#40906 (comment) * config: only copy DSFR assets once This saves us some painful seconds of IO when regenerating the site so only do it once and prevent Jekyll from overwriting the folder with every subsequent run.
We could merge the necessary runtime patches (given that they are small). As for bootstrapping. I don't think we will provide a full from-source solution, but we could theoretically provide a solution which does not require a prebuilt Dart binary: we simply need to maintain a fixed copy of Dart front-end compiled to Kernel AST, and update it whenever Kernel AST format changes or whenever we update SDK prebuilts. Bootstrapping process can then use this prebuilt CFE to compile the rest of Dart code. I see that Alpine is quite popular for Docker, so maybe we should consider doing that. /cc @athomas @mit-mit |
Using a pre-built anything is not great from a distribution point of view, but it would be way better already than having to bootstrap from a Windows pre-built Dart. So I'd welcome that change yes, thanks. I believe Alpine is the most popular image for Docker containers, but there are also people happy if Dart (and especially Flutter) would run on Alpine outside of Docker 😉 As for the patches used currently to built for Musl:
That is with |
Indeed, gcompat is a much better bootstrap than Wine already. Would pre-built binaries be provided somewhere so Alpine can built a Musl-native build without having a glibc system somewhere? |
The Alpine Wiki mentions three ways to run glibc programs
ref: https://wiki.alpinelinux.org/wiki/Running_glibc_programs There are also several user projects, one that might be interesting for you could be I do not know if anything of that could help you with the bootstrap problem, but I thought it will also not harm to add this info here |
I know how to run such things, but the current glibc Dart doesn't run through gcompat. You need a Dart build with #50998 for that, a.k.a. not the binaries Google currently offers for download. Which is why I'm asking if they're going to offer binaries with tcmalloc disabled for download so that can be used to build a properly native Musl binary. |
I know it's bad practice to +1 these things, but I thought I might add that a few widely used Jekyll plugins have started upgrading their dependencies (e.g. jekyll-include-cache), which included a new transient dependency on the sass-embedded gem, which requires Dart, and most Jekyll build containers are Alpine, so you might be seeing more activity around this. The workaround suggested was to pin the version of a dependency, which will get people by for now, but nobody should have to remain committed to this workaround forever for a number of reasons. We could all probably change our deployment pipelines, but I think this would affect enough people to justify the benefit of adding musl support. Thanks for all of the hard work so far! Looks like you all have made some pretty awesome progress lately! Can't wait for this change! |
I started a project to release unofficial Dart SDK for musl: https://github.com/dart-musl/dart Unofficial releases for musl is available here: https://github.com/dart-musl/dart/releases Also available as alpine based container: The project works as follow:
The whole build and release process is done by GitHub Actions, and you can see the source code if you're interested . I'd happy to contribute this to upstream, but without access to Google's internal infrastructure it is impossible to do it properly. The exact build steps and patch sets I used are open source, so if anyone from Google is willing to take it with Google's infrastructure to provide official musl support, please free feel. Known issues: The arm build do not work on qemu-user-static, which seems to be a long existing qemu bug where There might also be other unknown issues. Please give it a try. |
@ntkme could you make PRs with code patches you have mentioned before? I am happy to merge them if they are reasonable. We also started discussions internally on providing a bootstrap process which does not require a |
@mraleph That sounds great. It will take some time to prepare the PRs as what I did was to replace the Debian sysroot/etc with Alpine sysroot/etc. To upstream, I will have to change the build scripts to supports both. |
PR #51044 is up. I explicitly split it into 4 commits hope for an easier review, but looks like Gerrit just combine them as one. So I will briefly explain here:
|
Dart with tcmalloc can be built against on musl with a proper re-configure described in the documentation: https://github.com/dart-lang/sdk/blob/main/third_party/tcmalloc/README.dart The document mentioned:
However, using the provided It turns out |
This tracker is for issues related to:
Common Front End (CFE) and kernel
Dart VM
dev_compiler
Whether you are using: Void Linux x64 musl
It it somehow possible to build Dart using
musl
compiler instead ofglibc
?The text was updated successfully, but these errors were encountered: