chrisdew / protobuf

Protocol Buffers for Node.JS
http://code.google.com/p/protobuf-for-node/
Apache License 2.0
234 stars 70 forks source link

Build error on OS X (node v0.6.6) #1

Closed dolphin278 closed 12 years ago

dolphin278 commented 12 years ago

Mac OS 10.7.2, NodeJs v0.6.6

when invoking npm install protobuf got following error:

Waf: Entering directory `/Users/dolphin278/Playground/rfc/library/node_modules/protobuf/build'
[1/7] cxx: protobuf_for_node.cc -> build/Release/protobuf_for_node_1.o
[2/7] cxx: addon.cc -> build/Release/addon_2.o
[3/7] cxx: example/protoservice.pb.cc -> build/Release/example/protoservice.pb_3.o
[4/7] cxx: example/protoservice.cc -> build/Release/example/protoservice_3.o
../protobuf_for_node.cc:28:17: error: eio.h: No such file or directory
../protobuf_for_node.cc: In static member function ‘static void protobuf_for_node::WrappedService::AsyncInvocation::Start(protobuf_for_node::WrappedService*, google::protobuf::MethodDescriptor*, google::protobuf::Message*, google::protobuf::Message*, protobuf_for_node::Schema::Type*, v8::Handle<v8::Function>)’:
../protobuf_for_node.cc:562: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(eio_req*)’
../protobuf_for_node.cc:562: error:   initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, int (*)(eio_req*), void*)’
Waf: Leaving directory `/Users/dolphin278/Playground/rfc/library/node_modules/protobuf/build'
Build failed:  -> task failed (err #1): 
    {task: cxx protobuf_for_node.cc -> protobuf_for_node_1.o}
chrisdew commented 12 years ago

Thanks for trying this.

Did you read the readme? https://github.com/chrisdew/protobuf#readme

protobuf only works on node 0.4.x and has only been tested on Ubuntu.

I'll leave this issue open and close it when protobuf works with node 0.6.x

In the meantime I'll update the packet.json file to make it impossible to install protobuf on 0.6.x

All the best,

Chris.

dolphin278 commented 12 years ago

Thank you for your answer.

serkangunes commented 12 years ago

Hi I managed to get this compiling for Mac OS X 10.6.x with node 0.6.x It is because of changes to eio_custom function deployed with node. Also node is looking for eio.h in the same directory however this file is located in uv-private directory under node includes so copying this header to the parent directory solves the problem.

For the compile issue, Run method on line 593 needs to be void instead of returning int.

However I still don't know how to covert this into nodejs module.

Any ideas?

chrisdew commented 12 years ago

There is a new version of protobuf on npm now - http://search.npmjs.org/#/protobuf . I've tested that it works with Node 0.6.9 on Ubuntu. Could you have a look with OSX please?

kennberg commented 12 years ago

I'm trying to get this to work right now on OSX node v0.6.14.

Example is failing:

[4/7] cxx: example/protoservice.cc -> build/Release/example/protoservice_3.o In file included from ../example/protoservice.cc:18: ../example/protoservice.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is ../example/protoservice.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update ../example/protoservice.pb.h:14:2: error: #error your headers. In file included from ../example/protoservice.pb.cc:4: ../example/protoservice.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is ../example/protoservice.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update ../example/protoservice.pb.h:14:2: error: #error your headers. In file included from ../example/protoservice.pb.cc:4: ../example/protoservice.pb.h: In member function ‘void pwd::Entry::clear_name()’: ../example/protoservice.pb.h:412: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’ ...

kennberg commented 12 years ago

Disabling the example gives the next error:

../protobuf_for_node.cc: In constructor ‘protobuf_for_node::Schema::Schema(v8::Handlev8::Object, const google::protobuf::DescriptorPool*)’: ../protobuf_for_node.cc:104: error: ‘class google::protobuf::DynamicMessageFactory’ has no member named ‘SetDelegateToGeneratedFactory’

kennberg commented 12 years ago

I had an older version of protoc installed. I re-installed with 2.4.1 and had to delete protobuf module, then re-run npm install. It works for me now. Sorry about the previous 2 comments, looks like they were because of protoc 2.2.0, which is needed for objective-c.

kennberg commented 12 years ago

My coworker had the problem with "Unable to load shared library /node_modules/protobuf/build/Release/protobuf_for_node.node" on his Mac. He had to run: export DYLD_LIBRARY_PATH=/node_modules/protobuf/build/Release:/usr/local/lib:$DYLD_LIBRARY_PATH

chrisdew commented 12 years ago

Hi Kennberg,

Would you mind spending a couple of minutes editing the project's README.md to provide some notes for OSX users?

(You can now fork-and-edit online with Github, and they make it really easy to send me a pull request.)

Thanks,

Chris.

On 27 April 2012 07:55, kennberg reply@reply.github.com wrote:

My coworker had the problem with "Unable to load shared library /node_modules/protobuf/build/Release/protobuf_for_node.node" on his Mac. He had to run: export DYLD_LIBRARY_PATH=/node_modules/protobuf/build/Release:/usr/local/lib:$DYLD_LIBRARY_PATH


Reply to this email directly or view it on GitHub: https://github.com/chrisdew/protobuf/issues/1#issuecomment-5375483

chrisdew commented 12 years ago

@kennberg - Thanks. Is this issue closed?

kennberg commented 12 years ago

Yes

michaelritsema commented 12 years ago

I've seen an export fix for this all around the interwebs. I can't say they are wrong but on my OS X install this is the correct path:

export DYLD_LIBRARY_PATH=/Users/me/node_modules/protobuf/build/Release:/usr/local/lib/node_modules/