brettlangdon / NodeLua

Lua Bindings For Node.JS
85 stars 21 forks source link

Doesn't work with multipack+lua buildpack + node buildpack #10

Open lilith opened 10 years ago

lilith commented 10 years ago

NodeLua fails to build on heroku using multipack + lua + node buildpacks.

https://github.com/ddollar/heroku-buildpack-multi.git -> https://github.com/nathanaeljones/heroku-buildpack-lua.git https://github.com/heroku/heroku-buildpack-nodejs.git

   > nodelua@0.3.1 install /tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/node_modules/nodelua
   > node-gyp rebuild

   gyp http GET http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
   gyp http 200 http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
   gyp: Call to 'lua -v 2>&1 | grep -o '[0-9]\.[0-9]'' returned exit status 1.
   gyp ERR! configure error
   gyp ERR! stack Error: `gyp` failed with exit code: 1
   gyp ERR! stack     at ChildProcess.onCpExit (/tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
   gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
   gyp ERR! System Linux 3.8.11-ec2
   gyp ERR! command "node" "/tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
   gyp ERR! cwd /tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/node_modules/nodelua
   gyp ERR! node -v v0.10.24
   gyp ERR! node-gyp -v v0.12.1
   gyp ERR! not ok
   npm ERR! nodelua@0.3.1 install: `node-gyp rebuild`
   npm ERR! Exit status 1
   npm ERR!
   npm ERR! Failed at the nodelua@0.3.1 install script.
   npm ERR! This is most likely a problem with the nodelua 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 nodelua
   npm ERR! There is likely additional logging output above.

   npm ERR! System Linux 3.8.11-ec2
   npm ERR! command "/tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/vendor/node/bin/node" "/tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/.npmrc" "--production"
   npm ERR! cwd /tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d
   npm ERR! node -v v0.10.24
   npm ERR! npm -v 1.3.21
   npm ERR! code ELIFECYCLE
   npm ERR!
   npm ERR! Additional logging details can be found in:
   npm ERR!     /tmp/build_20ae2356-4264-4c68-83ef-35748a95c82d/npm-debug.log
   npm ERR! not ok code 0
brettlangdon commented 10 years ago

hmm, this is what failed:

gyp: Call to 'lua -v 2>&1 | grep -o '[0-9]\.[0-9]'' returned exit status 1.

Are you installing the Lua binary as well as the libraries?

It seems like that portion of the build script isn't being used anymore, can probably get rid of it.

brettlangdon commented 10 years ago

@nathanaeljones I just published version v0.3.2 to npm which removes that offending portion of the binding.gyp, please try that version and let me know if it is still failing.

lilith commented 10 years ago

I can confirm that lua is being installed to $BUILD_DIR/bin (/app/bin), see https://gist.github.com/nathanaeljones/8277037 and https://github.com/leafo/heroku-buildpack-lua

However, it seems possible that the path variables might not be persisting between the lua and node buildpacks, although I can't yet tell where that could be happing, if it is.

> nodelua@0.3.2 install /tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/node_modules/nodelua
   > node-gyp rebuild

   gyp http GET http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
   gyp http 200 http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
   gyp: Call to 'pkg-config --libs-only-l --silence-errors lua || pkg-config --libs-only-l --silence-errors lua5.1' returned exit status 1.
   gyp ERR! configure error
   gyp ERR! stack Error: `gyp` failed with exit code: 1
   gyp ERR! stack     at ChildProcess.onCpExit (/tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
   gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
   gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
   gyp ERR! System Linux 3.8.11-ec2
   gyp ERR! command "node" "/tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
   gyp ERR! cwd /tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/node_modules/nodelua
   gyp ERR! node -v v0.10.24
   gyp ERR! node-gyp -v v0.12.1
   gyp ERR! not ok
   npm ERR! nodelua@0.3.2 install: `node-gyp rebuild`
   npm ERR! Exit status 1
   npm ERR!
   npm ERR! Failed at the nodelua@0.3.2 install script.
   npm ERR! This is most likely a problem with the nodelua 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 nodelua
   npm ERR! There is likely additional logging output above.

   npm ERR! System Linux 3.8.11-ec2
   npm ERR! command "/tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/vendor/node/bin/node" "/tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/vendor/node/bin/npm" "install" "--userconfig" "/tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/.npmrc" "--production"
   npm ERR! cwd /tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1
   npm ERR! node -v v0.10.24
   npm ERR! npm -v 1.3.21
   npm ERR! code ELIFECYCLE
   npm ERR!
   npm ERR! Additional logging details can be found in:
   npm ERR!     /tmp/build_efe4201c-e09a-40ed-8d05-12edaf5522e1/npm-debug.log
   npm ERR! not ok code 0
brettlangdon commented 10 years ago

Hmm, well, the previous error has stopped now at least.

Can you try running: pkg-config --libs-only-l --silence-errors lua || pkg-config --libs-only-l --silence-errors lua5.1 manually and pasting the output?

Do you have the command pkg-config available?

lilith commented 10 years ago

This is most likely an PATH bug between the buildpacks. Both buildpacks run as child processes of the multi-pack. Thus, the exported PATH variable is lost in-between. Not your fault, looking for a solution now.

brettlangdon commented 10 years ago

Alright, just let me know if you are able to solve it, if not there might be a few tricks we can try.

lilith commented 10 years ago

Is there any way to echo out the current PATH to see if it's arriving?

brettlangdon commented 10 years ago

You mean while building NodeLua? Or just in general?

lilith commented 10 years ago

While building NodeLua. I've modified all the buildpacks to give me that info, and it looks correct.

brettlangdon commented 10 years ago

Are you able to run commands manually to test things? I'd like to see the output of that pkg-config command since that is where the error is coming from.

lilith commented 10 years ago

I'm pretty sure pkg-config can be accessed, but it doesn't look like it can find lua. Perhaps it's a file permissions issue.

lilith commented 10 years ago

Nope, tested that it can find and use lua. It's not finding the lua header files, since in a heroku buildpack nothing is in a standard location. I can expose an environment variable LUA_INCDIR that includes the lua *.h files.

brettlangdon commented 10 years ago

@nathanaeljones I have committed 709d3647bf1b4e2a87fff46c407cb46cd9b454fb in hopes that that fixes your issue.

I have not published to npm yet, are you able to test by using the github url for this repo?

NODELUA_INCLUDE=/path/to/lua.h/ NODELUA_FLAGS=-llua5.1 npm install git://github.com/brettlangdon/NodeLua
brettlangdon commented 10 years ago

Any luck here @nathanaeljones