Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 513664 - distutils-r1.eclass: distutils does not respect CC/CXX
Summary: distutils-r1.eclass: distutils does not respect CC/CXX
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 457716 (view as bug list)
Depends on:
Blocks: 457716
  Show dependency tree
 
Reported: 2014-06-18 09:04 UTC by Michał Górny
Modified: 2014-06-23 07:33 UTC (History)
2 users (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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-06-18 09:04:33 UTC
/usr/lib64/python2.7/_sysconfigdata.py: 'CC': 'x86_64-pc-linux-gnu-gcc-4.8.2 -pthread',

and so on.

Now that I've upgraded to gcc-4.8.3, no Python extension builds :)
Comment 1 Arfrever Frehtes Taifersar Arahesis 2014-06-18 09:20:15 UTC
Actually Distutils respecteth CC and CXX, but they are not exported by distutils*.eclass.

For linking, LDSHARED and LDCXXSHARED are used.

Apparently there is a regression with value of LDSHARED in 2.7 branch...

$ (for x in 2.6 2.7 3.1 3.2 3.3 3.4 3.5; do echo -e "=== ${x} ==="; python${x} -c 'from distutils.sysconfig import get_config_var; print("CC=%r" % get_config_var("CC")); print("CXX=%r" % get_config_var("CXX")); print("LDSHARED=%r" % get_config_var("LDSHARED")); print("LDCXXSHARED=%r" % get_config_var("LDCXXSHARED"))'; done)
=== 2.6 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 2.7 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,--hash-style=gnu -Wl,--sort-common'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 3.1 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 3.2 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 3.3 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 3.4 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
=== 3.5 ===
CC='x86_64-pc-linux-gnu-gcc -pthread'
CXX='x86_64-pc-linux-gnu-g++ -pthread'
LDSHARED='x86_64-pc-linux-gnu-gcc -pthread -shared'
LDCXXSHARED='x86_64-pc-linux-gnu-g++ -pthread -shared'
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-06-19 12:54:55 UTC
Arfrever, thanks.

+  19 Jun 2014; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
+  Always set up CC, CXX and friends for distutils builds, bug #513664. Thanks
+  to Arfrever for the explanation.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-06-19 12:56:53 UTC
*** Bug 457716 has been marked as a duplicate of this bug. ***
Comment 4 Arfrever Frehtes Taifersar Arahesis 2014-06-21 11:50:56 UTC
Grobian:

Re http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.97&r2=1.98&view=patch :

Please show stored value of LDSHARED for different versions of Python.
Comment 5 Fabian Groffen gentoo-dev 2014-06-21 20:09:31 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #4)
> Grobian:
> 
> Re
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/distutils-r1.
> eclass?r1=1.97&r2=1.98&view=patch :
> 
> Please show stored value of LDSHARED for different versions of Python.

-shared is invalid on Darwin, we need -bundle and more flags.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-06-21 20:28:52 UTC
(In reply to Fabian Groffen from comment #5)
> (In reply to Arfrever Frehtes Taifersar Arahesis from comment #4)
> > Grobian:
> > 
> > Re
> > http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/distutils-r1.
> > eclass?r1=1.97&r2=1.98&view=patch :
> > 
> > Please show stored value of LDSHARED for different versions of Python.
> 
> -shared is invalid on Darwin, we need -bundle and more flags.

Are those flags 'generic' or specific to linking of Python extensions? I'm wondering if it'd make sense to create some toolchain-funcs function to obtain the necessary flags.

It is important that we already override LDSHARED and LDCXXSHARED since otherwise distutils may not respect CC/CXX during linking and use another compiler.
Comment 7 Fabian Groffen gentoo-dev 2014-06-22 06:44:59 UTC
$ (for x in 2.6 2.7 3.1 3.2 3.3 3.4 3.5; do echo -e "=== ${x} ==="; python${x} -c 'from distutils.sysconfig import get_config_var; print("CC=%r" % get_config_var("CC")); print("CXX=%r" % get_config_var("CXX")); print("LDSHARED=%r" % get_config_var("LDSHARED")); print("LDCXXSHARED=%r" % get_config_var("LDCXXSHARED"))'; done)
=== 2.6 ===
CC='cc'
CXX='c++'
LDSHARED='cc -Wl,-F. -bundle -undefined dynamic_lookup -arch x86_64 -arch i386'
LDCXXSHARED=None
=== 2.7 ===
CC='x86_64-apple-darwin13-gcc'
CXX='x86_64-apple-darwin13-g++'
LDSHARED='x86_64-apple-darwin13-gcc -bundle -undefined dynamic_lookup -Wl,-dead_strip_dylibs -L/Library/Gentoo/lib -L/Library/Gentoo/usr/lib -L/usr/lib -L.'
LDCXXSHARED='x86_64-apple-darwin13-g++ -bundle -undefined dynamic_lookup'
=== 3.1 ===
bash: python3.1: command not found
=== 3.2 ===
bash: python3.2: command not found
=== 3.3 ===
CC='x86_64-apple-darwin13-gcc'
CXX='x86_64-apple-darwin13-g++'
LDSHARED='x86_64-apple-darwin13-gcc -bundle -undefined dynamic_lookup'
LDCXXSHARED='x86_64-apple-darwin13-g++ -bundle -undefined dynamic_lookup'
=== 3.4 ===
bash: python3.4: command not found
=== 3.5 ===
bash: python3.5: command not found


I need: "$(tc-getCC) -bundle -undefined dynamic_lookup", this is because python builds modules, not shared modules here.  A case statement in the eclass to trap darwin hosts and use the flags I need would probably be best.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-06-22 07:04:23 UTC
+  22 Jun 2014; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
+  Set LD{,CXX}SHARED properly for Darwin, reported by Fabian Groffen on bug
+  #513664.
Comment 9 Michael Haubenwallner (RETIRED) gentoo-dev 2014-06-23 07:33:22 UTC
Headsup for the related upstream issue: http://bugs.python.org/issue15590