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

Building on Ubuntu x64 #34

Open
dhendo opened this issue Apr 4, 2013 · 46 comments
Open

Building on Ubuntu x64 #34

dhendo opened this issue Apr 4, 2013 · 46 comments

Comments

@dhendo
Copy link

dhendo commented Apr 4, 2013

I'm trying to build on Ubuntu 12.04 so that I can start to poke around with the binding and test some changes.

Steps Taken:

This fails:

platform/qt/WheelEventQt.cpp: In constructor ‘WebCore::PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent*)’:
platform/qt/WheelEventQt.cpp:62:19: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:63:25: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:66:19: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:67:18: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:68:17: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:69:18: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:73:17: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:73:29: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
make: *** [.obj/release-static/WheelEventQt.o] Error 1

This results in libQtWebKit.a not being available for the compile_binary step.

I've had the same issue on an 11.04 and 12.04 machine (the second installed from scratch).

Any ideas?

I'll try with qt 5.0.1 as well shortly.

@dhendo
Copy link
Author

dhendo commented Apr 8, 2013

5.0.1 didn't work either - looks like it would need a re-worked compile_qt.sh as the flags appear to have changed.

@dhendo
Copy link
Author

dhendo commented Apr 24, 2013

Any ideas @deanmao ?

@dlau
Copy link

dlau commented May 9, 2013

@dhendo, recently built this, looks like most of the qt build stuff came from phantomjs.

Try checking out phantomjs at ariya/phantomjs, then put that qt directory in the node-chimera root dir. The build scripts should work fine, else you can use the preconfig.sh file included with phantomjs and shift some files around.

I also had to compile the qt style sheets, so I removed the preprocessor directives for those in the compile_qt.sh

@dhendo
Copy link
Author

dhendo commented May 9, 2013

@dlau Thanks - I'll give that a try and report back

@dhendo
Copy link
Author

dhendo commented May 14, 2013

@dlau Right, I think I got there - in the end.

  • I ended up using a modified version of preconfig.sh, with bits taken from compile_qt.sh. I couldn't get the prefix to work, so ended up copying files.
  • Getting OpenSSL to link statically was a pain. I had to mess around with the linker options in compile_binary.sh until it didn't segfault. (Hint for anyone following - running example.js under gdb is useful: "gdb node" followed by "run example.js" when it segfaults type "bt" + enter. This will show the backtrace.)
  • libfontconfig wasn't in the place that compile_binary.sh was expecting.

I'm now in the position seen in #26 - I now look to be getting errors at the node/binding level rather than Segfaulting

For future reference, all the changes I made are in: dhendo/node-chimera@3b00a5a

@ak5
Copy link

ak5 commented Jun 1, 2013

@dhendo did you get this to work? I am still having trouble both trying to use the chimera.node I get when running npm install chimera or compiling my own.

@dhendo
Copy link
Author

dhendo commented Jun 1, 2013

@alexanderververis Nope - I got what I think is a correctly compiled and linked Qt, OpenSSL and binding, but still get undefined symbol: _ZNK9QMimeData10metaObjectEv when I try run against node 0.10.4

I did spot a new Python based project that is built using Qt5 recently - https://news.ycombinator.com/item?id=5742470 - maybe it would be worth looking into building against Qt5 going forwards?

@ak5
Copy link

ak5 commented Jun 1, 2013

Did you incorporate this patch? #32

@dhendo
Copy link
Author

dhendo commented Jun 1, 2013

Yes, the uv_after_work_cb cast is in dhendo@3b00a5a

@cjpartridgeb
Copy link

@dhendo Thanks for the info regarding compiling on linux, your advice mixed with some other changes got me a working build on Ubuntu 12.04 and node 0.8.x - did you have it working under 0.8.x? I will rebuild under 0.10.x this evening and report back.

@dhendo
Copy link
Author

dhendo commented Jun 3, 2013

@cjpartridgeb No, I never got it working under 0.8.x either.
What extra steps did you take to the ones I outlined + forked?

@cjpartridgeb
Copy link

@dhendo Tested on 0.10 last night with the changes you specified in dhendo@3b00a5a - working binary as well.

I've put my changes here https://gist.github.com/cjpartridgeb/5702641 for the time being, as I don't have git on this machine.

@dhendo
Copy link
Author

dhendo commented Jun 4, 2013

Thanks, I'll give it a go in a clean VM and see how I get on.

@dhendo
Copy link
Author

dhendo commented Jun 4, 2013

Great - it now builds happily on 12.04 - it looks like the major change was to build qt as x86?

I've got the updates in https://github.com/dhendo/node-chimera

Hopefully now I can fiddle with the binding, and expose more useful bits and pieces (hopefully making it possible to render a string of html to an image returned in a byte array that can be returned directly by node)

@cjpartridgeb
Copy link

Glad to hear @dhendo .

I think the main issue was just specifying the correct linking options in the compile_binary.sh script. As when I ran "ldd -r chimera.node" it would show undefined symbols relating to openssl (there were also a bunch for gstreamer and other qt feature dependencies, which are opted out off in the qt configure - so I assume they are safe to ignore).

I'm working on some more robust PDF printing features as we speak, but it appears the standard Qt still has issues that were seen with wkhtmltopdf (https://code.google.com/p/webkit-mirror) - at least from initial inspection.

@dhendo
Copy link
Author

dhendo commented Jun 5, 2013

@cjpartridgeb I've made some changes in my fork:

  • Allow chimera to render directly back to a node Buffer to allow node to server up a response without writing to then reading from the filesystem.
  • Allow an arbitrary html snippet to be rendered without needing to request it over the network
  • Enable chimera to clip the rendered image to an element using a selector
  • Ported rendering code from PhantomJS with a fix for rendering large images

dhendo@233c715

@cjpartridgeb
Copy link

@dhendo awesome stuff - having a browse through your changes now.

In regards to your first note (render directly back to a node Buffer), can you see a way this is possible for the PDF printing? Not being very adept with C++, I'm having trouble seeing how a QPainter would be able to achieve this.

@dhendo
Copy link
Author

dhendo commented Jun 5, 2013

@cjpartridgeb My C++ isn't great either!
It may be possible, although it looks like QPrinter will only take a filename, and won't save to a QIODevice like QImage can. Bug report: https://bugreports.qt-project.org/browse/QTBUG-3510

One way to do it would be to save to file, then immediately load the file into a QByteArray and return that. That would at least save reading the file again in node.

@cjpartridgeb
Copy link

@dhendo I tried sending to "/dev/stdout" and it pumps it straight out of stdout - I guess this would be helpful for a cli utility. However, I'm wondering if there's a way to write to a custom file descriptor and read it back into a byte array/buffer without actually touching disk - will keep investigating

@dhendo
Copy link
Author

dhendo commented Jun 7, 2013

@cjpartridgeb Hmm.. would probably have to be something cross-platform?

@ak5
Copy link

ak5 commented Jun 12, 2013

Hi guys!

I am trying to replicate what you are doing, but I seem to have an error when calling the compile_binary.sh script.

It seems qt didn't compile correctly:

g++: error: ../qt_compiled/lib/libQtWebKit.a: No such file or directory
g++: error: ../qt_compiled/lib/libwebcore.a: No such file or directory

See this gist for the full output: https://gist.github.com/alexanderververis/315ac2624cb9ff9fda67

@cjpartridgeb
Copy link

@alexanderververis

I'd suggest using dhendo's repository, otherwise take a look at my gist above - it has the exact instructions I've used to compile on several Ubuntu based machines.

@dhendo
Copy link
Author

dhendo commented Jun 13, 2013

@alexanderververis Looks like qt didn't build quite right.

As @cjpartridgeb said, try my branch (clean everything down first)
Pay attention to what happens near the end of compile_qt.sh - it links some bits of qt into the qt_compiled directory:

https://github.com/dhendo/node-chimera/blob/master/scripts/compile_qt.sh#L132

@dhendo
Copy link
Author

dhendo commented Jun 13, 2013

Link to a (hopefully) working binary. Compiled on Ubuntu 12.04. May or may not contain the rendering tweaks - I'll get a more recent build up sometime.

https://s3.amazonaws.com/node-chimera-binary/node-chimera-ununtu-12.04-2013-06-13.zip

@ak5
Copy link

ak5 commented Jun 18, 2013

Thanks @dhendo this works well!

@krakatoa
Copy link

Sorry @dhendo just to catch up, I don't understand what has to be working on the master branch. I still have the issue with libQtWebKit.a, and libfontconfig is missing too. To recap, do you still recommend using the phantomjs build mentioned earlier ?

@ak5
Copy link

ak5 commented Jun 18, 2013

@krakatoa I also had issues with libQtWebKit.a but I am currently getting away with using his binary linked above and 'npm install chimera'

@dhendo
Copy link
Author

dhendo commented Jun 18, 2013

@krakatoa Yes, download the phantom source and copy the qt folder to the chimera/qt.

@krakatoa
Copy link

Great @dhendo, thanks! I will try it ;)

@krakatoa
Copy link

@alexanderververis I was all yesterday's afternoon and night trying to link it, now I want to finish that haha ! anyway, thank you too

@deanmao
Copy link
Owner

deanmao commented Jun 18, 2013

Sorry for being late to the party, but hopefully these issues will go away soon. I'm currently moving chimera to Qt5, but many APIs have changed since Qt4, but the good part is that the build process is significantly improved. QPA is standard in Qt5 so the crazy build process may or may not be necessary if you already have Qt5 installed. I'll probably still include the Qt5 as a submodule for systems that may need to build from scratch (like on the mac) due to openssl incompatibilities in nodejs vs qt.

@cjpartridgeb
Copy link

@deanmao Great news, look forward to hacking on the Qt5 version! Thanks for all your hard work

@dhendo
Copy link
Author

dhendo commented Jun 19, 2013

@deanmao Awesome - let me know if there is anything I can do

@krakatoa
Copy link

Same here @deanmao !
hey @dhendo that worked perfectly, a small step missing was to delete ./openssl/test file before compiling.. now I can start testing chimera 👍

@deanmao
Copy link
Owner

deanmao commented Jun 24, 2013

I finished porting it to Qt5, however I will have to think of a new way of packaging/deployment because I could only do a shared library implementation, and thus one would require external Qt5 libraries. For some people, it may be problematic if they run this on heroku or another service that doesn't have Qt5 installed on the system. Building chimera is a lot easier now though.

I'll push my stuff once I figure out what's the best way to deploy this stuff for everyone.

@dhendo
Copy link
Author

dhendo commented Jun 24, 2013

@deanmao Great stuff. Personally, I think I'd be OK with a shared lib implementation - will be using in an environment controlled by Chef, so should be able to get all requirements in place.

I understand that it may be trickier for others to do so on shared platforms.

let me know when you have something I can test out.

@deanmao
Copy link
Owner

deanmao commented Jun 24, 2013

Sure thing. It works great in linux, but I'm building it for osx right now, when that's done I'll package it up and do a npm publish so you all can test.

@cjpartridgeb
Copy link

@deanmao That was quick, good stuff!

@dhendo
Copy link
Author

dhendo commented Jul 3, 2013

Hi @deanmao - got anything for us yet? I'm running into callback issues in the current version, and it's probably wort trying int he new version before getting too much deeper into this.

@deanmao
Copy link
Owner

deanmao commented Jul 9, 2013

I guess I could fork it into 2 versions -- at the moment, the new version requires qt5 to be installed on the system, which would be a show-stopper for those running node on joyent or heroku since they would need a custom AMI with qt5 installed.

@dhendo
Copy link
Author

dhendo commented Jul 9, 2013

That'd be great - a github branch or something. I'm currently debugging the some async work/callback issues with the renderSnippet methods I wrote - so being able to wrok against the new code would be a bonus.

@deanmao
Copy link
Owner

deanmao commented Jul 23, 2013

Sorry about the delay guys. I pushed my branch of the 5.0 stuff -- the downside is that static linking won't work anymore, it's due to a large number of issues, but if you look at the configure script written by the qt people, they explicitly prevent static linking in webkit, probably due to licensing issues. However, if the dynamic linked version works fine, as long as you do the build yourself.

@dhendo
Copy link
Author

dhendo commented Jul 23, 2013

Cool - I'll try get the build working against Ubuntu and report back.

@tpickett
Copy link

@dhendo, did you ever get qt5 working correctly? I have qt4.8 working, but i can't get the thing to click and follow links. don't know if this is a qt issue or if its a chimera issue...

@dhendo
Copy link
Author

dhendo commented Nov 19, 2013

@tpickett Sorry - no, I haven't had time to bang my head against it lately! Did you try @deanmao 's qt5.0 branch?

@tpickett
Copy link

yeah i couldn't get it or the 4.8 to compile correctly. your binary was the only one i could get working in Ubuntu.

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

No branches or pull requests

7 participants