Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 527116

Summary: bootstrap prefix fails on OS X: python-2.7.6-r1 fails to compile
Product: Gentoo/Alt Reporter: Guilherme Amadio <amadio>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: RESOLVED FIXED    
Severity: normal CC: amadio, cnyegle
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: OS X   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 527514    
Attachments: Build log with USE=aqua
Build log with USE=-aqua
python-2.7.5-r4 build log with USE=aqua
python-2.7.8.ebuild

Description Guilherme Amadio gentoo-dev 2014-10-27 18:18:42 UTC
Bootstrap fails on OS X Yosemite due to python compilation errors. I tried setting USE=-aqua, but it still fails to compile, with a different error. Build logs below.

Reproducible: Always
Comment 1 Guilherme Amadio gentoo-dev 2014-10-27 18:20:28 UTC
Created attachment 387574 [details]
Build log with USE=aqua
Comment 2 Guilherme Amadio gentoo-dev 2014-10-27 18:20:50 UTC
Created attachment 387576 [details]
Build log with USE=-aqua
Comment 3 Guilherme Amadio gentoo-dev 2014-10-28 16:54:51 UTC
Created attachment 387664 [details]
python-2.7.5-r4 build log with USE=aqua

python-2.7.5-r4 seems to compile with USE=aqua, but there is a missing symlink during installation phase that causes failure. Uploading last 1000 lines due to 1M size limit.
Comment 4 Guilherme Amadio gentoo-dev 2014-10-30 00:28:33 UTC
Created attachment 387764 [details]
python-2.7.8.ebuild

I managed to compile python-2.7.8 with the attached ebuild. What did the trick was to set MACOSX_DEPLOYMENT_TARGET=10.4 (this is what's in the Makefile of a vanilla python tarball).

Below is what I changed from python-2.7.6-r1.ebuild

--- python-2.7.6-r1.ebuild	2014-10-14 05:13:58.000000000 -0300
+++ python-2.7.8.ebuild	2014-10-29 22:18:49.000000000 -0200
@@ -14,10 +14,7 @@
 
 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
 HOMEPAGE="http://www.python.org/"
-SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
-	mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.xz
-	http://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.xz
-	prefix? ( http://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}.tar.bz2 )"
+SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz"
 
 LICENSE="PSF-2"
 SLOT="2.7"
@@ -100,15 +97,6 @@
 	# this line:
 	#local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
 
-	EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
-	epatch "${FILESDIR}/python-2.7-issue18235.patch"
-	epatch "${FILESDIR}/python-2.7-issue17919.patch"
-
-	# Prefix' round of patches
-	# http://prefix.gentooexperimental.org:8000/python-patches-2_7
-	EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
-		epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}
-
 	if use aqua ; then
 		# make sure we don't get a framework reference here
 		sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
@@ -119,13 +107,11 @@
 			configure.ac configure || die
 		# we handle creation of symlinks in src_install
 		sed -i -e '/ln -fs .*PYTHONFRAMEWORK/d' Makefile.pre.in || die
+		sed -i -e '/MACOSX_DEPLOYMENT_TARGET/s/10.9/10.4/' Makefile.pre.in || die
 	fi
 	# don't try to do fancy things on Darwin
 	sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
 
-	# Fix for cross-compiling.
-	epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
-
 	epatch "${FILESDIR}"/python-2.7-aix-dlopen-soname.patch # libtool-built modules
 
 	# On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
@@ -147,9 +133,6 @@
 
 	epatch_user
 
-	# fix for CVE-2014-1912 (bug #500518)
-	epatch "${FILESDIR}"/${P}-recvfrom_into_buffer_overflow.patch
-
 	eautoconf
 	eautoheader
 }
Comment 5 Fabian Groffen gentoo-dev 2014-10-31 06:45:12 UTC
stripping all Prefix patches is not the solution, it will kill you further down the road.
Comment 6 Guilherme Amadio gentoo-dev 2014-10-31 11:59:35 UTC
Setting MACOSX_DEPLOYMENT_TARGET=10.4 in python-2.7.6-r1.ebuild also works. I used python-2.7.8 because I went to python.org and got the most recent tarball to try to compile by hand. The patch below should make it compile, at least with USE=-aqua.

--- python-2.7.6-r1.ebuild      2014-10-14 05:13:58.000000000 -0300
+++ python-2.7.6-r2.ebuild      2014-10-30 17:07:43.000000000 -0200
@@ -123,6 +123,9 @@
        # don't try to do fancy things on Darwin
        sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
 
+       # python fails on OS X with target 10.9 (bug #527116)
+       sed -i -e '/MACOSX_DEPLOYMENT_TARGET/s/10.9/10.4/' Makefile.pre.in || die
+
        # Fix for cross-compiling.
        epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
Comment 7 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-11-27 13:12:12 UTC
Fixed for now due to using clang for python.