mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Improve development setup instructions #31
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @odenix on GitHub (Feb 5, 2024).
I'm trying to build Pkl on Ubuntu 22.04/WSL 2.0.14. (I'd prefer to build directly in Windows but ran into https://github.com/apple/pkl/issues/20 and failing tests.) After reading through
DEVELOPMENT.adoc, I have the following questions:What does "Setup Gradle on your system" entail? (
./gradlew buildseems to work fine without further setup.)How do I make
./gradlew buildNativework? Currently, task:pkl-cli:alpineExecutableAmd64fails with:Further up I see:
Installing package
zlib1g-dev, which contains/usr/lib/x86_64-linux-gnu/libz.a, didn't solve the problem.The good news is that after tinkering with the build scripts to exclude the Alpine build and test tasks,
./gradlew build buildNativesucceeded. So I think I'm pretty close...@bioball commented on GitHub (Feb 6, 2024):
The Alpine executable depends on musl. You can see how we set it up in our CI here: https://github.com/apple/pkl/blob/main/.circleci/jobs/BuildNativeJob.pkl#L78-L90
But, if you just want to build it locally, you should be able to just do
./gradlew linuxExecutableAarch64or./gradlew linuxExecutableAmd64depending on your architecture. But yeah, changing the build script to exclude the Alpine stuff works too!For Gradle: I suppose that also implies setting up the JDK, but evidently enough you've already done that.
@odenix commented on GitHub (Feb 6, 2024):
Thanks for the pointers! I found more info here: https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/#prerequisites-and-preparation
I think most (WSL) Linux users won't bother to set up a musl toolchain. But we'd still like to run the native build as advertised (
./gradlew buildNative). How about only running the Alpine tasks if a musl toolchain (i.e.,~/staticdeps/bin/x86_64-linux-musl-gcc) is present? If this sounds good, I'll send a pull request.Setting up the JDK is mentioned separately. I think "Setup Gradle on your system" should be either detailed or removed.
@bioball commented on GitHub (Feb 6, 2024):
That sounds good!
Feel free to submit a PR for this too (a separate one)
@odenix commented on GitHub (Feb 7, 2024):
Sent https://github.com/apple/pkl/pull/83 for the musl toolchain check.
I'll leave it to you to clarify the "setup Gradle" instructions because I don't know if/what setup you'd like to recommend.
All I can say is that I didn't have to set up anything to build this project.