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

dlopen failed: "/node_modules/osrm/lib/binding/node_osrm.node" has bad ELF magic #310

Open

Description

@andreddosantos

Hello we're building an hybrid mobile app using ionic with cordova that uses offline maps. We would like to add an offline routing engine to calculate offline routes. Our app uses a nodejs backend on the phone for some functionalities and we also would like to include the osrm package into our nodejs mobile server.

We know its possible to use osrm in mobile for offline routing, since the app maps.me used to use it, and also as referred on this issue.

Our current error:

The app compiles successfully, but when trying to start the osrm library it breaks

 var OSRM = require('osrm');

Error:

Error: dlopen failed: "/data/data/io.xxx.map/files/www/nodejs-project/node_modules/osrm/lib/binding/node_osrm.node" has bad ELF magic: cffaedfe
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1183:18)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/data/data/io.xxx.map/files/www/nodejs-project/node_modules/osrm/lib/index.js:1:29)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)

Hope you can help,
Kind regards
André

Activity

  1. danpat commented on Mar 11, 2021

    @danpat
    Member

    OSRM is implemented in NodeJS as a binary loadable module. When you do npm install, it downloads the appropriate binary module for the platform on which npm is being executed (i.e. your local machine, your build machine).

    If you've created a local build of your app, packed up the artifacts, then shipped them to a mobile device with a different architecture, you'll have the wrong OSRM binary module for that platform. The has bad ELF magic: cffaedfe indicates that Linux (I assume you're deploying to Android) doesn't recognize the format of the node_osrm.node file that you've bundled.

    I don't know if we pre-publish the right binaries for your platform. You should try running npm install from within your Android environment to see if it is able to fetch a working OSRM binary file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions