mojodna / heroku-buildpack-cairo

Heroku buildpack with Cairo (and Pixman and FreeType)
34 stars 63 forks source link

Can't build Meteor + Cairo #2

Closed lukejagodzinski closed 9 years ago

lukejagodzinski commented 9 years ago

Hi, I'm trying to use node-canvas with Meteor. Meteor is platform based on Node.js. I've created my own Meteor buildpack for Heroku that works well but it doesn't with Cairo Buildpack.

My BUILDPACK_URL is set to https://github.com/mojodna/heroku-buildpack-multi.git#build-env

and content of .buildpacks file looks like follows:

https://github.com/mojodna/heroku-buildpack-cairo.git
https://github.com/jagi/heroku-buildpack-meteor.git

When building I get the errors that I've placed below. My application works perfectly locally on both MacOS and Ubuntu machines. Do you know what can cause the problem? Maybe my Meteor buildpack can't talk with Cairo? Thanks

canvas: updating npm dependencies -- canvas...
npm WARN package.json packages-for-meteor-smartpackage-e7rkuq@0.0.0 No description
npm WARN package.json packages-for-meteor-smartpackage-e7rkuq@0.0.0 No repository field.
npm WARN package.json packages-for-meteor-smartpackage-e7rkuq@0.0.0 No README data
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:19:25: warning: cairo/cairo.h: No such file or directory
In file included from ../src/Canvas.cc:9:
../src/CanvasRenderingContext2d.h:17:22: warning: cairo-ft.h: No such file or directory
../src/CanvasRenderingContext2d.h:18:10: error: #include expects "FILENAME" or <FILENAME>
../src/Canvas.cc:15:29: warning: cairo/cairo-pdf.h: No such file or directory
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:65: error: 'cairo_status_t' has not been declared
../src/Canvas.h:81: error: ISO C++ forbids declaration of 'cairo_surface_t' with no type
../src/Canvas.h:81: error: 'cairo_surface_t' declared as an 'inline' field
../src/Canvas.h:81: error: expected ';' before '*' token
../src/Canvas.h:82: error: expected ';' before 'inline'
../src/Canvas.h:90: error: ISO C++ forbids declaration of 'cairo_surface_t' with no type
../src/Canvas.h:90: error: expected ';' before '*' token
../src/Canvas.h: In member function 'uint8_t* Canvas::data()':
../src/Canvas.h:83: error: '_surface' was not declared in this scope
../src/Canvas.h:83: error: 'cairo_image_surface_get_data' was not declared in this scope
../src/Canvas.h: In member function 'int Canvas::stride()':
../src/Canvas.h:84: error: '_surface' was not declared in this scope
../src/Canvas.h:84: error: 'cairo_image_surface_get_stride' was not declared in this scope
In file included from ../src/PNG.h:8,
                 from ../src/Canvas.cc:8:
../src/closure.h: At global scope:
../src/closure.h:32: error: 'cairo_status_t' does not name a type
../src/closure.h:41: error: 'cairo_status_t' does not name a type
In file included from ../src/Canvas.cc:8:
../src/PNG.h:67: error: 'cairo_write_func_t' does not name a type
../src/PNG.h:71: error: 'cairo_status_t' does not name a type
In file included from ../src/Canvas.cc:8:
../src/PNG.h: In function 'void canvas_stream_write_func(png_struct*, png_byte*, png_size_t)':
../src/PNG.h:201: error: 'cairo_status_t' was not declared in this scope
../src/PNG.h:201: error: expected ';' before 'status'
../src/PNG.h:205: error: 'status' was not declared in this scope
../src/PNG.h:205: error: 'struct canvas_png_write_closure_t' has no member named 'write_func'
../src/PNG.h:207: error: 'error' was not declared in this scope
../src/PNG.h:207: error: expected primary-expression before ')' token
../src/PNG.h:207: error: expected ';' before 'png_get_error_ptr'
../src/PNG.h:208: error: 'CAIRO_STATUS_SUCCESS' was not declared in this scope
../src/PNG.h: At global scope:
../src/PNG.h:215: error: 'cairo_status_t' does not name a type
In file included from ../src/CanvasRenderingContext2d.h:13,
                 from ../src/Canvas.cc:9:
../src/CanvasGradient.h:21: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasGradient.h:21: error: 'cairo_pattern_t' declared as an 'inline' field
../src/CanvasGradient.h:21: error: expected ';' before '*' token
../src/CanvasGradient.h:23: error: expected ';' before 'private'
../src/CanvasGradient.h:25: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasGradient.h:25: error: expected ';' before '*' token
In file included from ../src/Canvas.cc:9:
../src/CanvasRenderingContext2d.h:39: error: 'cairo_filter_t' does not name a type
../src/CanvasRenderingContext2d.h:40: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasRenderingContext2d.h:40: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:41: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasRenderingContext2d.h:41: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:42: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasRenderingContext2d.h:42: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:43: error: ISO C++ forbids declaration of 'cairo_pattern_t' with no type
../src/CanvasRenderingContext2d.h:43: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:148: error: 'cairo_t' has not been declared
../src/CanvasRenderingContext2d.h:149: error: ISO C++ forbids declaration of 'cairo_t' with no type
../src/CanvasRenderingContext2d.h:149: error: 'cairo_t' declared as an 'inline' field
../src/CanvasRenderingContext2d.h:149: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:150: error: expected ';' before 'inline'
../src/CanvasRenderingContext2d.h:154: error: 'cairo_surface_t' has not been declared
../src/CanvasRenderingContext2d.h:155: error: expected ',' or '...' before '(' token
../src/CanvasRenderingContext2d.h:155: error: 'fn' has incomplete type
../src/CanvasRenderingContext2d.h:155: error: invalid use of 'void'
../src/CanvasRenderingContext2d.h:175: error: ISO C++ forbids declaration of 'cairo_t' with no type
../src/CanvasRenderingContext2d.h:175: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h:176: error: ISO C++ forbids declaration of 'cairo_path_t' with no type
../src/CanvasRenderingContext2d.h:176: error: expected ';' before '*' token
../src/CanvasRenderingContext2d.h: In member function 'void Context2d::setContext(int*)':
../src/CanvasRenderingContext2d.h:148: error: '_context' was not declared in this scope
In file included from ../src/Canvas.cc:19:
../src/JPEGStream.h: At global scope:
../src/JPEGStream.h:110: error: variable or field 'write_to_jpeg_stream' declared void
../src/JPEGStream.h:110: error: 'cairo_surface_t' was not declared in this scope
../src/JPEGStream.h:110: error: 'surface' was not declared in this scope
../src/JPEGStream.h:110: error: expected primary-expression before 'int'
../src/JPEGStream.h:110: error: expected primary-expression before 'int'
../src/JPEGStream.h:110: error: expected primary-expression before 'bool'
../src/JPEGStream.h:110: error: expected primary-expression before '*' token
../src/JPEGStream.h:110: error: 'closure' was not declared in this scope
../src/PNG.h:22: warning: 'void canvas_png_flush(png_struct*)' defined but not used
../src/PNG.h:28: warning: 'void canvas_convert_data_to_bytes(png_struct*, png_row_info*, png_byte*)' defined but not used
../src/PNG.h:45: warning: 'void canvas_unpremultiply_data(png_struct*, png_row_info*, png_byte*)' defined but not used
../src/PNG.h:200: warning: 'void canvas_stream_write_func(png_struct*, png_byte*, png_size_t)' defined but not used
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/app/.meteor/packages/meteor-tool/.1.0.35.ftql1v++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.8.11-ec2
gyp ERR! command "node" "/app/.meteor/packages/meteor-tool/.1.0.35.ftql1v++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/build_ea80d1a08a83d3498c33b31c55ca7a03/web/packages/canvas/.npm/package-new-smekf0/node_modules/canvas
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok 
npm ERR! canvas@1.1.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.1.6 install script.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls canvas
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.11-ec2
npm ERR! command "/app/.meteor/packages/meteor-tool/.1.0.35.ftql1v++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/bin/node" "/app/.meteor/packages/meteor-tool/.1.0.35.ftql1v++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/bin/npm" "install"
npm ERR! cwd /tmp/build_ea80d1a08a83d3498c33b31c55ca7a03/web/packages/canvas/.npm/package-new-smekf0
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/build_ea80d1a08a83d3498c33b31c55ca7a03/web/packages/canvas/.npm/package-new-smekf0/npm-debug.log
npm ERR! not ok code 0
mojodna commented 9 years ago

Hi.

You can use the upstream https://github.com/ddollar/heroku-buildpack-multi.git now; the necessary changes have been merged in.

It looks like your problem steps from clobbering CPATH and CPPATH in the process of installing Node here:

https://github.com/jagi/heroku-buildpack-meteor/blob/master/bin/compile#L41-L42

If you switch it up so that they're appended to (i.e. CPATH=$CPATH:...), it should work.

lukejagodzinski commented 9 years ago

Thank you! :) Now it works! Thanks for great work with this build pack!