mscdex / sipster

A pjsip/pjsua2 binding for node.js
MIT License
192 stars 49 forks source link

npm install: node-gyp rebuild failing under arch #14

Closed StrikeForceZero closed 8 years ago

StrikeForceZero commented 9 years ago

I'm having problems getting this to build running the npm install sipster command. I'm using an arch distro Latest node/npm I've downloaded pjsip 2.4.5 and ran ./configure && make install

The first error when running npm install sipster is:

> sipster@0.0.5 install /node_modules/sipster
> node-gyp rebuild

make: Entering directory '/node_modules/sipster/build'
  CXX(target) Release/obj.target/sipster/src/binding.o
../src/binding.cc:215:8: error: ‘uv_mutex_t’ does not name a type
 static uv_mutex_t event_mutex;

which appears to be related to libuv? looks like libuv-1.7.5-1 installed

Any thoughts?

mscdex commented 9 years ago

What is "latest node/npm?" Can you show node -v?

StrikeForceZero commented 9 years ago

oh sorry;

$ node -v
v5.0.0
$ npm -v
3.3.12
mscdex commented 9 years ago

How did you install node? From Arch's own repository? If so, it might be something to do with the way Arch packages node (since they at least use shared libraries for every component used by node).

StrikeForceZero commented 9 years ago

yes from arch. what distro is this being developed on? I might be able to try it there.

mscdex commented 9 years ago

You could try using one of the pre-built Linux tarballs from here. Then just extract it to whatever prefix path you want, like /usr/local/ or somewhere in your home directory even. After that, make sure that your $PATH is set appropriately so that it picks up that copy of node instead of Arch's copy.

mscdex commented 9 years ago

I develop on Ubuntu, but I've deployed to both Ubuntu and CentOS without problems, but then again I typically install node from source on those systems instead of using a package manager (I'm just old fashioned).

StrikeForceZero commented 9 years ago

Alright cool, I'll give it a try over the weekend and let you know. Thanks for the help and info.

mscdex commented 8 years ago

You might want to try reinstalling from npm too, I just pushed a new version that should include nan-ified code which may or may not help your issue.

StrikeForceZero commented 8 years ago

Sorry for the late reply. Haven't had time until now to investigate. Not sure how to decipher the new error message I'm getting but I want to say it's failing because of an "optional" dependency fsevents@1.0.5

> sipster@0.1.0 install /home/XXXXXXX/Documents/Projects/XXXXXXX-nodejs/node_modules/sipster
> node-gyp rebuild

gyp: Call to 'pkg-config --atleast-version=2.4.5 libpjproject' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.5-1-ARCH
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/XXXXXXX/Documents/Projects/XXXXXXX-nodejs/node_modules/sipster
gyp ERR! node -v v5.1.1
gyp ERR! node-gyp -v v3.2.0
gyp ERR! not ok 
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.5
npm ERR! Linux 4.2.5-1-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "sipster" "--save"
npm ERR! node v5.1.1
npm ERR! npm  v3.5.1
npm ERR! code ELIFECYCLE

npm ERR! sipster@0.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sipster@0.1.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sipster 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 information on how to open an issue for this project with:
npm ERR!     npm bugs sipster
npm ERR! Or if that isn\'t available, you can get their info via:
npm ERR!     npm owner ls sipster
npm ERR! There is likely additional logging output above.
StrikeForceZero commented 8 years ago

I take that back.. that package seems to be a package targeting OSX..

StrikeForceZero commented 8 years ago

after further digging I may not have installed libpjproject properly as it seems there may be more steps than just a simple ./configure make make install will post back my results

following

mscdex commented 8 years ago

What I typically use is: ./configure --enable-shared && make -j8 dep && make -j8 && make install. However, as the configure script output notes at the end, you may want to create a config_site.h or similar to adjust any compile-time parameters before you start actually compiling. If you need to do this, it has to be done before make dep.

StrikeForceZero commented 8 years ago

found the problem.. sipster is depending on libpjproject while the package is being installed as pjproject. installing asterisk will pull it in as pjproject as well.

I took the package build from here; renamed it to libpjproject and pointed it to the latest version and sipster compiled successfully

mscdex commented 8 years ago

Ah ok. I'd be open to a PR that checks for both in binding.gyp. Although I guess maybe Asterisk intentionally uses a different name because they actually use a custom fork of pjsip and so it may not be 100% compatible for end users?

StrikeForceZero commented 8 years ago

Plausible but I think it might just be a distribution niche. I had problems changing binding.gyp file to look for pjproject. But I didn't give it much effort.

Is it possible to check for one or the other? Or does it have to have its own section

StrikeForceZero commented 8 years ago

well after much digging it was a localized issue all along. pjproject package installs the libraries as libpjproject as your module expects. The issue was having asterisk installed and having it pull in 2.4 not 2.4.5... renaming the package was not needed. So I'll head over to aur and see if the maintainer can bump the version.

Thanks a lot for the help and a fun module! Now I can finally play around with it :D. Had helped wrap pjsip with swig for c# so this will defiantly be interesting.