Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Building with debug symbols #660

Answered by eli-schwartz
voidtrance asked this question in Q&A
Discussion options

I am trying to use meson-python to build a Python extension and some shared libraries. By default, the build type is release which strips the debug symbols. I want to be able to do debug builds, as well.

All of the documentation that I have found says that to do a debug build with meson-python, I have to run

python -m pip install --no-build-isolation --editable . -Csetup-args=-Dbuildtype=debug

However, when I do this I get an error that -C is a unknown option:

# python -m pip install --no-build-isolation --editable . -Csetup-args=-Dbuildtype=debug

Usage:   
  /usr/bin/python -m pip install [options] <requirement specifier> [package-index-options] ...
  /usr/bin/python -m pip install [options] -r <requirements file> [package-index-options] ...
  /usr/bin/python -m pip install [options] [-e] <vcs project url> ...
  /usr/bin/python -m pip install [options] [-e] <local project path> ...
  /usr/bin/python -m pip install [options] <archive url/path> ...

no such option: -C

How do I do debug builds?

You must be logged in to vote

This says that pip doesn't have a "-C" option, so it's a pip issue not a meson-python issue.

pip added this option in pip 23.1, see https://pip.pypa.io/en/stable/news/#v23-1

Before then you had to use --config-settings=setup-args=-Dbuildtype=debug IIRC.

Which version of pip do you have installed? Maybe try upgrading it (pip generally warns you when it is out of date, if it can).

Replies: 1 comment · 3 replies

Comment options

This says that pip doesn't have a "-C" option, so it's a pip issue not a meson-python issue.

pip added this option in pip 23.1, see https://pip.pypa.io/en/stable/news/#v23-1

Before then you had to use --config-settings=setup-args=-Dbuildtype=debug IIRC.

Which version of pip do you have installed? Maybe try upgrading it (pip generally warns you when it is out of date, if it can).

You must be logged in to vote
3 replies
@voidtrance
Comment options

This says that pip doesn't have a "-C" option, so it's a pip issue not a meson-python issue.

pip added this option in pip 23.1, see https://pip.pypa.io/en/stable/news/#v23-1

Before then you had to use --config-settings=setup-args=-Dbuildtype=debug IIRC.

Which version of pip do you have installed? Maybe try upgrading it (pip generally warns you when it is out of date, if it can).

pip 22.3.1 from /usr/lib/python3.11/site-packages/pip (python 3.11)

However, even with the --config-settings option (which did not produce an error), meson is not rebuilding the code:

python -m pip install --no-build-isolation --editable . --config-settings=setup-args=-Dbuildtype=debug
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/user/vortex
  Checking if build backend supports build_editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Building wheels for collected packages: vortex
  Building editable for vortex (pyproject.toml) ... done
  Created wheel for vortex: filename=vortex-0.0.1-cp311-cp311-linux_x86_64.whl size=12259 sha256=554b22e3e3134c5e708bbaeaae373de9680d657c0224aedda549ef71159c0b68
  Stored in directory: /tmp/pip-ephem-wheel-cache-dxzd_iha/wheels/c1/7c/2d/c90812d811408c420a1d287923822f66cdea23a51dd438281a
Successfully built vortex
Installing collected packages: vortex
  Attempting uninstall: vortex
    Found existing installation: vortex 0.0.1
    Uninstalling vortex-0.0.1:
      Successfully uninstalled vortex-0.0.1
Successfully installed vortex-0.0.1
@rgommers
Comment options

meson is not rebuilding the code:

meson setup , which does the configure step of the build and is responsible for handling CLI flags as well as env vars like CFLAGS, is only run on a clean build. Your build command looks right, it should work if you start from a clean build dir (so run rm -rf build or git clean -xdf).

@dnicolodi
Comment options

meson-python runs meson setup --reconfigure passing all new configuration options when run with an already configured build directory. Therefore, removing the build directory should not be necessary. I've just tried to reproduce the issue and everything works as expected here. You can pass the -v option to pip to see which configuration settings are passed to meson setup and how these are interpreted.

Answer selected by rgommers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.