|
>Submitter-Id: current-users >Originator: Marcus von Appen >Organization: >Confidential: no >Synopsis: [PATCH]: lang/python26+ must not set OPT >Severity: non-critical >Priority: medium >Category: ports >Class: sw-bug >Release: FreeBSD 9.0-STABLE amd64 >Environment: >Description: Python 2.6 and newer implicitly uses the environment's CFLAGS settings for the build of all binaries and modules. The CFLAGS are stored in ${LOCALBASE}/lib/pythonX.X*/config*/Makefile and picked up by distutils for building extension modules. Assigning CFLAGS to OPTS in CONFIGURE_ENV leads to the following issues: * not fully debug clean, since -DNDEBUG is not propagated, although OPT= is a user option, but not a full debug build either * duplicate CFLAGS for extension module, complicating CFLAGS debugging for users * OPT is not for CFLAGS lang/python25- use OPT and other environment variables to influence the build for the target platform, so for the time being OPT needs to receive ${CFLAGS} on those. >How-To-Repeat: Build any of lang/python26+ # sed -n -e '/^CFLAGS=/p' -e '/^OPT=/p' \ /usr/local/lib/pythonX.X/config/Makefile OPT= -DNDEBUG -O2 -fno-strict-aliasing -pipe -march=nocona CFLAGS= $(BASECFLAGS) -O2 -fno-strict-aliasing -pipe -march=nocona $(OPT) $(EXTRA_CFLAGS) >Fix: Index: python26/Makefile =================================================================== RCS file: /home/pcvs/ports/lang/python26/Makefile,v retrieving revision 1.185 diff -u -r1.185 Makefile --- python26/Makefile 31 May 2012 15:17:32 -0000 1.185 +++ python26/Makefile 6 Jun 2012 17:00:00 -0000 @@ -21,7 +21,7 @@ PATCH_WRKSRC= ${PYTHON_WRKSRC} GNU_CONFIGURE= yes CONFIGURE_SCRIPT= ../configure # must be relative -CONFIGURE_ENV= OPT="${CFLAGS}" SVNVERSION="echo freebsd" +CONFIGURE_ENV= OPT="" SVNVERSION="echo freebsd" MAKE_ENV= VPATH="${PYTHON_WRKSRC}" USE_LDCONFIG= yes MAKE_JOBS_SAFE= yes Index: python27/Makefile =================================================================== RCS file: /home/pcvs/ports/lang/python27/Makefile,v retrieving revision 1.188 diff -u -r1.188 Makefile --- python27/Makefile 31 May 2012 15:17:32 -0000 1.188 +++ python27/Makefile 6 Jun 2012 17:00:00 -0000 @@ -21,7 +21,7 @@ PATCH_WRKSRC= ${PYTHON_WRKSRC} GNU_CONFIGURE= yes CONFIGURE_SCRIPT= ../configure # must be relative -CONFIGURE_ENV= OPT="${CFLAGS}" SVNVERSION="echo freebsd" +CONFIGURE_ENV= OPT="" SVNVERSION="echo freebsd" MAKE_ENV= VPATH="${PYTHON_WRKSRC}" USE_LDCONFIG= yes MAKE_JOBS_SAFE= yes Index: python31/Makefile =================================================================== RCS file: /home/pcvs/ports/lang/python31/Makefile,v retrieving revision 1.182 diff -u -r1.182 Makefile --- python31/Makefile 31 May 2012 10:13:55 -0000 1.182 +++ python31/Makefile 6 Jun 2012 17:00:00 -0000 @@ -21,7 +21,7 @@ PATCH_WRKSRC= ${PYTHON_WRKSRC} GNU_CONFIGURE= yes CONFIGURE_SCRIPT= ../configure # must be relative -CONFIGURE_ENV= OPT="${CFLAGS}" SVNVERSION="echo freebsd" +CONFIGURE_ENV= OPT="" SVNVERSION="echo freebsd" MAKE_ENV= VPATH="${PYTHON_WRKSRC}" MAKE_JOBS_SAFE= yes USE_LDCONFIG= yes Index: python32/Makefile =================================================================== RCS file: /home/pcvs/ports/lang/python32/Makefile,v retrieving revision 1.186 diff -u -r1.186 Makefile --- python32/Makefile 31 May 2012 10:13:55 -0000 1.186 +++ python32/Makefile 6 Jun 2012 17:00:00 -0000 @@ -21,7 +21,7 @@ PATCH_WRKSRC= ${PYTHON_WRKSRC} GNU_CONFIGURE= yes CONFIGURE_SCRIPT= ../configure # must be relative -CONFIGURE_ENV= OPT="${CFLAGS}" SVNVERSION="echo freebsd" +CONFIGURE_ENV= OPT="" SVNVERSION="echo freebsd" MAKE_ENV= VPATH="${PYTHON_WRKSRC}" MAKE_JOBS_SAFE= yes USE_LDCONFIG= yes _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-python To unsubscribe, send any mail to "[hidden email]" |
|
On, Wed Jun 06, 2012, Marcus von Appen wrote:
[OPT cleanup] The patch actually is wrong. It should be the other way around, since OPT gets included by the CFLAGS of the python build as well as for every python package depending on distutils: distutils/sysconfig.py, def customize_compiler(compiler): [...] if compiler.compiler_type == "unix": (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS') [...] if 'CFLAGS' in os.environ: cflags = opt + ' ' + os.environ['CFLAGS'] ldshared = ldshared + ' ' + os.environ['CFLAGS'] As shown above, opt is always appended to distutils's CFLAGS settings for the C compiler, hence every additional flags we usually would pass to CFLAGS or CPPFLAGS in a port's Makefile, would need to go into OPTS instead, to be consistent and guaranteed to be applied (since CFLAGS from config/Makefile is not necessarily used). A slight issue with the LDFLAGS remains for the python-config script, which does not pick up Python's LDFLAGS, but uses LIBS, SYSLIBS and LIBPL install, omitting any additional LDFLAGS specified elsewhere. Both, the OPT assignment and python-config LDFLAGS behaviour need to be fixed in that aspect (patches will follow). Cheers Marcus |
| Powered by Nabble | Edit this page |
