Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Installation #21

Closed
willwhite opened this issue Dec 12, 2013 · 10 comments
Closed

Installation #21

willwhite opened this issue Dec 12, 2013 · 10 comments

Comments

@willwhite
Copy link
Contributor

Installation is currently non-standard and currently depends on a clone of this repo being next to a built Project-OSRM directory. What would need to happen in order to it possible to install by simply running npm install node-osrm?

@springmeyer
Copy link

Options:

  1. Project-OSRM gets installed somewhere predictable (like /usr/local) and then starts offering a script like osrm-config that can be queried for build details or provides pkg-config compatible files to declare where it is and how to build against it. The CMAKE scripts Project-OSRM uses may have this ability but I've not seen it - @DennisOSRM will know.

  2. Project-OSRM gets built in place wherever you choose and npm install osrm will require a flag like --osrm=/usr/local be passed.

  3. Project-OSRM enables libOSRM to be built as a static library and then node-OSRM is packaged fully standalone and can be installed without needing to build against Project-OSRM

Option 1 Is the most traditional route and would require work in both Project-OSRM build scripts and node-OSRM builds scripts. Option 2 Is something I've tried and gave up on because of challenges with gyp and relative paths (I could return to this but would prefer not). Option 3 Is a great solution for non-developers but not a full solution.

@willwhite
Copy link
Contributor Author

For deployment and testing we will need to add node-osrm to a package.json file so I'm not sure option 2 will work in that case. Options 1 sounds like the most promising. What all is involved with that work?

@DennisOSRM
Copy link
Contributor

The cmake script doesn't have the pkg-config functionality built-in.

@DennisOSRM
Copy link
Contributor

Project-OSRM/osrm-backend@c3396fa partially implements this. Files are installed, and pkg-config follows shortly.

@springmeyer
Copy link

Now that the command line programs and libOSRM are installed the next (final?) thing needed are headers: Project-OSRM/osrm-backend#842

@DennisOSRM
Copy link
Contributor

This is now implemented with Project-OSRM/osrm-backend@991c9f2 and 118058e

Works reasonably well:

$ make clean; make
rm -f lib/_osrm.node
rm -f *.osrm*
./node_modules/.bin/node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.1
gyp info using node@0.10.22 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/Users/dennisluxen/Coding/node-osrm/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   '/Users/dennisluxen/Coding/node-osrm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/dennisluxen/Coding/node-osrm/common.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/dennisluxen/Coding/node-osrm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/dennisluxen/.node-gyp/0.10.22/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/dennisluxen/.node-gyp/0.10.22',
gyp info spawn args   '-Dmodule_root_dir=/Users/dennisluxen/Coding/node-osrm',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok 
./node_modules/.bin/node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.1
gyp info using node@0.10.22 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/osrm/src/node_osrm.o
  SOLINK_MODULE(target) Release/osrm.node
ld: warning: option -s is obsolete and being ignored
ld: warning: option -s is obsolete and being ignored
  SOLINK_MODULE(target) Release/osrm.node: Finished
  COPY ../lib/osrm.node
  TOUCH Release/obj.target/action_after_build.stamp
gyp info ok 

and

$ make test
npm test

> osrm@0.1.0 test /Users/dennisluxen/Coding/node-osrm
> mocha -R spec

  osrm
    ✓ should throw if new keyword is not used 
    ✓ should throw if invalid args are passed 
    - should throw if ini file is blank
    - should throw if ini file does not exist
    - should throw if files referenced by ini do not exist
    - should throw if ini references corrupt files
    ✓ should be initialized 
    ✓ should throw if insufficient coordinates given 
    ◦ should return results for berlin using sync api: . 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
    ✓ should return results for berlin using sync api (603ms)
    ◦ should return results for berlin using sync api and shared memory: . 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
    ✓ should return results for berlin using sync api and shared memory (600ms)

  6 passing (1s)
  4 pending

@ianshward
Copy link

In master I'm looking at the README and it says to install node-osrm do:

git clone /~https://github.com/DennisOSRM/node-osrm.git
cd node-osrm
npm install

however, this does not build the binary. If I run make before or after running npm install, it is built. Is the plan to only have to run npm install?

@ianshward
Copy link

Ah, I see this uses node-pre-gyp now, so I think maybe all that's missing is:

@springmeyer does this sound right?

@springmeyer
Copy link

@ianshward - yes, exactly

Okay, this is basically done - thanks everyone for the work to get there.

  • OSRM core (in develop branch) now provides a static lib and an awesome pkg-config file.
  • node-osrm now uses pkg-config to predictably build against OSRM no matter where it was installed
  • Binaries for users not wishing to develop node-osrm are close to ready and their completion will be tracked at Provide binaries for easy install #30

@springmeyer
Copy link

@ianshward - install/developer section now fixed up in readme, thanks for catching that: /~https://github.com/DennisOSRM/node-osrm/blob/master/README.md#installing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants