cryptocoinjs / secp256k1-node

Node.js binding for an Optimized C library for EC operations on curve secp256k1
Other
341 stars 120 forks source link

Update secp256k1 to latest #205

Open LuKks opened 5 months ago

LuKks commented 5 months ago

Closes https://github.com/cryptocoinjs/secp256k1-node/issues/204

I couldn't fix this error:

node:internal/modules/cjs/loader:1465
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /self/secp256k1-node/build/Release/addon.node: undefined symbol: secp256k1_pre_g_128
    at Module._extensions..node (node:internal/modules/cjs/loader:1465:18)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at load (/self/secp256k1-node/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/self/secp256k1-node/bindings.js:1:40)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v20.12.2

This looks somewhat related https://github.com/bitcoin-core/secp256k1/issues/1181 but I don't know about C, bindings, or any of this so any hints would be appreciated, thanks

vostrnad commented 5 months ago

The error might be caused by a breaking change in libsecp256k1 v0.4.0:

When consuming libsecp256k1 as a static library on Windows, the user must now define the SECP256K1_STATIC macro before including secp256k1.h.

brunovivas commented 4 months ago

I can get around this error by unconditionally defining variables as static in precomputed_ecmult_gen.h and precomputed_ecmult.h, but it's not clear to me why EXHAUSTIVE_TEST_ORDER isn't being set correctly.