linking python libraries fails in focal

Asked by Sampsa Riikonen on 2020-08-23

My code builds allright at your server farm for Bionic, but when sending __exactly the same code__ for Focal, the linking fails.

I get stuff like "undefined reference to `PyImport_ImportModule'" and similar error messages to all Python C API calls.

This works OK:

Here the linking fails:

As I emphasized, it's exactly the same code. I guess I have to install focal on an extra laptop and try to compile "manually"..

Question information

English Edit question
Launchpad itself Edit question
No assignee Edit question
Last query:
Last reply:

This question was reopened

Colin Watson (cjwatson) said : #1

You don't need a separate machine. should let you set up a build environment for focal on your bionic system, and then you can debug the problem interactively. Try that first; if you're still stuck after that then we can possibly have a look.

I'll be damned..

pkg-config is not correctly configured for python3-dev in ubuntu 20..!

In LTS 18:

pkg-config python3 --libs



In LTS 20:

it gives nothing..!

I wonder where should I file a bug report about this one..

Colin Watson (cjwatson) said : #4

OK - that looks like it should give you enough to go on, so marking this as Answered again, unless there's more for us to do.

I do this cmake bs in my CMakeLists.txt:

exec_program(python3-config ARGS --includes OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS_TMP) # this bullshit must be parsed
exec_program(python3-config ARGS --libs OUTPUT_VARIABLE PYTHON_LIBRARIES_TMP)

seems to fix the issue at least on my ubuntu 20 laptop

python3-config --libs


python3-config --ldflags

Give completely different answers in 18.04 and 20.04 ...!

In 18.04 the correct answer is given with "--libs" while in 20.04 it should be "--ldflags"

Any help appreciated..

Colin Watson (cjwatson) said : #7

Sorry, at this point this is outside the realm of things we can help you with as Launchpad support people; we just make build environments available, and don't maintain Ubuntu's Python packages. I suggest asking on, or filing a bug using "ubuntu-bug python3.8" if you believe it to be a bug in the 20.04 Python packaging.

Can you help with this problem?

Provide an answer of your own, or ask Sampsa Riikonen for more information if necessary.

To post a message you must log in.