chrisa / node-dtrace-provider

Native DTrace probes for node.js apps
Other
321 stars 68 forks source link

Can't compile in mac osx lion #25

Closed ericchaves closed 11 years ago

ericchaves commented 12 years ago

Hi folks,

When I try to install dtrace-provider in a mac osx lion (10.7.5) the compilation fails with the error below. Any ideas on what could be wrong?

hobbes:node-restify ericchaves$ npm  install dtrace-provider
npm http GET https://registry.npmjs.org/dtrace-provider/0.2.1
npm http 304 https://registry.npmjs.org/dtrace-provider/0.2.1

> dtrace-provider@0.2.1 install /Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-restify/node_modules/dtrace-provider
> node-gyp rebuild

  ACTION binding_gyp_libusdt_target_build_libusdt .
/bin/sh: HD/ericchaves/Projects/nodejs/node-restify/node_modules/dtrace-provider/build/Release/lib.host:/Volumes/Macintosh: No such file or directory
Building libusdt for x86_64
rm -f *.gch
rm -f *.o
rm -f libusdt.a
rm -f test_usdt
rm -f test_usdt32
rm -f test_usdt64
cc  -arch x86_64 -I/usr/local/Cellar/automake/1.12.1/include  -c -o usdt.o usdt.c
cc  -arch x86_64 -I/usr/local/Cellar/automake/1.12.1/include  -c -o usdt_dof_file.o usdt_dof_file.c
as -arch x86_64 -o usdt_tracepoints.o usdt_tracepoints_x86_64.s
cc  -arch x86_64 -I/usr/local/Cellar/automake/1.12.1/include  -c -o usdt_probe.o usdt_probe.c
cc  -arch x86_64 -I/usr/local/Cellar/automake/1.12.1/include  -c -o usdt_dof.o usdt_dof.c
cc  -arch x86_64 -I/usr/local/Cellar/automake/1.12.1/include  -c -o usdt_dof_sections.o usdt_dof_sections.c
rm -f libusdt.a
ar cru libusdt.a usdt.o usdt_dof_file.o usdt_tracepoints.o usdt_probe.o usdt_dof.o usdt_dof_sections.o 
ranlib libusdt.a
  TOUCH Release/obj.target/libusdt.stamp.node
  CXX(target) Release/obj.target/DTraceProviderBindings/dtrace_provider.o
  CXX(target) Release/obj.target/DTraceProviderBindings/dtrace_probe.o
  SOLINK_MODULE(target) Release/DTraceProviderBindings.node
clang: error: no such file or directory: 'HD/ericchaves/Projects/nodejs/node-restify/node_modules/dtrace-provider/libusdt'
make: *** [Release/DTraceProviderBindings.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/ericchaves/.nvm/v0.8.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:215:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/Users/ericchaves/.nvm/v0.8.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-restify/node_modules/dtrace-provider
gyp ERR! node -v v0.8.7
gyp ERR! node-gyp -v v0.6.5
gyp ERR! not ok 
npm WARN optional dep failed, continuing dtrace-provider@0.2.1
hobbes:node-restify ericchaves$ 

Thanks for any help

chrisa commented 12 years ago

It looks like something along the way is struggling with spaces in the build path:

clang: error: no such file or directory: 'HD/ericchaves/Projects/nodejs/node-restify/node_modules/dtrace-provider/libusdt'

That looks like the part of the path after "/Volumes/Macintosh". Could you try installing without npm, by cloning this repo and doing

$ V=1 node-gyp rebuild

in the checkout, which will skip npm and show full paths in the output.

Thanks.

ericchaves commented 12 years ago

Hi @chrisa, I think you got it right. It seems that libusdt-build.sh is the one struggling with the path. Here is the output.

hobbes:node-dtrace-provider ericchaves$ V=1 node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@0.7.3
gyp info using node@0.8.7 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/Users/ericchaves/.node-gyp/0.8.7/tools/gyp/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-dtrace-provider/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ericchaves/.nvm/v0.8.7/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/ericchaves/.node-gyp/0.8.7/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/ericchaves/.node-gyp/0.8.7',
gyp info spawn args   '-Dmodule_root_dir=/Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-dtrace-provider',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  LD_LIBRARY_PATH=/Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-dtrace-provider/build/Release/lib.host:/Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-dtrace-provider/build/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; sh libusdt-build.sh
/bin/sh: HD/ericchaves/Projects/nodejs/node-dtrace-provider/build/Release/lib.host:/Volumes/Macintosh: No such file or directory
Using node: /Users/ericchaves/.nvm/v0.8.7/bin/node
Building libusdt for x86_64
make[1]: *** No rule to make target `clean'.  Stop.
make: *** [.] Error 2
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/ericchaves/.nvm/v0.8.7/lib/node_modules/node-gyp/lib/build.js:232:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/Users/ericchaves/.nvm/v0.8.7/bin/node-gyp" "rebuild"
gyp ERR! cwd /Volumes/Macintosh HD/ericchaves/Projects/nodejs/node-dtrace-provider
gyp ERR! node -v v0.8.7
gyp ERR! node-gyp -v v0.7.3
gyp ERR! not ok 
hobbes:node-dtrace-provider ericchaves$
chrisa commented 12 years ago

Thanks for that - I can replicate this issue by deliberately creating a directory with spaces in its name.

I think that this is a node-gyp bug, though: https://github.com/TooTallNate/node-gyp/issues/65

Are you able to install other node extensions which use gyp and have native components, like the contextify module shown in the bug report?

ericchaves commented 11 years ago

Hi @chrisa, indeed the problem was node-gyp not being able to compile when under a path with spaces. In my case I was able to rename the HD to "Macintosh_HD" and after that all went well.

Cheers,

Eric