-
Notifications
You must be signed in to change notification settings - Fork 37
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: fix build on Apple Silicon #123
Conversation
I confirmed this works! |
Also see #118 |
liblzma-config.sh
Outdated
if [[ ("$OSTYPE" == "darwin"*) && ($(uname -m) == "arm64") ]]; then | ||
XZ_SRC_DIR=$(ls | grep xz-*) | ||
sed -i.bak 's/\tnone)/\tarm64-*)\n\t\tbasic_machine=$(echo $basic_machine | sed "s\/arm64\/aarch64\/")\n\t\t;;\n\t\tnone)/g' $XZ_SRC_DIR/build-aux/config.sub | ||
rm $XZ_SRC_DIR/build-aux/config.sub.bak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could remove this line and the .bak
on line 17 (leave -i
for in-place replace)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE!
Is this something you have considered submitting upstream? Usually the xz/liblzma maintainer is pretty responsive. |
Even if that was done, can we have a patch for 5.2.3 here to speed things up? It seems like https://tukaani.org/xz/ has a release cadence of years: 5.2.3 was released in 2016, 5.2.4 in 2018, and 5.2.5 in March 2020. |
xz 5.2.3 could be compiled on Apple Silicon devices if we run |
- `liblzma-config.sh`: Make more robust to failure: - Patch for config.sub for Apple Silicon - addaleax#123 - If configure fails, run autogen.sh / autoconf (*) - refactor `build` action in `bindings.gyp` so that config and build scripts output is shown, making troubleshooting easier - `build` action refactored into `build` and `configure` actions with dependencies between them - since `configure` is a separate action instead of a command that runs as part of the 'input' key, it is free to output anything - script output is made less verbose and more clear, so it's not necessary to send to log file - added `manual:config` and `manual:build` targets to `package.json` so it's easier to troubleshoot step-by-step - for reference, add link to XZ library used to README.md (*) The drawback of this is that the fallback to autoconf requires a full autoconf type build environment, but it is a last resort fallback.
Okay, I continued fiddling with #125 following the lead of @tylinux to look into autoconf as well, and and ended up with this algorithm:
In addition I did a few refactorings to improve future troubleshooting, in particular the config and build scripts are less verbose and called in a way so that there is no need to send their output to log files (they are separate actions in bindings.gyp). We're currently on XZ 5.2.3, but XZ 5.2.5 was released two years ago - I tried it, but the config.sub in it also unfortunately doesn't support Apple Silicon. I assume that once XZ 5.3 is released it'll include updated output from I guess we still need to create and upload the prebuilds for Apple Silicon - I assume @addaleax needs to do that. |
I submitted a request to the XZ Utils forum. Meanwhile, for proper history and credit, and since it's somewhat urgent,I suggest you accept this PR (#123) and then I can rebase #125 against it so it's just around the (less urgent and less necessary) refactoring work. |
Add
arm64
toconfig.sub
to support build on Apple Silicon. diff like: