deanmao / node-chimera

A new kind of headless webkit integration for nodejs; a great alternative to phantomjs.
http://www.deanmao.com/2012/08/13/enter-chimera/
MIT License
847 stars 45 forks source link

Error loading native lib on OSX Lion 10.7.5 #36

Closed airportyh closed 11 years ago

airportyh commented 11 years ago

Minimal code

var Chimera = require('chimera').Chimera

var c = new Chimera()

c.perform({
  url: 'http://localhost:7357',
  locals: {},
  run: function(){},
  callback: function(){}
})

Output

$ node play.js
Using the chimera in lib
Error loading chimera in lib

/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/main.js:29
setInterval(webkit.processEvents, 50);
                  ^
TypeError: Cannot read property 'processEvents' of undefined
    at Object.<anonymous> (/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/main.js:29:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/airportyh/Home/Code/chimera_hello/play.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Debugged into it to get more detailed error when trying to load native lib

Error: dlopen(/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/chimera.node, 1): no suitable image found.  Did find:\n\t/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/chimera.node: truncated mach-o error: segment __TEXT extends to 24543232 which is past end of file 13159175
deanmao commented 11 years ago

yeah, it doesn't work with the new node yet. I need to spend some time hacking this soon.

xMythicx commented 11 years ago

What version of node should we be using?

xMythicx commented 11 years ago

For anyone else looking it seems Chimera works with node up to version 0.8.23. Also Chimera does not work well with passport.js when using express. From my testing so far to prevent from getting a segmentation fault you must include Chimera prior to the initialization of passport with the following commands within app.configure

app.use(passport.initialize()); app.use(passport.session());

For me to get around the segmentation fault thus far I have simply added the

var Chimera = require('chimera').Chimera;

at the top of the app.js file then simply pass it to any file needing it. I have yet to run into an issue this way although im sure it is not a complete fix.

Jinjiang commented 11 years ago

The same error occured on my mac 10.9 mavericks, node versions:

{ http_parser: '1.0',
  node: '0.10.5',
  v8: '3.14.5.8',
  ares: '1.9.0-DEV',
  uv: '0.10.5',
  zlib: '1.2.3',
  modules: '11',
  openssl: '1.0.1e' }

It seems that node_modules/chimera/lib/chimera.node loaded error.

TkTech commented 11 years ago

@deanmao Has there been any progress on this in the last 5 months? Is it a non-trivial update?

deanmao commented 11 years ago

It's working over here, but you have to build from source unfortunately. Qt updated their license which prevents static linking for webkit which is why one has to build from source. You can hack their makefile to make it build statically, but I'm guessing they disabled it due to associated licenses on webkit. I've been using it for the past 5 months so "it works for me :-)"

heapwolf commented 11 years ago

So node-chimera can't be installed as a module anymore?