fuwaneko / node-protobuf

Google Protocol Buffers wrapper for Node.js [UNMAINTAINED]
180 stars 42 forks source link

Fix os x build again by adding variable LIBPROTOBUF=/usr/local/Cellar/protobuf/2.5.0 #21

Closed h0x91b closed 10 years ago

h0x91b commented 10 years ago

OS X build fail without this...

$ brew install protobuf Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. ==> Downloading http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2

100.0%

==> ./configure --prefix=/usr/local/Cellar/protobuf/2.5.0 --with-zlib ==> make ==> make install ==> Caveats Editor support and examples have been installed to: /usr/local/Cellar/protobuf/2.5.0/share/doc/protobuf ==> Summary /usr/local/Cellar/protobuf/2.5.0: 75 files, 6.2M, built in 84 seconds

$ npm install node-protobuf npm http GET https://registry.npmjs.org/node-protobuf npm http 304 https://registry.npmjs.org/node-protobuf

node-protobuf@1.0.10 install /Users/h0x91b/Desktop/ESBZmq/node_modules/node-protobuf node-gyp rebuild

CXX(target) Release/obj.target/protobuf/protobuf.o ../protobuf.cpp:7:10: fatal error: 'google/protobuf/dynamic_message.h' file not found

include <google/protobuf/dynamic_message.h>

     ^

1 error generated. make: *\ [Release/obj.target/protobuf/protobuf.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/local/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:96:17) gyp ERR! stack at Process._handle.onexit (child_process.js:678:10) gyp ERR! System Darwin 13.0.0 gyp ERR! command "node" "/opt/local/bin/node-gyp" "rebuild" gyp ERR! cwd /Users/h0x91b/Desktop/ESBZmq/node_modules/node-protobuf gyp ERR! node -v v0.8.11 gyp ERR! node-gyp -v v0.12.1 gyp ERR! not ok npm ERR! node-protobuf@1.0.10 install: node-gyp rebuild npm ERR! sh "-c" "node-gyp rebuild" failed with 1 npm ERR! npm ERR! Failed at the node-protobuf@1.0.10 install script. npm ERR! This is most likely a problem with the node-protobuf 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 node-protobuf npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.0.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "node-protobuf" npm ERR! cwd /Users/h0x91b/Desktop/ESBZmq npm ERR! node -v v0.8.11 npm ERR! npm -v 1.1.62 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/h0x91b/Desktop/ESBZmq/npm-debug.log npm ERR! not ok code 0

h0x91b commented 10 years ago

I tested it on two different Mac machines with no success, node-gyp can not find a google/protobuf/dynamic_message.h ... Sorry for delay.

fuwaneko commented 10 years ago

Just to clarify: how did you install nodejs?

h0x91b commented 10 years ago

One mac from source, second one v0.10.13 from pkg... Both have same problem

fuwaneko commented 10 years ago
MacBook-Pro-Mamizou:node-protobuf mamizou$ ls -la /usr/local/include/
total 16
drwxr-xr-x   4 mamizou  admin  136  4 фев 10:05 .
drwxrwxr-x  15 root     admin  510  4 фев 10:03 ..
lrwxr-xr-x   1 mamizou  admin   39  4 фев 10:05 google -> ../Cellar/protobuf/2.5.0/include/google
lrwxr-xr-x   1 mamizou  admin   35  4 фев 10:03 node -> ../Cellar/node/0.10.25/include/node

Ok, from what it seems you don't have symbolic links somehow. Probably conflict between MacPorts and Homebrew? Also I've installed Node form Homebrew, but that should not be the case.

h0x91b commented 10 years ago

OK, my bad, on this mac i have mac ports nodejs v0.8.11... v0.10.25 works fine.

On my secondary mac probably was conflict with original protobuf compilation...

h0x91b commented 10 years ago

I am sorry but i still can not get it work on my secondary mac for some reason... Can you help me find the problem?

h0x91b:ESB-node-driver h0x91b$ V=1 npm --verbose install node-protobuf npm info it worked if it ends with ok npm verb cli [ 'node', npm verb cli '/usr/local/bin/npm', npm verb cli '--verbose', npm verb cli 'install', npm verb cli 'node-protobuf' ] npm info using npm@1.3.24 npm info using node@v0.10.25 npm verb cache add [ 'node-protobuf', null ] npm verb cache add name=undefined spec="node-protobuf" args=["node-protobuf",null] npm verb parsed url { protocol: null, npm verb parsed url slashes: null, npm verb parsed url auth: null, npm verb parsed url host: null, npm verb parsed url port: null, npm verb parsed url hostname: null, npm verb parsed url hash: null, npm verb parsed url search: null, npm verb parsed url query: null, npm verb parsed url pathname: 'node-protobuf', npm verb parsed url path: 'node-protobuf', npm verb parsed url href: 'node-protobuf' } npm verb lock node-protobuf /Users/h0x91b/.npm/091229f5-node-protobuf.lock npm verb addNamed [ 'node-protobuf', '' ] npm verb addNamed [ null, '*' ] npm verb lock node-protobuf@ /Users/h0x91b/.npm/59f82061-node-protobuf.lock npm verb url raw node-protobuf npm verb url resolving [ 'https://registry.npmjs.org/', './node-protobuf' ] npm verb url resolved https://registry.npmjs.org/node-protobuf npm info trying registry request attempt 1 at 17:08:40 npm verb etag "658VIQ3XX5LKN68BMIOCTEFU8" npm http GET https://registry.npmjs.org/node-protobuf npm http 304 https://registry.npmjs.org/node-protobuf npm verb etag node-protobuf from cache npm verb addNamed [ 'node-protobuf', '1.0.10' ] npm verb addNamed [ '1.0.10', '1.0.10' ] npm verb lock node-protobuf@1.0.10 /Users/h0x91b/.npm/c1ebdc57-node-protobuf-1-0-10.lock npm info install node-protobuf@1.0.10 into /Volumes/Work-Case-Sens/src/ESB-node-driver npm info installOne node-protobuf@1.0.10 npm info /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf unbuild npm verb tar unpack /Users/h0x91b/.npm/node-protobuf/1.0.10/package.tgz npm verb lock tar:///Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf /Users/h0x91b/.npm/1c071075-river-node-modules-node-protobuf.lock npm verb lock tar:///Users/h0x91b/.npm/node-protobuf/1.0.10/package.tgz /Users/h0x91b/.npm/33b38c1f-node-protobuf-1-0-10-package-tgz.lock npm info preinstall node-protobuf@1.0.10 npm verb readDependencies using package.json deps npm verb readDependencies using package.json deps npm verb about to build /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf npm info build /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf npm verb linkStuff [ false, npm verb linkStuff false, npm verb linkStuff false, npm verb linkStuff '/Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules' ] npm info linkStuff node-protobuf@1.0.10 npm verb linkBins node-protobuf@1.0.10 npm verb linkMans node-protobuf@1.0.10 npm verb rebuildBundles node-protobuf@1.0.10 npm info install node-protobuf@1.0.10

node-protobuf@1.0.10 install /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf node-gyp rebuild

gyp info it worked if it ends with ok gyp verb cli [ 'node', gyp verb cli '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'rebuild' ] gyp info using node-gyp@0.12.2 gyp info using node@0.10.25 | darwin | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python" in the PATH gyp verb which succeeded python /usr/bin/python gyp verb check python version python -c "import platform; print(platform.python_version());" returned: "2.7.5\n" gyp verb get node dir no --target version specified, falling back to host node version: v0.10.25 gyp verb command install [ 'v0.10.25' ] gyp verb install input version string "v0.10.25" gyp verb install installing version: 0.10.25 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version is already installed, need to check "installVersion" gyp verb got "installVersion" 9 gyp verb needs "installVersion" 9 gyp verb install version is good gyp verb get node dir target node version installed: 0.10.25 gyp verb build dir attempting to create "build" dir: /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/build gyp verb build dir "build" dir needed to be created? /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/build gyp verb build/config.gypi creating config file gyp verb build/config.gypi writing out config file: /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/build/config.gypi gyp verb config.gypi checking for gypi file: /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/config.gypi gyp verb common.gypi checking for gypi file: /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/common.gypi gyp verb gyp gyp format was not specified; forcing "make" gyp info spawn python gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', 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/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/h0x91b/.node-gyp/0.10.25/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/h0x91b/.node-gyp/0.10.25', gyp info spawn args '-Dmodule_root_dir=/Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf', gyp info spawn args '--depth=.', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp verb command build [] gyp verb build type Release gyp verb architecture x64 gyp verb node dev dir /Users/h0x91b/.node-gyp/0.10.25 gyp verb which succeeded for make /usr/bin/make gyp info spawn make gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ] c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/h0x91b/.node-gyp/0.10.25/src -I/Users/h0x91b/.node-gyp/0.10.25/deps/uv/include -I/Users/h0x91b/.node-gyp/0.10.25/deps/v8/include -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-threadsafe-statics -g -mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++ -O3 -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -MMD -MF ./Release/.deps/Release/obj.target/protobuf/protobuf.o.d.raw -c -o Release/obj.target/protobuf/protobuf.o ../protobuf.cpp ../protobuf.cpp:7:10: fatal error: 'google/protobuf/dynamic_message.h' file not found

include <google/protobuf/dynamic_message.h>

     ^

1 error generated. make: *\ [Release/obj.target/protobuf/protobuf.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) gyp ERR! System Darwin 13.0.0 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf gyp ERR! node -v v0.10.25 gyp ERR! node-gyp -v v0.12.2 gyp ERR! not ok npm verb unsafe-perm in lifecycle true npm info node-protobuf@1.0.10 Failed to exec install script npm info /Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules/node-protobuf unbuild npm info preuninstall node-protobuf@1.0.10 npm info uninstall node-protobuf@1.0.10 npm verb true,/Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules,/Volumes/Work-Case-Sens/src/ESB-node-driver/node_modules unbuild node-protobuf@1.0.10 npm info postuninstall node-protobuf@1.0.10 npm ERR! node-protobuf@1.0.10 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-protobuf@1.0.10 install script. npm ERR! This is most likely a problem with the node-protobuf 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 node-protobuf npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.0.0 npm ERR! command "node" "/usr/local/bin/npm" "--verbose" "install" "node-protobuf" npm ERR! cwd /Volumes/Work-Case-Sens/src/ESB-node-driver npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.24 npm ERR! code ELIFECYCLE npm verb exit [ 1, true ] npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Volumes/Work-Case-Sens/src/ESB-node-driver/npm-debug.log npm ERR! not ok code 0

h0x91b:ESB-node-driver h0x91b$ ls -lha /usr/local/include total 200 drwxr-xr-x 30 h0x91b staff 1.0K Feb 16 16:01 . drwxrwxr-x 18 h0x91b staff 612B Oct 24 08:10 .. lrwxr-xr-x 1 h0x91b staff 32B Sep 15 19:17 GL -> ../Cellar/glew/1.10.0/include/GL drwxr-xr-x 35 h0x91b staff 1.2K Sep 15 19:19 SDL lrwxr-xr-x 1 h0x91b staff 36B Sep 15 19:16 boost -> ../Cellar/boost/1.54.0/include/boost -rw-r--r--@ 1 h0x91b staff 1.9K Feb 2 10:33 evdns.h -rw-r--r--@ 1 h0x91b staff 2.7K Feb 2 10:33 event.h drwxr-xr-x 27 h0x91b staff 918B Feb 2 10:33 event2 -rw-r--r--@ 1 h0x91b staff 1.9K Feb 2 10:33 evhttp.h -rw-r--r--@ 1 h0x91b staff 1.9K Feb 2 10:33 evrpc.h -rw-r--r--@ 1 h0x91b staff 1.7K Feb 2 10:33 evutil.h lrwxr-xr-x 1 h0x91b staff 43B Sep 15 19:15 freetype2 -> ../Cellar/freetype/2.4.11/include/freetype2 lrwxr-xr-x 1 h0x91b staff 44B Sep 15 19:15 ft2build.h -> ../Cellar/freetype/2.4.11/include/ft2build.h lrwxr-xr-x 1 h0x91b staff 33B Sep 15 19:15 glm -> ../Cellar/glm/0.9.4.4/include/glm drwxr-xr-x 3 h0x91b staff 102B Feb 2 10:49 google drwxr-xr-x 5 h0x91b staff 170B Feb 3 15:22 hiredis lrwxr-xr-x 1 h0x91b staff 35B Sep 15 19:17 jconfig.h -> ../Cellar/jpeg/8d/include/jconfig.h lrwxr-xr-x 1 h0x91b staff 34B Sep 15 19:17 jerror.h -> ../Cellar/jpeg/8d/include/jerror.h lrwxr-xr-x 1 h0x91b staff 36B Sep 15 19:17 jmorecfg.h -> ../Cellar/jpeg/8d/include/jmorecfg.h lrwxr-xr-x 1 h0x91b staff 35B Sep 15 19:17 jpeglib.h -> ../Cellar/jpeg/8d/include/jpeglib.h drwxr-xr-x 23 h0x91b staff 782B Feb 16 17:02 node lrwxr-xr-x 1 h0x91b staff 34B Sep 15 19:17 pcre.h -> ../Cellar/pcre/8.33/include/pcre.h lrwxr-xr-x 1 h0x91b staff 42B Sep 15 19:17 pcre_scanner.h -> ../Cellar/pcre/8.33/include/pcre_scanner.h lrwxr-xr-x 1 h0x91b staff 46B Sep 15 19:17 pcre_stringpiece.h -> ../Cellar/pcre/8.33/include/pcre_stringpiece.h lrwxr-xr-x 1 h0x91b staff 37B Sep 15 19:17 pcrecpp.h -> ../Cellar/pcre/8.33/include/pcrecpp.h lrwxr-xr-x 1 h0x91b staff 40B Sep 15 19:17 pcrecpparg.h -> ../Cellar/pcre/8.33/include/pcrecpparg.h lrwxr-xr-x 1 h0x91b staff 39B Sep 15 19:17 pcreposix.h -> ../Cellar/pcre/8.33/include/pcreposix.h drwxr-xr-x 18 h0x91b staff 612B Feb 2 10:41 thrift -rw-r--r--@ 1 h0x91b staff 14K Jan 14 11:36 zmq.h -rw-r--r--@ 1 h0x91b staff 3.5K Jan 14 11:36 zmq_utils.h

Protobuf installed from brew... h0x91b:ESB-node-driver h0x91b$ stat /usr/local/include/google/protobuf/descriptor.h 16777220 16588246 lrwxr-xr-x 1 h0x91b staff 0 67 "Feb 16 15:50:10 2014" "Feb 16 15:50:10 2014" "Feb 16 15:50:10 2014" "Feb 16 15:50:10 2014" 4096 8 0 /usr/local/include/google/protobuf/descriptor.h

nodejs version: v0.10.25 - from source code npm version: 1.3.24

h0x91b commented 10 years ago

CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib/ V=1 npm install node-protobuf

The only way that i can build it :( , for some reason, npm completely ignores /usr/local/include && /usr/local/lib

fuwaneko commented 10 years ago

@h0x91b that's really strange behavior. Could you try adding these flags to gypfile and see if it works?

h0x91b commented 10 years ago

it works if i define it in gyp... https://github.com/fuwaneko/node-protobuf/pull/23