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

Added RaspberryPi 3 support by adding binary and detection for Linux armhf #39

Closed
wants to merge 1 commit into from

Conversation

Kostadin
Copy link
Contributor

@Kostadin Kostadin commented Apr 5, 2017

The wkhtmltopdf_linux_armhf binary version is 0.12.3-dev (with patched QT).

The binary was downloaded from here: https://github.com/wkhtmltopdf/wkhtmltopdf/files/720814/wkhtmltopdf.zip

The link for the binary was from the discussion here:
wkhtmltopdf/wkhtmltopdf#1868

Tested on RaspberryPi 3 running Raspbian 8.0 with JRuby 1.7.19, Java 1.8.0_65.

Version bump recommended.

… processor achitecture. Tested on RaspberryPi 3.
@unixmonkey
Copy link
Collaborator

Nice. I have a few RPis I could give this a spin on.

Do you know if the detection command is available across distributions?

I found this post which recommends

dpkg --print-architecture

But that supposes you are on a debian-like distribution.

Opening this up to all the different architectures makes me a little bit worried about adding more bloat to this already large gem. I wonder if we could compress the binaries and either unpack them on gem install, or unpack them first time they are used.

@Kostadin
Copy link
Contributor Author

Kostadin commented Apr 5, 2017

The current detection method for Linux/armhf should work on all Linux distributions that have the readelf and grep utilities and support /proc/self/exe. Additional testing is welcome!

I avoided "dpkg --print-architecture" because in order to use that you need dpkg. It is included by default in Debian-like distributions but other distributions use different package managers.

As for opening up to more architectures, I think this
#28
should be addressed. Windows should not be ignored. Raspberry Pi should not be ignored either. Both have significant number of users.

Wkhtmltopdf is great. Ruby is great. Having them both run on as many popular OSes and architectures would be ideal. The sizes of the binaries are indeed a concern. The current binaries are around 40 MB each.

Unzipping on gem install and on first use sounds reasonable. Downloading them and then unzipping them would probably save even more space and network bandwidth. It might complicate some deployment setups so it needs to be implemented carefully.

I think the gemspec's platform value was meant for cases just like these.
http://guides.rubygems.org/specification-reference/#platform=

This would require publishing multiple versions of the gem. It can probably work fine for native rubies for which the platform string is something like "x86_64-linux" but it won't solve the problem for JRuby's case where Ruby runs on top of the JVM. In those cases the platform strings are like "universal-java-1.7" or "universal-java-1.8" so Bundler won't be able to figure it out on its own without further complications. For the time being it seems the easiest option for detection of the platform is the RbConfig::CONFIG hash combined with further queries as is the case for armhf.

For the issue at hand, it is better to support Linux/armhf than not to support it. You cannot ignore more than 10 million Raspberry Pi units.

@GGGunrunner
Copy link

GGGunrunner commented Apr 6, 2017

Great work!

Not sure if it's ok to post in this branch - but can this be done to wkhtmltoimage aswell?

It segfaults like crazy

root@:# wkhtmltoimage https://google.com out.png
Segmentation fault
root@:# export DISPLAY=:0
root@:# wkhtmltoimage https://google.com out.png
Invalid MIT-MAGIC-COOKIE-1 keyQXcbConnection: Could not connect to display :0
Aborted

@ckarrie
Copy link

ckarrie commented Jun 18, 2017

Thanks for the great app and RPI3 support.

Unfortunately, i don't get the binary to work on my RPi3, it's Debian stretch (no Ruby or Java installed) - installed from https://wiki.debian.org/RaspberryPi3 (section Preview image)

My steps:

  • wget <Link in comment 1>
  • unzip wkhtmltopdf.zip
  • chmod +x wkhtmltopdf
  • ./wkhtmltopdf results in File not found error
  • bash wkhtmltopdf results in "Cannot excecute file" (poorly translated ;-))

Any ideas? Do i need Ruby or Java installed?

dpkg --print-architecture reports arm64

EDIT:

  • Installed rubygems apt-get install rubygems
  • running gem: gem install wkhtmltopdf-binary
  • binary compiled successfully
  • running wkhtmltopdf failed:

root@rpi3:# wkhtmltopdf
/var/lib/gems/2.3.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_x86: 1: /var/lib/gems/2.3.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_x86: Syntax error: "(" unexpected
root@rpi3:# wkhtmltopdf -V
/var/lib/gems/2.3.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_x86: 1: /var/lib/gems/2.3.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_x86: Syntax error: "(" unexpected

@Kostadin
Copy link
Contributor Author

The added binary is for armhf, not for arm64. The binary is tested and confirmed to work on Debian 8 (jessie) for armhf on Raspberry Pi 3. Debian 9 (stretch) was realeased way after this pull request was made so there is no support for it currently. If you can't use Debian 8, try finding wkhtmltopdf compiled for arm64.

@ashkulz
Copy link

ashkulz commented May 1, 2018

Would appreciate someone testing and giving feedback on the raspbian build available from

https://builds.wkhtmltopdf.org/0.12.5-dev/wkhtmltox_0.12.5-0.20180430.129.dev~1744d93~raspbian.stretch_armhf.deb

@pedrofurtado
Copy link
Contributor

@unixmonkey Maybe we can close this PR for a while, because it handles an old version of wkhtmltopdf, not supported by gem anymore (0.12.3) 👍

@unixmonkey unixmonkey closed this Jul 24, 2021
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.

6 participants