Skip to content

Loading…

Can't build book from rake #61

Closed
hinmn opened this Issue · 5 comments

3 participants

@hinmn

I'm unable to get the book to build on Linux (Chakra) or OSX (Mountain Lion). Here's the error on OSX (same on Linux, actually):

hinmn-air:sinatra-book hinmn$ bundle exec rake book:build
sh: /Users/hinmn/Development/BooksCode/SinatraBook/sinatra-book/vendor/wkhtmltopdf: cannot execute binary file
rake aborted!
command failed: "/Users/hinmn/Development/BooksCode/SinatraBook/sinatra-book/vendor/wkhtmltopdf" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" "0.75in" "--margin-left" "0.75in" "--encoding" "UTF-8" "--quiet" "-" "-"

Tasks: TOP => book:build
(See full trace by running task with --trace)

I looked through the previous issues but the other failed book builds seemed to be solved. Here's the command with --trace:
https://gist.github.com/c07cb6287f5e54c477a8

@cschneid
Sinatra member

The problem is that wkhtmltopdf is a binary executable, which apparently doesn't work on your system.

Perhaps it's a 64bit vs. 32bit difference?

➜  vendor git:(master) file wkhtmltopdf 
wkhtmltopdf: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped

In fact, I don't appear to be able to run it either:

➜  vendor git:(master) ./wkhtmltopdf 
zsh: exec format error: ./wkhtmltopdf

(On a Mountain Lion system here)

@cschneid
Sinatra member

Anyway - run the Sinatra app (app.rb) to get a browser loadable copy of the book. We should probably add a different rake target to build the html as a file, separate from a rake target to build the pdf, but that doesn't exist at the moment.

@zzak
Sinatra member

I'm open to better ways to bundle the wkhtmltopdf binary in the app, I haven't actually tested it for a while myself.

We should probably add a different rake target to build the html as a file, separate from a rake target to build the pdf, but that doesn't exist at the moment.

Not sure I see the benefit of having both an HTML export and the app, if you want to browse the book via HTML just start rackup the sinatra app. If you know an easy way to implement this tho, go for it.

@hinmn

I haven't checked on Linux yet, but I'm sure it's the same:

-bash: ./wkhtmltopdf: cannot execute binary file

Both are 64-bit systems.

I'm attempting to use a few different bins from here, http://code.google.com/p/wkhtmltopdf/ , but I'll probably have to try on Linux as I'm still not so familiar with OSX (I'm actually new to it - I thought this error was a fault of mine).

@hinmn

I was able to build the book on Chakra Linux using the 64-bit bin provided here: http://code.google.com/p/wkhtmltopdf/downloads/detail?name=wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2&can=2&q=

@zzak zzak closed this in 66ddedc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.