Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 770076 - dev-lang/python: library path appended to LDFLAGS
Summary: dev-lang/python: library path appended to LDFLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-11 14:04 UTC by Michael Orlitzky
Modified: 2021-02-11 23:07 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2021-02-11 14:04:39 UTC
Our python ebuilds are still adding,

  # Set LDFLAGS so we link modules with -lpython3.2 correctly.
  # Needed on FreeBSD unless Python 3.2 is already installed.
  # Please query BSD team before removing this!
  append-ldflags "-L."

to its LDFLAGS. I don't think this is a problem for Gentoo per se, but the fact that python's *FLAGS are adding things into the include paths has been problematic elsewhere; for example homebrew:

  https://github.com/Homebrew/homebrew-core/issues/68352

To avoid obscure breakages, SageMath (which makes heavy use of cython) has begun rejecting the system python if it adds any -I or -L flags into CFLAGS or LFLAGS.

I can work around this, but, if the only reason to keep it around is for an ancient version of python on a Gentoo/FreeBSD that no longer exists, then maybe it's easier to just delete it.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-02-11 14:08:59 UTC
Ok, doing a test run on all the Pythons.
Comment 2 Larry the Git Cow gentoo-dev 2021-02-11 14:37:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ede26713b5d391957cc587b166d3aa1e6d5fb25

commit 2ede26713b5d391957cc587b166d3aa1e6d5fb25
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-02-11 14:35:50 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-02-11 14:37:20 +0000

    dev-lang/python: Remove obsolete -L. hack
    
    Closes: https://bugs.gentoo.org/770076
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-lang/python/python-2.7.18-r6.ebuild     | 5 -----
 dev-lang/python/python-3.10.0_alpha5.ebuild | 5 -----
 dev-lang/python/python-3.6.12-r2.ebuild     | 5 -----
 dev-lang/python/python-3.7.9-r2.ebuild      | 5 -----
 dev-lang/python/python-3.8.7-r1.ebuild      | 5 -----
 dev-lang/python/python-3.9.1-r1.ebuild      | 5 -----
 6 files changed, 30 deletions(-)
Comment 3 Michael Orlitzky gentoo-dev 2021-02-11 14:39:01 UTC
Cool, thanks!
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-02-11 14:39:32 UTC
Hrmm, I didn't revbump because this is an obscure problem but maybe I should've if you actually need it to build SageMath.  Could you confirm that everything works for you with the updated ebuilds before I do the revbump?
Comment 5 Michael Orlitzky gentoo-dev 2021-02-11 14:56:44 UTC
It works now:

  Checking whether SageMath should install SPKG python3...
  ...
  configure: will use system package and not install SPKG python3

This is only a problem in the latest beta version of SageMath (which isn't in the tree), so a revbump is not critical.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2021-02-11 22:18:25 UTC
Original problem possibly consisted of 2 subproblems:


1. Missing patterns in hardcoded list in configure.ac (previously configure.in), which specifies platforms on which -L. is used by non-distutils part of build system:

  BLDLIBRARY='-L. -lpython$(LDVERSION)'

Addition of NetBSD* (2003-05-31, CPython >=2.3):
https://github.com/python/cpython/commit/96ce8057257b00b07c56999480343a603a9740aa

Addition of FreeBSD* (2004-10-26, CPython >=2.4):
https://github.com/python/cpython/commit/337614993e6f329143e5a68349b62f0a43114ac9

Addition of DragonFly* (2006-02-17, CPython >=2.5):
https://github.com/python/cpython/commit/86d662602d18dccbae4ee7bf23564263dee7141e

Addition of OpenBSD* (2011-07-24, CPython =2.* && >=2.7.5, CPython >=3.2.2):
https://github.com/python/cpython/commit/749400a94d78bb714a8964c21f8979ab6b070708

Addition of VxWorks* (2020-12-14, CPython >=3.10.0a4):
https://github.com/python/cpython/commit/c117426bf8e7dd7a25e7d15bfbc88253b6ed42de


2. Missing usage of -L. by distutils part of build system on some platforms:

Dropping of incomplete hardcoded list (2013-09-28, CPython >=3.3.4):
https://github.com/python/cpython/commit/643238eb53805bc77148adbca83cd22e34d8aeba
Since this commit, self.library_dirs.append('.') is used on all platforms:

> -        # for extensions under Linux or Solaris with a shared Python library,
> +        # For building extensions with a shared Python library,
>          # Python's library directory must be appended to library_dirs
> -        sysconfig.get_config_var('Py_ENABLE_SHARED')
> -        if (sys.platform.startswith(('linux', 'gnu', 'sunos'))
> -            and sysconfig.get_config_var('Py_ENABLE_SHARED')):
> +        # See Issues: #1600860, #4366
> +        if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
>              if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
>                  # building third party extensions
>                  self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
>              else:
>                  # building python standard extensions
>                  self.library_dirs.append('.')

Dropping of incomplete hardcoded list (2013-09-28, CPython =2.* && >=2.7.6):
https://github.com/python/cpython/commit/0879b168bf73d3b7e1e6443bdf162c3ecf4f55b7
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-02-11 23:07:39 UTC
(In reply to Michael Orlitzky from comment #5)
> This is only a problem in the latest beta version of SageMath (which isn't
> in the tree), so a revbump is not critical.

Ok, please let me know if you end up needing one.  Though probably you won't because next 3.8+3.9 releases are planned for Feb 15, and 3.6+3.7 are already late one month.