hmenyus / node-calls-python

Call Python from NodeJS directly in-process without spawning processes
MIT License
252 stars 26 forks source link

PyLong_AsSize_t: symbol not found #33

Closed richard-julien closed 2 years ago

richard-julien commented 2 years ago

Hi, first of all, thanks for your effort on this lib, thats exactly what i need to have quick execution of python function through node. After trying successfully to use it on my dev env (windows), i have an issue building with drone on an alpine distribution.

The complete error:

Error: Error relocating /usr/local/lib/python3.10/lib-dynload/_struct.cpython-310-x86_64-linux-gnu.so: PyLong_AsSize_t: symbol not found
    at Interpreter.importSync (/tmp/raw-start-platform/opencti-graphql/build/node_modules/node-calls-python/index.js:51:24)

The commands i use to setup python on the alpine for the build.

    image: node:16.10.0-alpine
    commands:
      - apk add build-base git libffi-dev python3 python3-dev
      - ln -sf python3 /usr/bin/python
      - python3 -m ensurepip
      - pip3 install --no-cache --upgrade pip setuptool

yarn install for node succeed but the error pop when node execute the code.

Any idea how to solve that?

Thanks

richard-julien commented 2 years ago

Looks like related to Alpine env

richard-julien commented 2 years ago

The trace of the yarn install.

➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.17.0/node-v16.17.0-headers.tar.gz
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info find Python using Python version 3.10.6 found at "/usr/local/bin/python3"
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.17.0/node-v16.17.0-headers.tar.gz
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.17.0/SHASUMS256.txt
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.17.0/node-v16.17.0-headers.tar.gz
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.17.0/SHASUMS256.txt
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn /usr/local/bin/python3
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args [
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp/gyp/gyp_main.py',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   'binding.gyp',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-f',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   'make',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-I',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/node-calls-python/build/config.gypi',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-I',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp/addon.gypi',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-I',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '/root/.cache/node-gyp/16.17.0/include/node/common.gypi',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dlibrary=shared_library',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dvisibility=default',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.17.0',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dnode_gyp_dir=/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.17.0/<(target_arch)/node.lib',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dmodule_root_dir=/tmp/raw-start-platform/opencti-graphql/node_modules/node-calls-python',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Dnode_engine=v8',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '--depth=.',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '--no-parallel',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '--generator-output',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   'build',
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args   '-Goutput_dir=.'
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args ]
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn make
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT make: Entering directory '/tmp/raw-start-platform/opencti-graphql/node_modules/node-calls-python/build'
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT   CXX(target) Release/obj.target/nodecallspython/src/addon.o
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp http GET https://unofficial-builds.nodejs.org/download/release/v16.17.0/SHASUMS256.txt
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp http 200 https://unofficial-builds.nodejs.org/download/release/v16.17.0/SHASUMS256.txt
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn /usr/local/bin/python3
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args [
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp/gyp/gyp_main.py',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   'binding.gyp',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-f',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   'make',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-I',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/gc-stats/build/config.gypi',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-I',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp/addon.gypi',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-I',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '/root/.cache/node-gyp/16.17.0/include/node/common.gypi',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dlibrary=shared_library',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dvisibility=default',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.17.0',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dnode_gyp_dir=/tmp/raw-start-platform/opencti-graphql/node_modules/node-gyp',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.17.0/<(target_arch)/node.lib',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dmodule_root_dir=/tmp/raw-start-platform/opencti-graphql/node_modules/gc-stats',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Dnode_engine=v8',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '--depth=.',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '--no-parallel',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '--generator-output',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   'build',
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args   '-Goutput_dir=.'
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args ]
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info ok 
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info it worked if it ends with ok
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info using node-gyp@9.1.0
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info using node@16.17.0 | linux | x64
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT make: Entering directory '/tmp/raw-start-platform/opencti-graphql/node_modules/gc-stats/build'
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn make
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT   CXX(target) Release/obj.target/gcstats/src/gcstats.o
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR In file included from ../../nan/nan.h:60,
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR                  from ../src/gcstats.cc:1:
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR /root/.cache/node-gyp/16.17.0/include/node/node.h:859:7: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR   859 |       (node::addon_register_func) (regfunc),                          \
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR /root/.cache/node-gyp/16.17.0/include/node/node.h:893:3: note: in expansion of macro 'NODE_MODULE_X'
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR   893 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR       |   ^~~~~~~~~~~~~
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR ../src/gcstats.cc:226:1: note: in expansion of macro 'NODE_MODULE'
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR   226 | NODE_MODULE(gcstats, init)
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR       | ^~~~~~~~~~~
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT   SOLINK_MODULE(target) Release/obj.target/gcstats.node
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT   COPY Release/gcstats.node
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT   COPY /tmp/raw-start-platform/opencti-graphql/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v93-linux-x64/gcstats.node
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT   TOUCH Release/obj.target/action_after_build.stamp
➤ YN0000: │ gc-stats@npm:1.4.0 STDOUT make: Leaving directory '/tmp/raw-start-platform/opencti-graphql/node_modules/gc-stats/build'
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR gyp info ok 
➤ YN0000: │ gc-stats@npm:1.4.0 STDERR node-pre-gyp info ok 
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT   CXX(target) Release/obj.target/nodecallspython/src/pyinterpreter.o
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT   SOLINK_MODULE(target) Release/obj.target/nodecallspython.node
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT   COPY Release/nodecallspython.node
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDOUT make: Leaving directory '/tmp/raw-start-platform/opencti-graphql/node_modules/node-calls-python/build'
➤ YN0000: │ node-calls-python@patch:node-calls-python@npm%3A1.7.2#./patch/node-calls-python-1.7.2.patch::version=1.7.2&hash=719dfd&locator=opencti-graphql%40workspace%3A. STDERR gyp info ok 
➤ YN0000: └ Completed in 14s 777ms
➤ YN0000: Done with warnings in 23s 588ms
hmenyus commented 2 years ago

I am not familiar with alpine linux but could you attach the output of these?

python3-config --ldflags --embed python3-config --configdir objdump -Tw /usr/local/lib/python3.10/lib-dynload/_struct.cpython-310-x86_64-linux-gnu.so | grep PyLong console.log(process.platform) ls /usr/local/lib/python3.10/lib-dynload/

And before you call importSync, could you try to call "fixlink": py.fixlink("/usr/local/lib/python3.10/lib-dynload/_struct.cpython-310-x86_64-linux-gnu.so"); py.importSync("your module");

https://github.com/hmenyus/node-calls-python#working-around-linking-errors-on-linux

richard-julien commented 2 years ago

So lloks like the directory is false. /usr/local/lib/python3.10/lib-dynload/ is not existing, the right dir is /usr/lib/python3.8/lib-dynload/

Ouput with the fixed path.

+ python3-config --ldflags --embed
 -L/usr/lib -lpython3.8 -ldl  -lm -lm 
+ python3-config --configdir
/usr/lib/python3.8/config-3.8-x86_64-linux-gnu
+ ls /usr/lib/python3.8/lib-dynload/
_asyncio.cpython-38-x86_64-linux-gnu.so
_bisect.cpython-38-x86_64-linux-gnu.so
_blake2.cpython-38-x86_64-linux-gnu.so
_bz2.cpython-38-x86_64-linux-gnu.so
_codecs_cn.cpython-38-x86_64-linux-gnu.so
_codecs_hk.cpython-38-x86_64-linux-gnu.so
_codecs_iso2022.cpython-38-x86_64-linux-gnu.so
_codecs_jp.cpython-38-x86_64-linux-gnu.so
_codecs_kr.cpython-38-x86_64-linux-gnu.so
_codecs_tw.cpython-38-x86_64-linux-gnu.so
_contextvars.cpython-38-x86_64-linux-gnu.so
_crypt.cpython-38-x86_64-linux-gnu.so
_csv.cpython-38-x86_64-linux-gnu.so
_ctypes.cpython-38-x86_64-linux-gnu.so
_ctypes_test.cpython-38-x86_64-linux-gnu.so
_curses.cpython-38-x86_64-linux-gnu.so
_curses_panel.cpython-38-x86_64-linux-gnu.so
_datetime.cpython-38-x86_64-linux-gnu.so
_dbm.cpython-38-x86_64-linux-gnu.so
_decimal.cpython-38-x86_64-linux-gnu.so
_elementtree.cpython-38-x86_64-linux-gnu.so
_gdbm.cpython-38-x86_64-linux-gnu.so
_hashlib.cpython-38-x86_64-linux-gnu.so
_heapq.cpython-38-x86_64-linux-gnu.so
_json.cpython-38-x86_64-linux-gnu.so
_lsprof.cpython-38-x86_64-linux-gnu.so
_lzma.cpython-38-x86_64-linux-gnu.so
_md5.cpython-38-x86_64-linux-gnu.so
_multibytecodec.cpython-38-x86_64-linux-gnu.so
_multiprocessing.cpython-38-x86_64-linux-gnu.so
_opcode.cpython-38-x86_64-linux-gnu.so
_pickle.cpython-38-x86_64-linux-gnu.so
_posixshmem.cpython-38-x86_64-linux-gnu.so
_posixsubprocess.cpython-38-x86_64-linux-gnu.so
_queue.cpython-38-x86_64-linux-gnu.so
_random.cpython-38-x86_64-linux-gnu.so
_sha1.cpython-38-x86_64-linux-gnu.so
_sha256.cpython-38-x86_64-linux-gnu.so
_sha3.cpython-38-x86_64-linux-gnu.so
_sha512.cpython-38-x86_64-linux-gnu.so
_socket.cpython-38-x86_64-linux-gnu.so
_sqlite3.cpython-38-x86_64-linux-gnu.so
_ssl.cpython-38-x86_64-linux-gnu.so
_statistics.cpython-38-x86_64-linux-gnu.so
_struct.cpython-38-x86_64-linux-gnu.so
_testbuffer.cpython-38-x86_64-linux-gnu.so
_testcapi.cpython-38-x86_64-linux-gnu.so
_testimportmultiple.cpython-38-x86_64-linux-gnu.so
_testinternalcapi.cpython-38-x86_64-linux-gnu.so
_testmultiphase.cpython-38-x86_64-linux-gnu.so
_xxsubinterpreters.cpython-38-x86_64-linux-gnu.so
_xxtestfuzz.cpython-38-x86_64-linux-gnu.so
array.cpython-38-x86_64-linux-gnu.so
audioop.cpython-38-x86_64-linux-gnu.so
binascii.cpython-38-x86_64-linux-gnu.so
cmath.cpython-38-x86_64-linux-gnu.so
fcntl.cpython-38-x86_64-linux-gnu.so
grp.cpython-38-x86_64-linux-gnu.so
math.cpython-38-x86_64-linux-gnu.so
mmap.cpython-38-x86_64-linux-gnu.so
ossaudiodev.cpython-38-x86_64-linux-gnu.so
parser.cpython-38-x86_64-linux-gnu.so
pyexpat.cpython-38-x86_64-linux-gnu.so
readline.cpython-38-x86_64-linux-gnu.so
resource.cpython-38-x86_64-linux-gnu.so
select.cpython-38-x86_64-linux-gnu.so
spwd.cpython-38-x86_64-linux-gnu.so
syslog.cpython-38-x86_64-linux-gnu.so
termios.cpython-38-x86_64-linux-gnu.so
unicodedata.cpython-38-x86_64-linux-gnu.so
xxlimited.cpython-38-x86_64-linux-gnu.so
zlib.cpython-38-x86_64-linux-gnu.so
+ objdump -Tw /usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so | grep PyLong
0000000000000000      D  *UND*  0000000000000000 PyLong_AsSize_t
0000000000000000      D  *UND*  0000000000000000 _PyLong_AsByteArray
0000000000000000      D  *UND*  0000000000000000 PyLong_AsUnsignedLongLong
0000000000000000      D  *UND*  0000000000000000 PyLong_FromLong
0000000000000000      D  *UND*  0000000000000000 PyLong_AsUnsignedLong
0000000000000000      D  *UND*  0000000000000000 PyLong_FromUnsignedLongLong
0000000000000000      D  *UND*  0000000000000000 PyLong_AsVoidPtr
0000000000000000      D  *UND*  0000000000000000 PyLong_FromVoidPtr
0000000000000000      D  *UND*  0000000000000000 PyLong_FromUnsignedLong
0000000000000000      D  *UND*  0000000000000000 PyLong_AsLongLong
0000000000000000      D  *UND*  0000000000000000 PyLong_FromSsize_t
0000000000000000      D  *UND*  0000000000000000 PyLong_FromLongLong
0000000000000000      D  *UND*  0000000000000000 PyLong_AsSsize_t
0000000000000000      D  *UND*  0000000000000000 PyLong_AsLong
0000000000000000      D  *UND*  0000000000000000 PyLong_FromSize_t
+ node -p process.platform
linux

I try to use py.fixlink('/usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so'); And i get

    Error relocating /usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so: PyLong_AsSize_t: symbol not found

       8 | // Importing python runtime scripts
       9 | const py = nodecallspython.interpreter;
    > 10 | py.fixlink('/usr/lib/python3.8/lib-dynload/_struct.cpython-38-x86_64-linux-gnu.so');
         |    ^
      11 | const pyCheckIndicator = py.importSync('./src/python/runtime/check_indicator.py');
      12 | const CHECK_INDICATOR_SCRIPT = { fn: 'check_indicator', py: pyCheckIndicator };
      13 |
hmenyus commented 2 years ago

Do you have libpython3.8.so in /usr/lib/python3.8/config-3.8-x86_64-linux-gnu? What is the output of "ls /usr/lib/python3.8/config-3.8-x86_64-linux-gnu"? Or what is the location of libpython3.8.so? Is it in /usr/lib?

You can try to use fixlink on the libpython3.8.so (based on the location of libpython3.8.so) const py = nodecallspython.interpreter; py.fixlink("/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so") py.fixlink("/usr/lib/libpython3.8.so") py.fixlink("libpython3.8.so")

hmenyus commented 2 years ago

in the meantime I have published 1.7.3? Could you try that?

richard-julien commented 2 years ago

Thanks for your answer. The content of this directory

/usr/lib/python3.8/config-3.8-x86_64-linux-gnu # ls -al
total 39128
drwxr-xr-x    2 root     root          4096 Oct  7 08:59 .
drwxr-xr-x   32 root     root         20480 Oct  7 08:59 ..
-rw-r--r--    1 root     root         78297 May  6  2021 Makefile
-rw-r--r--    1 root     root         14786 May  6  2021 Setup
-rw-r--r--    1 root     root            41 May  6  2021 Setup.local
-rw-r--r--    1 root     root          3289 May  6  2021 config.c
-rw-r--r--    1 root     root          1623 May  6  2021 config.c.in
-rwxr-xr-x    1 root     root         15368 May  6  2021 install-sh
-rw-r--r--    1 root     root      39887180 May  6  2021 libpython3.8.a
-rwxr-xr-x    1 root     root          7848 May  6  2021 makesetup
-rwxr-xr-x    1 root     root          2127 May  6  2021 python-config.py
-rw-r--r--    1 root     root         10008 May  6  2021 python.o

Of course I will try the 1.7.3 right now.

richard-julien commented 2 years ago

Problem is solved in 1.7.3. Thanks for your time and the new version!