npm pathwatcher module for Meteor fails

I'm trying to get Meteor to run on FreeBSD and thanks to Tom Hardenberg's https://github.com/4commerce-technologies-AG/meteor there is a good chance of getting it working.

Unfortunately the pathwatcher npm module is currently a showstopper.

npm install pathwatcher

builds fine as long as gmake is available but trying to load pathwatcher inside node

Code:
var p = require('pathwatcher');
fails with:
Code:
node_modules/pathwatcher/build/Release/pathwatcher.node: Undefined symbol "_Z12PlatformInitv"

Does anyone know what's going on here?
 
Last edited by a moderator:
I'm trying to get Meteor to run on FreeBSD and thanks to Tom Hardenberg's https://github.com/4commerce-technologies-AG/meteor there is a good chance of getting it working.

Unfortunately the pathwatcher npm module is currently a showstopper.

npm install pathwatcher

builds fine as long as gmake is available but trying to load pathwatcher inside node

Code:
var p = require('pathwatcher');
fails with:
Code:
node_modules/pathwatcher/build/Release/pathwatcher.node: Undefined symbol "_Z12PlatformInitv"

Does anyone know what's going on here?

I could be wrong, but support of FreeBSD is not present in binding.gyp.

Try to patch this file, at line 41 replace the following code:

Code:
'OS=="mac"',

by

Code:
'OS=="mac" or OS=="freebsd"',

We also use kqueue(2)/kevent for events monitoring.

In the latest status report (from July to September) I mention, that I'm working on new USES framework in order to easily install Node.js modules (a kind of npm -g install).
 
Last edited by a moderator:
Hi olivierd

Thanks for guiding us in this issue. Makes totally sense to add also a file for freebsd FreeBSD ;-) Unfortunately I can't get it to work.

We need Release @4.1.0 from https://github.com/atom/node-pathwatcher, but I also tried latest release @6.2.4 - all the time now I got this error:

Code:
Error: Cannot find module 'pathwatcher'

What I use: node v0.10.40 and npm v1.4.28

What I did:

Code:
mkdir -p /tmp/test-pathwatcher
cd /tmp/test-patchwatcher
git clone -b v6.2.4 https://github.com/atom/node-pathwatcher
vi node-pathwatcher/binding.gyp (just changed mac to freebsd)
npm install ./node-pathwatcher
echo "var p = require('pathwatcher');" > demo.js
node demo.js

>>>> Error: Cannot find module 'pathwatcher'

Do you have any additional tips?
 
Hi olivierd

thanks for guiding us in this issue. Makes totally sense to add also a file for freebsd ;-)

But unfortunally I can't get it work.

We need release @4.1.0 from https://github.com/atom/node-pathwatcher

But I also tried latest release @6.2.4 - all the time now I got this error:

Error: Cannot find module 'pathwatcher'

----

What I use: node v0.10.40 and npm v1.4.28

What I did:

mkdir -p /tmp/test-pathwatcher
cd /tmp/test-patchwatcher
git clone -b v6.2.4 https://github.com/atom/node-pathwatcher
vi node-pathwatcher/binding.gyp (just changed mac to freebsd)
npm install ./node-pathwatcher
echo "var p = require('pathwatcher');" > demo.js
node demo.js

>>>> Error: Cannot find module 'pathwatcher'

Do you have any additional tip?

Personally when Node module is written in CoffeeScript I avoid to clone repository, because:
  • coffee must be in your $PATH
  • NODE_PATH variable must be defined
Simply download tarball from https://www.npmjs.com/. For pathwatcher, the url is
http://registry.npmjs.org/pathwatcher/-/pathwatcher-6.2.5.tgz It already contains compiled JavaScript module.

Pathwatcher requires also node-gyp in order to build C++ code (it can be installed with npm, or using my experimental repository if you use the ports tree). Others modules are also necessary.

node-gyp must also defined some environments variables (if it uses globally, see Mk/Uses/nodegyp.mk for more details).

Pure JavaScript modules are easy to install with npm, but when they contain extensions written in C (or C++) is more difficult.

Quick and dirty method in order to install pathwatcher:
1. npm install pathwatcher (dependencies will be installed)
2. Remove this particular module, search hidden directory in your $HOME
3. Download tarball from NPM registry
4. Patch binding.gyp
5. Configure and build the pathwatcher extension via node-gyp
6. Install module with the others (in your $HOME

I think node-gyp should also be fixed especially addon.gypi for headers.
 
  • Thanks
Reactions: cfw
Hi olivierd

You make my day! and guide me again to the right direction :)

A big issue was that the base file was named pathwatcher_mac.mm which took me a few moments to realize that gmake() ignores it ;-)

So I renamed that to pathwatcher_mac.cc just to test.

The compiler spite out some undefined DEFINES so I copied the file from mac to freebsd and added two defines

Code:
#define F_GETPATH       50              /* return the full path of the fd */
#define O_EVTONLY       0x8000          /* descriptor requested for event notifications only */

I took them from http://fxr.watson.org/fxr/source/bsd/sys/fcntl.h?v=xnu-792.6.70 what is hopefully correct.

After that I added a section for freebsdFreeBSD to the bindings.gyp and rebuild and ...

YEAH it works

I will setup a github repo for that to allow others to run that stuff without too much headache.

Thanks a lot for your guidiances!

Tom
 
Hi olivierd

One question left: If I want to provide a patch to original repo including the coffee files, what is necessary that this may run as well?

On uploading to npmjs will those files (automatically) converted to pure js or why are the files on npmjs are different to the source repo?

Thanks for any comment in advance
Tom
 
Hi olivierd - I got that already as well

There is a task "grunt prepublish" which will run if all the grunt stuff is installed and that builds a correct package

Thanks again, now I am done

:)

Tom
 
Back
Top