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

Precompiled binaries fail on alpine linux #306

Closed pr0fedt closed 7 years ago

pr0fedt commented 7 years ago

got an error /app/node_modules/osrm/lib/binding # ./osrm-extract /bin/sh: ./osrm-extract: not found

figured out that # ldd osrm-extract /lib64/ld-linux-x86-64.so.2 (0x55cc3cdb0000) libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55cc3cdb0000) libtbb.so.2 => /usr/lib/libtbb.so.2 (0x7f0eaced9000) libz.so.1 => /lib/libz.so.1 (0x7f0eaccc3000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f0eac973000) libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55cc3cdb0000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f0eac760000) libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55cc3cdb0000) Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by osrm-extract)

comparing to osrm-backend build in container ldd /usr/local/bin/osrm-extract /lib/ld-musl-x86_64.so.1 (0x5581f5d88000) libboost_program_options-mt.so.1.60.0 => /usr/lib/libboost_program_options-mt.so.1.60.0 (0x7faf49abb000) libbz2.so.1 => /usr/lib/libbz2.so.1 (0x7faf498ae000) libboost_regex-mt.so.1.60.0 => /usr/lib/libboost_regex-mt.so.1.60.0 (0x7faf495bc000) libboost_date_time-mt.so.1.60.0 => /usr/lib/libboost_date_time-mt.so.1.60.0 (0x7faf493aa000) libboost_chrono-mt.so.1.60.0 => /usr/lib/libboost_chrono-mt.so.1.60.0 (0x7faf491a3000) libboost_filesystem-mt.so.1.60.0 => /usr/lib/libboost_filesystem-mt.so.1.60.0 (0x7faf48f89000) libboost_iostreams-mt.so.1.60.0 => /usr/lib/libboost_iostreams-mt.so.1.60.0 (0x7faf48d6f000) libboost_thread-mt.so.1.60.0 => /usr/lib/libboost_thread-mt.so.1.60.0 (0x7faf48b46000) libboost_system-mt.so.1.60.0 => /usr/lib/libboost_system-mt.so.1.60.0 (0x7faf48942000) libexpat.so.1 => /usr/lib/libexpat.so.1 (0x7faf48722000) liblua.so.5 => /usr/lib/liblua.so.5 (0x7faf484fb000) libz.so.1 => /lib/libz.so.1 (0x7faf482e5000) libtbb.so.2 => /usr/lib/libtbb.so.2 (0x7faf480b0000) libtbbmalloc.so.2 => /usr/lib/libtbbmalloc.so.2 (0x7faf47e75000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7faf47b25000) libgomp.so.1 => /usr/lib/libgomp.so.1 (0x7faf4790a000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7faf476f7000) libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x5581f5d88000) libboost_atomic-mt.so.1.60.0 => /usr/lib/libboost_atomic-mt.so.1.60.0 (0x7faf474f5000)

Alpine Linux uses a musl libc so maybe it would be a good idea to provide precompiled binary corresponding to alternative libc implementations?

springmeyer commented 7 years ago

@pr0fedt - yes, this is expected due to musl being used. I'm personally very interested in musl and getting this working but it is way beyond the scope to support currently because mason (which is used for the deps) would also need to support musl variants (https://github.com/mapbox/mason/). That has been discussed but is not viable in the near term.

So, @pr0fedt let me know if you have the ability to do a source compile via the instructions at https://github.com/Project-OSRM/node-osrm#using-an-existing-local-osrm-backend?

danpat commented 7 years ago

Note that the Docker images we're building with this Dockerfile:

https://github.com/Project-OSRM/osrm-backend/blob/master/docker/Dockerfile

are based on Alpine Linux and seem to work just fine. musl itself is no barrier, it works just fine, the difficulty is mostly the logistics of supporting pre-compiled binaries for multiple libc targets.

daniel-j-h commented 7 years ago

Closing here. Check how we build the Alpine Docker images https://hub.docker.com/r/osrm/osrm-backend/

Also note that there is a libstdc++ pkg in Alpine - e.g. the NodeJs package depends on it.