Skip to content

Commit

Permalink
Cherry-pick more upstream fixes to support building against python 3.8 (
Browse files Browse the repository at this point in the history
#203)

* Add Python 3.8 compatibility

From Python 3.8 and onwards C extensions are no longer
linked to libpython so in order to embed python within
an application the --embed flag needs to be added to
python3-config --libs. A fall back is provided as the
command will error out on previous python versions.

References: https://bugs.python.org/issue36721

* Fix linking with Python 3.8

Since Python 3.8 --embed flag needs to be provided to python-config to embed python.
Reference: https://bugs.python.org/issue36721

This was partially addressed in collectd#3170 but only fixed building and not linking with python.

Co-authored-by: Charalampos Stratakis <[email protected]>
Co-authored-by: Alexander Meshcheryakov <[email protected]>
  • Loading branch information
3 people authored Jun 29, 2022
1 parent ddd6333 commit 9e7c24c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4713,11 +4713,11 @@ if test "$PYTHON3_CONFIG" != ""; then
if test $? -ne 0; then
with_libpython3="no"
fi
LIBPYTHON3_LDFLAGS="`${PYTHON3_CONFIG} --ldflags`"
LIBPYTHON3_LDFLAGS="`${PYTHON3_CONFIG} --ldflags --embed`" || LIBPYTHON3_LDFLAGS="`${PYTHON3_CONFIG} --ldflags`"
if test $? -ne 0; then
with_libpython3="no"
fi
LIBPYTHON3_LIBS="`${PYTHON3_CONFIG} --libs`"
LIBPYTHON3_LIBS="`${PYTHON3_CONFIG} --libs --embed`" || LIBPYTHON3_LIBS="`${PYTHON3_CONFIG} --libs`"
if test $? -ne 0; then
with_libpython3="no"
fi
Expand Down

0 comments on commit 9e7c24c

Please sign in to comment.