capnproto / node-capnp

Cap'n Proto bindings for Node.js
BSD 2-Clause "Simplified" License
254 stars 35 forks source link

Unable to locate package capnproto-dev #25

Open sirudog opened 8 years ago

sirudog commented 8 years ago

I try to install the dev headers before installing node-capnp as the doc says: sudo apt-get install nodejs-dev nodejs-legacy capnproto-dev

I get this error: Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package capnproto-dev

I use ubuntu 14.04. So far I was not able to locate this package anywhere, did the installation steps change?

kentonv commented 8 years ago

Hmm, I don't quite recall if Cap'n Proto was in Ubuntu 14.04 -- sounds like it wasn't. But note that Cap'n Proto is still pretty young and changing frequently. The current node-capnp code requires Cap'n Proto 0.5.x, which is available in Debian unstable/testing; I'm not sure if it has made it into Ubuntu at all yet.

sirudog commented 8 years ago

Sorry for the delay, I had to put this aside for a while.

I have cloned the node-capnp repo and finally I could build it from source on Ubuntu, but I had to use the headers from capnp master branch. The problem is that in the project I work on we have a c++ backend with a nodejs front end, and we try to use the same version of the c++ capnp lib to avoid incompatibility issues and streamline our build process. So far in our c++ backend we used the latest release version (0.5.3), and according to your previous comment, the current node-capnp also requires 0.5.x. But if I use the headers from this release, I have errors during build like:

./src/node-capnp/capnp.cc: In member function ‘capnp::Orphancapnp::DynamicValue v8capnp::{anonymous}::FromJsConverter::orphanFromJs(capnp::StructSchema::Field, capnp::Orphanage, capnp::Type, v8::Handlev8::Value)’: ../src/node-capnp/capnp.cc:1283:18: error: ‘class capnp::Type’ has no member named ‘whichAnyPointerKind’ if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) { ^ ../src/node-capnp/capnp.cc:1283:76: error: ‘capnp::schema::Type::AnyPointer::Unconstrained’ has not been declared if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) {

Would it be possible to bind node-capnp to the latest release of capnp? The master branch is changing constantly and we cannot risk to use it in our project (even if we could just use it in our c++ backend easily, as right now node-capnp requires this version)

sirudog commented 8 years ago

There is one more issue, unfortunately when I require the capnp module that I built myself, I get this error: Error: /home/dev/Projects/Playground/NodejsWrapperCapnProto/node_modules/capnp/bin/linux-x64-v8-3.14/capnp.node: undefined symbol: _ZNK2kj9EventPort4wakeEv at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/dev/Projects/Playground/NodejsWrapperCapnProto/node_modules/capnp/src/node-capnp/capnp.js:47:15)

This is when I execute npm test, or when I just require it in my nodejs app. (var capnp = require("capnp");) Do you maybe know what is wrong here?

kentonv commented 8 years ago

Not sure about the undefined symbol error, but I agree in any case that you should stick to the release version of Cap'n Proto. It sounds like we've accidentally introduced some incompatibility between node-capnp master and Cap'n Proto 0.5.x. I believe, though, that the most recent version of node-capnp published to the npm repository should work with Cap'n Proto 0.5.x. Can you try installing node-capnp from npm, with Cap'n Proto 0.5.3 installed locally from source?

sirudog commented 8 years ago

Thanks for your help, based on your reply I checked around and noticed that I had some capnp and kj headers of unknown origin in /usr/include folder. I have removed these, and as you suggested I installed Cap'n Proto 0.5.3 from source. All went fine, I also got the headers in /usr/local/include folder. Then finally I could install capnp-node from npm with 'npm install capnp' command. But when I try to use it in my app, or run 'npm test' in capnp module folder, I still get the undefined symbol error, same as before: undefined symbol: _ZNK2kj9EventPort4wakeEv Looks like something is wrong with linking to kj lib, any idea what can go wrong there?

kentonv commented 8 years ago

_ZNK2kj9EventPort4wakeEv should be in libkj-async.so. It should be in 0.5.x but may not have been present in previous versions. Is it possible there is a bogus copy of libkj-async.so hiding somewhere on your system?

mitar commented 8 years ago

I have a similar problem. I am working on a Meteor package for capnproto and the capnproto-dev dependency is pretty heavy. Especially if one assumes that capnproto will be used only inside Sandstorm grains, when used as this Meteor package.

I also use Ubuntu 14.04 LTS.

eemeli commented 7 years ago

On Ubuntu 16.04 and later, the name of the required package appears to be libcapnp-dev rather than capnproto-dev.