Skip to content

Commit

Permalink
link libffi statically on Linux (#147)
Browse files Browse the repository at this point in the history
* link libffi statically on Linux

* when using external interpreter w/o rebuild, it must be the same version

* add this to the known issues

* change the missed windows too
  • Loading branch information
mmomtchev authored Feb 8, 2024
1 parent 5d54e95 commit 05a4ce3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
node-version: 18.x
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- run: npm install --ignore-scripts
- run: npx @mapbox/node-pre-gyp configure --builtin_python
- run: npx @mapbox/node-pre-gyp build -j max
Expand All @@ -120,7 +120,7 @@ jobs:
run: echo PYTHONHOME=$(python -c "import sys; print(sys.prefix)") >> $GITHUB_ENV
- name: Test PYTHONOME
run: echo READ_PYTHONHOME=$(node -e "console.log(require('pymport').version.pythonHome)") >> $GITHUB_ENV
- uses: nick-fields/assert-action@v1.2.0
- uses: nick-fields/assert-action@v2
with:
expected: ${{ env.PYTHONHOME }}
actual: ${{ env.READ_PYTHONHOME }}
Expand All @@ -140,7 +140,7 @@ jobs:
node-version: 18.x
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- run: npm install --ignore-scripts
- run: npx @mapbox/node-pre-gyp configure --builtin_python
- run: npx @mapbox/node-pre-gyp build -j max
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ except for the following combinations that are not supported:

* **Node.js 16.x on Ubuntu 22.04**: rebuilding from source against the system-installed Python is not possible due to Node.js containing a built-in OpenSSL 1.1 with exported symbols while the system-provided Python is built vs OpenSSL 3.0, upgrading Node.js or using the precompiled interpreter solves this issue

* **Node.js 16.x and Python 3.12**: `node-gyp` from Node.js 16.x does not work if Python 3.12 is installed

* **Python 3.11.x on Windows**: An upstream bug requires a specific workaround in this case [#44](https://github.com/mmomtchev/pymport/issues/44)

# `pymport` vs `PyScript/Pyodide`
Expand Down
3 changes: 2 additions & 1 deletion build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if [ ! -d "$1" ] || [ ! -r "${LIBNAME}" ]; then
export LDFLAGS="-Wl,-z,origin -Wl,-rpath,'\$\$ORIGIN/../lib'"
export CFLAGS=""
export ZLIB_LIBS="-lz -ldl"
export LIBFFI_LIBS="-l:libffi_pic.a -Wl,--exclude-libs,libffi_pic.a"
;;
'Darwin')
export LDFLAGS="-Wl,-rpath,@loader_path/../lib"
Expand All @@ -43,7 +44,7 @@ if [ ! -d "$1" ] || [ ! -r "${LIBNAME}" ]; then
;;
esac

./configure --prefix $1 --enable-shared --enable-optimizations --without-system-ffi ${SSL}
./configure --prefix $1 --enable-shared --enable-optimizations ${SSL}
make -j4 build_all
make install
)
Expand Down

0 comments on commit 05a4ce3

Please sign in to comment.