Project-OSRM / node-osrm

DEPRECATED Part of osrm-backend since 5.7. NodeJS bindings for OSRM
BSD 2-Clause "Simplified" License
141 stars 48 forks source link

cannot install and run on debian stable (jessie) #232

Closed cordovapolymer closed 8 years ago

cordovapolymer commented 8 years ago

My setup is debian stable 8.5 (jessie) with node 4.x and latest osrm-backend build from source. node-osrm doesn't run when installed from npm with npm install osrm: Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found (required by /usr/lib/node_modules/osrm/lib/binding/osrm.node) I installed g++ toolchain with sudo apt-get install g++-4.8, but it didn't help.

Also I tried to build node-osrm from source, but it's not possible on jessie because it comes with boost 1.55 and node osrm requires at least 1.56 because of boost/make_unique.hpp header, build fails with: ../src/node_osrm_support.hpp:21:33: fatal error: boost/make_unique.hpp: No such file or directory

P.S. The build succeeds on debian testing(stretch) and I'm able to run the example on it, so I tried installing boost 1.60 on debian jessie from testing repository and building node-osrm with it, the build succeeded, but when running example node.js it just hangs consuming 99% cpu. ( I tried it only with node 6.x)

danpat commented 8 years ago

@cordovapolymer when you do npm install osrm, you're getting a binary build of the Node OSRM modules. This binary depends on a newer libstdc++6 that is bundled with jessie, hence the GLIBCXX_3.4.21 error.

At least on Ubuntu, you can grab backported libstdc++6 from here:

https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

but I'm not sure that will fly on Debian :-( It's been a while since I've had a straight Debian box set up, so I'm not sure of the state of the libraries. It's moderately annoying that Debian is still so far behind with Boost, 1.56 was released August 7th, 2014.

We haven't tested with NodeJS 6.x, so it wouldn't be surprising if it doesn't work there, we have no plans to update for a while. nvm usually does a good job of installing specific NodeJS releases, I'd recommend re-trying the Stretch build you did using Node 4.x.

cordovapolymer commented 8 years ago

I'd recommend re-trying the Stretch build you did using Node 4.x.

tried this, same story- nodejs hangs.

At least on Ubuntu, you can grab backported libstdc++6 from here:

It's not a clean way for a stable distribution to grab system libraries from another distribution. Debian stable runs with older libraries just because of its stability, of course for most cases Debian testing is stable enough.. but It's not provided in clouds, Digital Ocean in my case.

If you would build node-osrm binary on Debian stable and publish it on npm it would run on both Debian and Ubuntu.

danpat commented 8 years ago

@cordovapolymer The Node binary modules are provided purely for convenience - we do not aim to support all platforms with them.

You can install an older version of the node bindings with npm install osrm@4.9.1 which I believe are linked against an older libstdc++6 that should work for you. You'll miss out on all the new shiny features in v5, but them's the breaks.

Happy to help debug your problems building from source on Stretch - can you give any additional information that could help figure out what's going wrong there? What exactly are you doing that's hanging? A console transcript of all the steps you've taken would be very helpful.

cordovapolymer commented 8 years ago

Happy to help debug your problems building from source on Stretch - can you give any additional information that could help figure out what's going wrong there? What exactly are you doing that's hanging? A console transcript of all the steps you've taken would be very helpful.

@danpat, you didn't read into my comment, I have successfully built node-osrm on stretch, I was trying to build it on jessie(stable) using boost packages from stretch, and it didn't work - node just hanged.

I've finally solved the jessie build issue by downloading latest boost source into temporary directory and adding it to compiler include search path export CXXFLAGS="-I/tmp/boost_1_61_0/boost".

@cordovapolymer The Node binary modules are provided purely for convenience - we do not aim to support all platforms with them.

It's up to you, Debian is more generic platform than Ubuntu. Maybe you'd like to add the recommendation for Debian stable users to download latest boost and specify it's path for compiler into the installation manual?

danpat commented 8 years ago

@cordovapolymer Sorry, I mis-read your earlier comment.

We've got some obviously dated Jessie instructions here: https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM#debian-jessie

Can you spell out exactly what extra steps are required (wget, export, etc)? I can add them to the wiki for others to find.

Unfortunately, we don't have a lot of granularity with the published Node binaries - anyone using npm install osrmon Linux x86-64 would download the same binaries, so if it wasn't Debian that had a problem, it would be someone else. npm will grab the same binaries for wheezy and trusty users, as well as all RedHat/Arch/Gentoo/whatever, there's no reasonable way to support everyone with the manpower we have.

To be honest, I've been thinking we could have a directory full of Docker recipes for building binaries for different Linux platforms - this might be a good time to kick off that effort, wanna submit a Dockerfile patch?

cordovapolymer commented 8 years ago

We've got some obviously dated Jessie instructions here: https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM#debian-jessie

osrm-backend builds well on jessie(and on stretch).

npm will grab the same binaries for wheezy and trusty users, as well as all RedHat/Arch/Gentoo/whatever, there's no reasonable way to support everyone with the manpower we have.

You are right, but Debian Jessie is current stable distribution, and the most generic one, If something runs on it, it will definitely run on its successors, and wheezy is the old stable which support will end soon.

To be honest, I've been thinking we could have a directory full of Docker recipes for building binaries for different Linux platforms - this might be a good time to kick off that effort, wanna submit a Dockerfile patch?

Great idea, but I don't have one yet.

Commands to build node-osrm on jessie:

cd tmp
wget https://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.bz2
tar xjf boost_1_61_0.tar.bz2
git clone https://github.com/Project-OSRM/node-osrm.git
cd node-osrm
export CXXFLAGS="-I/tmp/boost_1_61_0"
sudo npm install --build-from-source -g --unsafe-perm
ezheidtmann commented 8 years ago

Thanks @cordovapolymer for those instructions. Helps me to build on Ubuntu 14.04 (trusty).

springmeyer commented 8 years ago

I'm going to close this issue. To recap:

Because @cordovapolymer is on debian and therefore can't easily do the libstdc++ upgrade (aka apt-get install -y libstdc++-5-dev per the docs) then a source compile is needed. Because @ezheidtmann is on ubuntu, then only the libstdc++-5 upgrade is needed to use the existing binaries.