Closed bitbay closed 8 years ago
Building from inside a heroku instance (last push with NODE_MODULES_CACHE=true
) seems to work fine though...
$ heroku run bash
~ $ rm -rf node_modules
~ $ npm install
No, not a known issue (although I'm not actively using node-canvas on Heroku).
The underlying problem appears to be that the compiler isn't finding gif_lib.h
in any of the standard directories despite paths being set properly. (CPATH
/ CPPPATH
: https://github.com/mojodna/heroku-buildpack-cairo/blob/master/bin/compile#L37-L38)
Are you using any other buildpacks? If so, what's the order in which they're defined?
When running from heroku bash
, does it show compiler output when installing canvas
?
Are you using any other buildpacks? If so, what's the order in which they're defined?
Indeed, i use heroku-buildpack-multi with the following .buildpacks
file:
https://github.com/mojodna/heroku-buildpack-cairo
https://github.com/heroku/heroku-buildpack-nodejs.git
I don´t think that the multiple buildpacks cause the issue.
When running from heroku bash, does it show compiler output when installing canvas?
Yes it does. No errors though, canvas builds fine.
Agreed, multiple buildpacks doesn't seem to be the problem.
Looking back at:
remote: g++ '-DNODE_GYP_MODULE_NAME=canvas' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DHAVE_FREETYPE' '-DHAVE_JPEG' '-DHAVE_GIF' '-DBUILDING_NODE_EXTENSION' -I/app/.node-gyp/5.4.0/include/node -I/app/.node-gyp/5.4.0/src -I/app/.node-gyp/5.4.0/deps/uv/include -I/app/.node-gyp/5.4.0/deps/v8/include -I../../nan -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/canvas/src/CanvasPattern.o.d.raw -c -o Release/obj.target/canvas/src/CanvasPattern.o ../src/CanvasPattern.cc
None of the /app/vendor/<lib>/include
directories are listed as -I
arguments. g++
should be picking them up from CPPPATH
(when not listed), but something in node-canvas / node-gyp may have changed preventing that...
If you're willing to fork the nodejs buildpack w/ debugging information, it would be useful to echo $CPPPATH
early on (or possibly in an additional buildpack slotted after the Cairo buildpack).
ENV_DIR
(referenced in https://devcenter.heroku.com/articles/buildpack-api) may be the underlying problem. Specifically, not using it correctly. It's possible that most apps sneak around the fact that this isn't doing anything because enough of the dependencies are available in the cedar-14 slug.
If you're willing to fork the nodejs buildpack w/ debugging information, it would be useful to echo $CPPPATH early on (or possibly in an additional buildpack slotted after the Cairo buildpack).
thank You for the hint, will give the slotted-buildpack approach a try and post the results!
Quick follow-up on the topic. Did an empty nodejs project with only canvas as a dependency, using multi-buildpacks as recommended, with the only line of echo $CPPPATH
in the bin/detect
script, which gives this result
:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/cairo/include/cairo:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/pixman/include/pixman-1:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/freetype/include/freetype2:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/pango/include/pango-1.0:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/fontconfig/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/harfbuzz/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/pango/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/pixman/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/giflib/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/freetype/include:/tmp/build_3f670ab6a2077b8901c1d178556385d1/vendor/cairo/include:
...
remote: -----> Build succeeded!
remote: └── canvas@1.3.10
The heroku push works as expected, canvas compiles. Will plug the debug buildpack of mine into my live project and see what it does differently...
It seems that the error was specific to some node/npm versions. Using the latest ones from heroku the build works flawlessly.
-----> Installing binaries
engines.node (package.json): 5.6.0
engines.npm (package.json): 3.6.0
Closing, and thanks for the support and quick response @mojodna !
Fantastic, glad it's working!
For people that still experience this issue, the following solved my problem:
Add this buildpack before the Node.js buildpack in Heroku's dashboard.
Getting an error using the latest version of node-canvas (1.3.10) and master branch of heroku-buildpack-cairo, using the method commented in the README.md (pasting the conlicting lines only)
Is this a known issue? Are there workarounds or should i use a specific version of buildpack/canvas?