node-sqlite3 icon indicating copy to clipboard operation
node-sqlite3 copied to clipboard

Unable to do Cross-Platform compilation

Open WinterWolf98 opened this issue 10 months ago • 0 comments

Issue Summary

I've been testing my application with MacOS, but when I try to deploy my application in a cloud function which is running on linux and x64 architecture I'm getting the invalid ELF header error.

I've tried the following

  1. Installing with --os linux --cpu x64 options
  2. Rebuild with --os linux --cpu x64 options
  3. Installing with --build-from-source --os linux --cpu x64 options

but there's seems to be no change. Even when I try to test the application after running the above install/rebuild commands the application works fine in local machine (MacOS), and when I deploy the same to cloud functions it doesn't work and throws the invalid ELF header error.

The same works perfectly fine when I install the sqlite3 package from a linux machine and deploy it to the cloud function.

Am I missing something here when trying to install the package specific to an OS ?

Relevant logs or output

Error: /catalyst/node_modules/sqlite3/build/Release/node_sqlite3.node: invalid ELF header at Module._extensions..node (node:internal/modules/cjs/loader:1454:18) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at bindings (/catalyst/node_modules/bindings/bindings.js:112:48) at Object. (/catalyst/node_modules/sqlite3/lib/sqlite3-binding.js:1:37) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object. (/catalyst/node_modules/sqlite3/lib/sqlite3.js:2:17) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object. (/catalyst/sql-test.js:1:17) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object. (/catalyst/index.js:4:20) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at cjsLoader (node:internal/modules/esm/translators:348:17) at ModuleWrap. (node:internal/modules/esm/translators:297:7) at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) at async FlavourHandler.loadCustomerCode (file:///var/runtime/flavours/index.js:71:46) at async CUSTOMER_ROUTE (file:///var/runtime/index.js:110:13) { code: 'ERR_DLOPEN_FAILED' }

Version

5.1.7

Node.js Version

v20.16.0

How did you install the library?

npm install

WinterWolf98 avatar Jan 06 '25 14:01 WinterWolf98