Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482348 - dev-lang/python - Respect USE=debug and pass --with-pydebug to configure.
Summary: dev-lang/python - Respect USE=debug and pass --with-pydebug to configure.
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-24 19:27 UTC by Martin Mokrejš
Modified: 2023-07-31 12:54 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,523.34 KB, text/plain)
2023-07-31 12:45 UTC, Dmitriy Baranov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2013-08-24 19:27:01 UTC
I had to hack python-2.7 ebuild to pass --with-pydebug to get hopefully better stacktraces. Would be nice if USE=debug could be used for this.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2013-08-25 05:07:53 UTC
--with-pydebug changes C ABI of Python and requires rebuilding of all packages providing Python extension modules (*.so) or embedding Python interpreter.
Comment 2 Martin Mokrejš 2013-08-25 10:31:03 UTC
Running python-updater is the usual requirement but your are right, I also needed to recompile chromium but even gdb.

Don't know if that is a a bug or feature but python-related apps now print (probably on STDERR) some numbers in square brackets. An example of the behavior during gdb reinstall:


>>> Completed installing gdb-7.6 into /mnt/1TB/var/tmp/portage/sys-devel/gdb-7.6/image/

[26176 refs]
[26176 refs]
[45091 refs]
ecompressdir: bzip2 -9 /usr/share/info
ecompressdir: bzip2 -9 /usr/share/man

 * QA Notice: The following shared libraries lack a SONAME
 * /usr/lib64/libinproctrace.so

[18329 refs]
[45099 refs]

>>> Installing (1 of 1) sys-devel/gdb-7.6
[26176 refs]
[45091 refs]
[45099 refs]



Looks I managed to to do the transition to pydebug-enabled system and Gentoo is the easiest distribution to do that for me. Other than tyhat I don't see a problem with my system so far.
Comment 3 Arfrever Frehtes Taifersar Arahesis 2013-08-25 13:29:13 UTC
(In reply to Martin Mokrejš from comment #2)
> some numbers in square brackets

http://docs.python.org/3.4/c-api/intro.html#debugging-builds
"Upon exit, all existing references are printed. (In interactive mode this happens after every statement run by the interpreter.)"
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-25 13:32:04 UTC
(In reply to Martin Mokrejš from comment #2)
> Running python-updater is the usual requirement but your are right, I also
> needed to recompile chromium but even gdb.

Nope, we're killing python-updater. It's broken already, and nobody bothers fixing it.

> Looks I managed to to do the transition to pydebug-enabled system and Gentoo
> is the easiest distribution to do that for me. Other than tyhat I don't see
> a problem with my system so far.

If we really want this, we can add USE=debug bug permanently masked. Otherwise, you can use EXTRA_ECONF to append it via package.env.
Comment 5 Martin Mokrejš 2013-08-25 22:24:45 UTC
(In reply to Michał Górny from comment #4)
> (In reply to Martin Mokrejš from comment #2)
> > Running python-updater is the usual requirement but your are right, I also
> > needed to recompile chromium but even gdb.
> 
> Nope, we're killing python-updater. It's broken already, and nobody bothers
> fixing it.

This is a bit off-topic but please make python-updater to print a fat warning then explaining what other tool is one supposed to use.


> 
> > Looks I managed to to do the transition to pydebug-enabled system and Gentoo
> > is the easiest distribution to do that for me. Other than that I don't see
> > a problem with my system so far.
> 
> If we really want this, we can add USE=debug bug permanently masked.
> Otherwise, you can use EXTRA_ECONF to append it via package.env.

Don't really understand what you mean here. You mean 
  EXTRA_ECONF='--with-pydebug' emerge python
?

What is the point of obeying a USE flag? People are used to use them, USE=debug exists so why to invent something else? Especially as Gentoo want USE=debug to only enable application-specific debugging whereas average user anticipates that it would automagically inject -gg3 or -ggdb to compiler. So, in this particular case, "USE=debug emerge python" should really end up in "--with-pydebug" passed to configure. It is exactly for this kind of purpose.
Comment 6 Mike Gilbert gentoo-dev 2013-08-25 23:31:06 UTC
(In reply to Martin Mokrejš from comment #5)
> This is a bit off-topic but please make python-updater to print a fat
> warning then explaining what other tool is one supposed to use.
> 

Once we have everything migrated to PYTHON_TARGETS, you won't need to run python-updater; emerge --changed-use would be the replacement.

> Don't really understand what you mean here. You mean 
>   EXTRA_ECONF='--with-pydebug' emerge python
> ?
> 
> What is the point of obeying a USE flag? People are used to use them,
> USE=debug exists so why to invent something else? Especially as Gentoo want
> USE=debug to only enable application-specific debugging whereas average user
> anticipates that it would automagically inject -gg3 or -ggdb to compiler.
> So, in this particular case, "USE=debug emerge python" should really end up
> in "--with-pydebug" passed to configure. It is exactly for this kind of
> purpose.

It's a feature that very few people would actually want to enable, and adding/maintaining use flags takes some effort. So the cost to benefit ratio is not very good. We are not saying "no" to the use flag, but we probably aren't going to implement it right away.

EXTRA_ECONF is a workaround so that you can enable this functionality without having to modify the ebuild. You may utilize it like this:

mkdir -p /etc/portage/env
echo 'EXTRA_ECONF="--with-pydebug"' > /etc/portage/env/pydebug.conf
echo dev-lang/python pydebug.conf >> /etc/portage/package.env
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-26 06:51:01 UTC
(In reply to Martin Mokrejš from comment #5)
> > > Looks I managed to to do the transition to pydebug-enabled system and Gentoo
> > > is the easiest distribution to do that for me. Other than that I don't see
> > > a problem with my system so far.
> > 
> > If we really want this, we can add USE=debug bug permanently masked.
> > Otherwise, you can use EXTRA_ECONF to append it via package.env.
> 
> Don't really understand what you mean here. You mean 
>   EXTRA_ECONF='--with-pydebug' emerge python
> ?
> 
> What is the point of obeying a USE flag? People are used to use them,
> USE=debug exists so why to invent something else? Especially as Gentoo want
> USE=debug to only enable application-specific debugging whereas average user
> anticipates that it would automagically inject -gg3 or -ggdb to compiler.
> So, in this particular case, "USE=debug emerge python" should really end up
> in "--with-pydebug" passed to configure. It is exactly for this kind of
> purpose.

USE=debug is for debug that does not interfere with normal behavior. If something changes Python ABI and prints additional output when it's not expected by applications and unlikely expected by users it's a large change.

It's not like typical USE=debug that does some assertions (that wouldn't fail and therefore cause behavior changes in a perfect world) and/or debug output in specific channels (e.g. logs). Here USE=debug changes a lot and we don't support that.

Giving a USE flag would suggest otherwise.
Comment 8 Dmitriy Baranov 2023-07-31 12:45:27 UTC
Created attachment 866718 [details]
build.log

(In reply to Mike Gilbert from comment #6)
> mkdir -p /etc/portage/env
> echo 'EXTRA_ECONF="--with-pydebug"' > /etc/portage/env/pydebug.conf
> echo dev-lang/python pydebug.conf >> /etc/portage/package.env

It doesn't compile:
rm: cannot remove '/var/tmp/portage/dev-lang/python-3.11.4/image/usr/lib64/libpython3.so': No such file or directory
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-31 12:53:59 UTC
I'm going to close this given:

commit 4c6957bd00ba63468d93f40982d77a378858569d
Author: Sam James <sam@gentoo.org>
Date:   Fri May 26 08:48:29 2023 +0100

    dev-lang/python: add USE=debug to control assertions

    Note that we don't do pydebug for this as it forces optimisations to be disabled
    (-O0, not just some). For newer Pythons, fwiw, pydebug is ABI compatible with
    release pythons, but still not worth it.

    Signed-off-by: Sam James <sam@gentoo.org>