-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix linking with Python 3.8 #3344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 #3170 but only fixed building and not linking with python.
@@ -4711,7 +4711,7 @@ if test "$PYTHON_CONFIG" != ""; then | |||
if test $? -ne 0; then | |||
with_libpython="no" | |||
fi | |||
LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`" | |||
LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags --embed`" || LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please redirect stderr of the first command to /dev/null, otherwise an error shows up on all systems where we don't have python 3.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked python2-config --unsupported-flag
and python3-config --unsupported-flag
behaviour on couple of systems. And everywhere python-config
sent error message to stdout. So on systems with python older than 3.8 error message would be stored in $LIBPYTHON_LDFLAGS
and not displayed.
On the other hand, future versions of python might correctly give error to stderr if something went wrong unrelated to --embed
flag.
Therefore it seems to me current variant, without devnulling of stderr, is better.
Do you insist on stderr redirection anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me and is also consistent with the other part of python3.8 work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix
@@ -4711,7 +4711,7 @@ if test "$PYTHON_CONFIG" != ""; then | |||
if test $? -ne 0; then | |||
with_libpython="no" | |||
fi | |||
LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`" | |||
LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags --embed`" || LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me and is also consistent with the other part of python3.8 work
Currently container will fail with error (dlopen("/usr/lib/collectd/python.so") failed) if collectd configuration loads python plugin See https://bugs.archlinux.org/task/64533 Fixed in source (collectd/collectd#3344) but not in pre-built packages. Solution for now is building Collectd from source.
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 #3170 but only fixed building and not linking with python.
ChangeLog: Fix linking with Python 3.8