-
Notifications
You must be signed in to change notification settings - Fork 147
Is there any hope of a macOS ARM build? #98
Comments
Doesn't it work with Rosetta? |
I'm also interested in this, currently getting:
|
Can you install the |
@fritzfr what is the processor that you're running on? This thread concerns a request to run on ARM processors (under a Mac OS), while the -amd64 you mention is (AFAIK) for an Intel-compatible architecture. |
I have a similar issue, does not work when I enable rosetta either. |
@Snarik what is the error you get? |
It's working for me. Installed via Homebrew on the terminal in Rosetta mode. |
I don't have access to a M1 and I think it'll hard to port Qt4 to it, unless the arm64 support works as-is. So Rosetta seems to be the only option for the foreseeable future. |
I still haven't been able to use the wkhtmltopdf right, it looks like it's not accessing my localhost (my apache and php were installed natively, without rosetta, I think that's the problem). It generates the pdf, but without the project's css. If I can't solve it, I think I'll have to use a docker = ( |
This was the solution for me. I had to completely remove Brew, start my terminal in rosetta mode, reinstall it, and then build my packages. |
I'll probably have to do that too, since I installed everything natively except wkhtml. |
Yeah brew just does screwy things when you try to install it as ARM64. Better to just run your whole dev env as x86, the performance hit is minor I've found. Good luck. |
I managed to solve my problem by changing the hosts to the project's hostname. That way I didn't have to reinstall everything in Rosetta mode. Example: In this way, he loaded the entire css of the project in the pdf normally. Updating the solution that worked for me: I hope I helped in some way. |
Has anyone had any luck installing wkhtmltopdf in a Docker container on an M1 Mac? I just got a new dev machine for work, and one of the steps in our custom Dockerfile is the following:
This fails when I build the container due to the package architecture and system architecture mismatch.
My next step was going to be attempting to run my terminal in Rosetta mode to see if it will build that way. (EDIT: It did not work; receiving the same error.) EDIT: Ahh, nevermind. Didn't realize there was an ARM version of that release. I swapped my Dockerfile to use wkhtmltox_0.12.6-1.stretch_arm64.deb instead and was able to get the install to complete. |
I believe that this issue can now be closed with @jtelcontar solution above:
|
@cclauss that solves the docker based workflow, not a native mac package for M1 so I think this issue should still remain open. |
I ran into a similar issue mentioned by jtelcontar. I have a Docker package that I usually run on an UBUNTU host and also an Intel Mac. In the DockerFile I have this:
and that works fine for the Intel Mac and UBUNTU server (a Dell R710 Xeon). I'd have to look at the error on the M1 because that is a collaborator, but it is an architecture error message. I tried changing to arm64, and that also gives an error with buster build from Downloads for the arm architecture. It might be that I need to make some additional adjustments in my build ? Previously I also think I got wkhtmltopdf to work via Docker by using apt install wkhtmltopdf with a Debian Docker container and then also adding some additional packages, like xvfb and others. That was without using the .deb package and it had / has QT support. I like using the pre-built .deb packages, but using apt install is not a bad option either. |
#!/bin/bash -x
set -e
# https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb
# https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb
# If running on an M1 Mac...
if [[ "${TARGETARCH}" == "arm64" ]]; then
WKHTMLTOX_URL="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1"
WKHTMLTOX_DEB="wkhtmltox_0.12.6-1.buster_arm64.deb"
else
WKHTMLTOX_URL="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5"
WKHTMLTOX_DEB="wkhtmltox_0.12.5-1.buster_amd64.deb"
fi
wget ${WKHTMLTOX_URL}/${WKHTMLTOX_DEB}
sudo dpkg -i ${WKHTMLTOX_DEB}
rm ${WKHTMLTOX_DEB} |
Christian, I'll give that a try, thanks. Might have to clean up my DockerFile. Below is part of what I had. I think I am using just one of those PIP modules, and not sure if I need the font-packages if I am using the .deb package.
|
Do Put all your Put all your |
I'll give that a try. Thanks. I take it I could add what you suggested to my docker-entrypoint.sh somehow ? What is shown below is what is currently there in the entrypoint. DockerFile
docker-entrypoint.sh
Docker Build log
|
any progress? |
I think my statement earlier was pretty clear? |
is QT 6 available to build this project? I see qt6 support mac os m1 in https://www.qt.io/blog/qt-on-apple-silicon |
Please read https://wkhtmltopdf.org/status |
I was able to install homebrew natively without using Rosetta mode. This link provides a good set of instructions which worked for me (m1 max). https://www.funkyspacemonkey.com/how-to-install-homebrew-on-m1-macs-running-macos-monterey |
I'm not much of a Mac person but I have a 2021 MacBook Pro with M1 silicon. I believe I have found a couple of ways to work around this. There may be a reason why my approaches are bad. If so please enlighten me. First approach: This is based on my having installed wkhtmltopdf using brew:
This approach needs to be coded into the application. It likely needs a coding decision similar to the alternative approach below. Alternative approach: Monkey patch the gem file ./gems/wkhtmltopdf-binary-0.12.5.1/bin/wkhtmltopdf changing line 27 from
to
I presume the correct approach is to raise a PR against the wkhtmltopdf-binary gem which includes a correctly compiled binary and a modification to the code that selects the correct binary. I don't know about building a binary, nor whether using the one provided by brew would be in contravention of any licensing rules. I've also noticed there are quite a few PRs to add binaries that are yet to be merged. So I offer this workaround. Please let me know if either of them will lead to pdf generation problems. Obviously I realise the monkey patch will be wiped out by the next gem update. |
If anyone is still struggling with installing |
Can confirm this works with PHP on a MacBook from 2022 running an apple silicon chip. |
Running a 2023 Macbook Pro M2 Pro without Roseta support $ uname -a
Darwin xxx 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:46 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6020 arm64 $ brew install wkhtmltopdf
...
$ /usr/local/bin/wkhtmltopdf
zsh: bad CPU type in executable: /usr/local/bin/wkhtmltopdf |
Installing wkhtmltopdf in a Docker container on M1 Mac. The code in the Dockerfile:
|
How did you manage this?
|
This is working fine for me, however I am hoping to generate the libwkhtmltox.dylib file. Is there any documentation on how these are generated and how I might build on for Mac ARM? |
@TimZander you need to run it via Rosetta. |
I use wkhtmltopdf in various projects that run on macOS. As far as I know, there are no binaries for Apple Silicon (M1), and I haven't figured out how to build on an M1 Mac.
Is there any hope of getting an ARM build for the Mac?
Thanks to any help and advice.
The text was updated successfully, but these errors were encountered: