[Bug 2115579] Re: python3-config --cflags is wong with Ubuntu 24.04.2 LTS

Adrian Johnston 2115579 at bugs.launchpad.net
Sun Jun 29 21:04:27 UTC 2025


That was the correct fix, thank you.  Although my problem was a little
different and I'd like to explain while I have a bug open.

The docs seems to be out of date.  The latest version of your man page
doesn't mention --embed.  And the --libs flag doesn't give you the actual
python libs. Should I report a bug there?  I'm assuming you know what is
the fix.

https://manpages.debian.org/testing/python3-dev/python3-config.1.en.html

Only the Python docs mention the flag.
https://docs.python.org/3/extending/embedding.html

To explain my concern, I wasn't trying to embed the interpreter. I was
trying to link a nanobind module (uses template meta-programming to
generate a C++ library intended to be loaded by Python as a module) which
didn't seem to me to involve embedding the interpreter.  Just now I
confirmed I am using the "Python C API" for miscellaneous utilities and not
invoking the actual interpreter at any time.

My point and my argument is that the documentation is wrong.  It seems you
can't touch the Python C API at all without --embed.  And I would describe
"using the C API" as every use case you have.  So the docs should say "you
can't link against Python at all without --embed."  And right now that is a
secret.

Here is my command line in case you were wondering.
+ clang++ -I/usr/include/python3.12 -I/usr/include/python3.12
-fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall
-fdiagnostics-absolute-paths -Wfatal-errors
-I/home/t/Documents/hatchlingplatform/include -DHX_RELEASE=0
-L/usr/lib/python3.12/config-3.12-x86_64-linux-gnu
-L/usr/lib/x86_64-linux-gnu -lpython3.12 -ldl -lm -std=c++17 -lstdc++
-pthread -lpthread *.cpp  -o test

Thanks!

On Sun, Jun 29, 2025 at 8:50 AM Stefano Rivera <2115579 at bugs.launchpad.net>
wrote:

> If you're wanting to embed python, you need to use --embed.
>
> ** Changed in: python3-defaults (Ubuntu)
>        Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2115579
>
> Title:
>   python3-config --cflags is wong with Ubuntu 24.04.2 LTS
>
> Status in python3-defaults package in Ubuntu:
>   Incomplete
>
> Bug description:
>
>   Right now --cflags is returning the Python include path twice and the
> library zero times.  It is missing  -lpython3.12 and requires hand patching.
>
>   This is what I am getting.
>
>   ~$ python3-config --cflags
>   -I/usr/include/python3.12 -I/usr/include/python3.12
> -fno-strict-overflow -Wsign-compare  -DNDEBUG -g -O2 -Wall
>
>   ProblemType: Bug
>   DistroRelease: Ubuntu 24.04
>   Package: python3 3.12.3-0ubuntu2
>   ProcVersionSignature: Ubuntu 6.11.0-26.26~24.04.1-generic 6.11.11
>   Uname: Linux 6.11.0-26-generic x86_64
>   NonfreeKernelModules: wl
>   ApportVersion: 2.28.1-0ubuntu3.7
>   Architecture: amd64
>   CasperMD5CheckResult: pass
>   CurrentDesktop: ubuntu:GNOME
>   Date: Sat Jun 28 15:36:37 2025
>   InstallationDate: Installed on 2024-11-08 (232 days ago)
>   InstallationMedia: Ubuntu 24.04.1 LTS "Noble Numbat" - Release amd64
> (20240827.1)
>   ProcEnviron:
>    LANG=en_US.UTF-8
>    PATH=(custom, no user)
>    SHELL=/bin/dash
>    TERM=xterm-256color
>   RebootRequiredPkgs: Error: path contained symlinks.
>   SourcePackage: python3-defaults
>   UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/2115579/+subscriptions
>
>

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/2115579

Title:
  python3-config --cflags is wong with Ubuntu 24.04.2 LTS

Status in python3-defaults package in Ubuntu:
  Incomplete

Bug description:
  
  Right now --cflags is returning the Python include path twice and the library zero times.  It is missing  -lpython3.12 and requires hand patching.

  This is what I am getting.

  ~$ python3-config --cflags
  -I/usr/include/python3.12 -I/usr/include/python3.12  -fno-strict-overflow -Wsign-compare  -DNDEBUG -g -O2 -Wall

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: python3 3.12.3-0ubuntu2
  ProcVersionSignature: Ubuntu 6.11.0-26.26~24.04.1-generic 6.11.11
  Uname: Linux 6.11.0-26-generic x86_64
  NonfreeKernelModules: wl
  ApportVersion: 2.28.1-0ubuntu3.7
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Sat Jun 28 15:36:37 2025
  InstallationDate: Installed on 2024-11-08 (232 days ago)
  InstallationMedia: Ubuntu 24.04.1 LTS "Noble Numbat" - Release amd64 (20240827.1)
  ProcEnviron:
   LANG=en_US.UTF-8
   PATH=(custom, no user)
   SHELL=/bin/dash
   TERM=xterm-256color
  RebootRequiredPkgs: Error: path contained symlinks.
  SourcePackage: python3-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/2115579/+subscriptions




More information about the foundations-bugs mailing list