Currently dev-lang/python:2.7 can't cross-compile to Gentoo/FreeBSD Reproducible: Always Steps to Reproduce: 1. Run all steps from bug #543292 and apply temporary fix 2. cross-emerge dev-lang/python:2.7 Actual Results: Emerge fails on configure step Expected Results: Emerge should succeed
Created attachment 399936 [details, diff] python-2.7.9-freebsd-crosscompile.patch This patch fixed cross-compilation for me. IIRC, I had to use use-flag "-threads" too and modify ebuild to apply this patch: $ diff -u /usr/{portage,local/portage_crossdev}/dev-lang/python/python-2.7.9-r2.ebuild --- /usr/portage/dev-lang/python/python-2.7.9-r2.ebuild 2015-03-03 10:01:06.000000000 +0300 +++ /usr/local/portage_crossdev/dev-lang/python/python-2.7.9-r2.ebuild 2015-03-19 11:53:53.000000000 +0300 @@ -100,6 +100,7 @@ # Fix for cross-compiling. epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch" epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch" + epatch "${FILESDIR}/python-2.7.9-freebsd-crosscompile.patch" sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ Lib/distutils/command/install.py \
Please upload your emerge --info, build.log and log of failed configure.
I had to patch some of other ebuilds to get to dev-lang/python:2.7: sys-devel/gettext, sys-freebsd/freebsd-lib and sys-freebsd/freebsd-bin. Maybe it can be skipped safely for test of current bug. I've made a bug report for gettext ( bug #544736 ), for other packages I didn't do it yet, so I'll just post diffs here. DIFF BEGIN diff -u /usr/{portage,local/portage_crossdev}/sys-freebsd/freebsd-lib/freebsd-lib-9.2.ebuild --- /usr/portage/sys-freebsd/freebsd-lib/freebsd-lib-9.2.ebuild 2015-02-18 20:31:17.000000000 +0300 +++ /usr/local/portage_crossdev/sys-freebsd/freebsd-lib/freebsd-lib-9.2.ebuild 2015-03-18 19:18:15.000000000 +0300 @@ -78,6 +78,10 @@ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= " use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= " + if ! is_crosscompile && use build ; then + mymakeopts="${mymakeopts} WITHOUT_NIS= " + fi + mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL= WITHOUT_CLANG= WITHOUT_LIBCPLUSPLUS= " if [ "${CTARGET}" != "${CHOST}" ]; then @@ -120,6 +124,15 @@ libstand libgssapi" +# Add implicit paths for certain headers and libraries to fix build +# with 'build' flag on +BUILD_APPENDED_PATHS="lib/libmd + lib/libkvm + lib/libsbuf + lib/libproc + lib/libkiconv + lib/libmp" + # Are we building a cross-compiler? is_crosscompile() { [ "${CATEGORY#*cross-}" != "${CATEGORY}" ] @@ -166,33 +179,36 @@ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \ -i "${S}/csu/i386-elf/Makefile" \ -i "${S}/csu/ia64/Makefile" || die + + # Try to fix sed calls for GNU sed. Do it only with GNU userland and force + # BSD's sed on BSD. + # TODO: use PORTAGE_USERLAND here + if use userland_GNU || [ "$CHOST" != "$CBUILD" ] ; then + find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \; + fi + + if install --version 2> /dev/null | grep -q GNU; then + sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile" + fi + if use build; then cd "${WORKDIR}" # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it # shouldn't be a symlink to /usr/src/sys (which should be already patched) epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch - return 0 + if is_crosscompile ; then + return 0 + fi fi - if ! is_crosscompile ; then + if ! is_crosscompile && ! use build ; then ln -s "/usr/src/sys" "${WORKDIR}/sys" || die "Couldn't make sys symlink!" else sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \ "${S}/libc/rpc/Makefile.inc" \ "${S}/libc/yp/Makefile.inc" fi - - if install --version 2> /dev/null | grep -q GNU; then - sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile" - fi - - # Try to fix sed calls for GNU sed. Do it only with GNU userland and force - # BSD's sed on BSD. - cd "${S}" - if use userland_GNU; then - find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \; - fi } bootstrap_lib() { @@ -321,6 +337,13 @@ CFLAGS="${CFLAGS} -isystem /usr/include" fi + if ! is_crosscompile && use build ; then + local x= + for x in ${BUILD_APPENDED_PATHS} ; do + append-ldflags "-L${WORKDIR}/lib-${ABI}/${WORKDIR}/${x}" + done + fi + export RAW_LDFLAGS=$(raw-ldflags) # Everything is now setup, build it! @@ -359,11 +382,21 @@ if is_crosscompile ; then export YACC='yacc -by' CHOST=${CTARGET} tc-export CC LD CXX RANLIB - mymakeopts="${mymakeopts} NLS=" CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include" append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc" fi + if is_crosscompile || use build ; then + mymakeopts="${mymakeopts} NLS=" + fi + + if ! is_crosscompile && use build ; then + local x= + for x in ${BUILD_APPENDED_PATHS} ; do + CFLAGS="${CFLAGS} -isystem ${WORKDIR}/${x}" + done + fi + if is_crosscompile ; then do_compile else DIFF END DIFF BEGIN diff -u /usr/{portage,local/portage_crossdev}/sys-freebsd/freebsd-bin/freebsd-bin-9.2.ebuild --- /usr/portage/sys-freebsd/freebsd-bin/freebsd-bin-9.2.ebuild 2013-11-09 13:16:03.000000000 +0400 +++ /usr/local/portage_crossdev/sys-freebsd/freebsd-bin/freebsd-bin-9.2.ebuild 2015-03-18 13:28:05.000000000 +0300 @@ -2,12 +2,14 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-bin/freebsd-bin-9.2.ebuild,v 1.1 2013/11/09 09:16:03 aballier Exp $ +EAPI=2 + inherit bsdmk freebsd DESCRIPTION="FreeBSD /bin tools" SLOT="0" -IUSE="" +IUSE="build" if [[ ${PV} != *9999* ]]; then KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd" @@ -35,3 +37,11 @@ pkg_setup() { mymakeopts="${mymakeopts} WITHOUT_TCSH= WITHOUT_SENDMAIL= WITHOUT_RCMDS= " } + +src_prepare() { + if use build ; then + # Don't build sh as it requires some build-time tools + # which can't run in cross-compilation environment + sed -i '/[[:blank:]]sh[[:blank:]]/d' "${WORKDIR}"/bin/Makefile + fi +} DIFF END Also I had to do a hack to choose correct make cat >/usr/i686-gentoo-freebsd9.2/etc/portage/bashrc << END #!/bin/bash case $(uname -s) in *BSD|DragonFly) export USERLAND="BSD" ;; *) export USERLAND="GNU" ;; esac END Also I added sys-apps/ed to package.provided: echo 'sys-apps/ed-1.10' >> /usr/i686-gentoo-freebsd9.2/etc/portage/profile/package.provided After that I used following command: BMAKE="pmake -m /usr/share/mk/freebsd" PYTHON_TARGETS="python2_7" USE="build -nls -ssl" emerge-i686-gentoo-freebsd9.2 -1av dev-lang/python:2.7::gentoo HOST EMERGE INFO $ emerge --info Portage 2.2.14 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.20-r2, 3.14.36-gentoo.45 x86_64) ================================================================= System uname: Linux-3.14.36-gentoo.45-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.2 KiB Mem: 4050856 total, 1352460 free KiB Swap: 4192252 total, 4184364 free Timestamp of tree: Mon, 30 Mar 2015 00:45:01 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 app-shells/bash: 4.2_p53 dev-lang/perl: 5.20.1-r4 dev-lang/python: 2.7.9-r1, 3.4.1 dev-util/cmake: 2.8.12.2-r1 dev-util/pkgconfig: 0.28-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.13.11 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6-r1, 1.13.4 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.3 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.6 sys-devel/make: 4.1-r1 sys-kernel/linux-headers: 3.18 (virtual/os-headers) sys-libs/glibc: 2.20-r2 Repositories: gentoo sunrise rion local-overlay crossdev Installed sets: @fortune, @kde, @lxqt, @pidgin, @psi ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo" CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y --binpkg-respect-use=y --autounmask=n --complete-graph=y --keep-going" FCFLAGS="-O2 -pipe" FEATURES="binpkg-logs distlocks ebuild-locks fakeroot fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/ http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.bloodhost.ru/ http://mirror.mdfnet.se/gentoo ftp://mirror.mdfnet.se/gentoo http://gentoo.inode.at/ http://ftp.df.lth.se/pub/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp.halifax.rwth-aachen.de/gentoo/" INSTALL_MASK=" /etc/systemd /lib*/systemd /lib*/tmpfiles.d /usr/lib*/systemd /usr/lib*/tmpfiles.d /usr/lib*/python*/test " LANG="ru_RU.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/sunrise /var/lib/layman/rion /usr/local/portage /usr/local/portage_crossdev" SYNC="" USE="X a52 aac acl acpi alsa amd64 amr apm ares bash-completion bidi bluetooth branding bzip2 c++0x cairo caps cdda cdio cdr cleartype cli consolekit cracklib crypt cue cups custom-cflags custom-optimization cxx dbus dga dirac dri dts dvd dvdr emboss encode exif faad fam fbcon ffmpeg firefox flac fontconfig fontforge freetype fribidi gcrypt gif glamor gme gmp gnutls gpm gtk iconv icu idn imlib inotify ipv6 jadetex jpeg kde lcms libass libdvdcss lzma lzo mad matroska midi mmap mmx mmxext mng modules mp3 mp4 mpeg mpi multilib ncurses network nfs nls nptl offensive ogg openal opengl openmp pango pch pcmcia pcntl pcre pdf pic plasma pm-utils png policykit posix postproc ppds private-headers projectm qt3support qt4 raw readline schroedinger session sftp sndfile sockets spell sse sse2 ssl startup-notification svg system-cairo system-icu system-jpeg system-libvpx system-sqlite tcpd tga theora threads tiff truetype udev udisks unicode upower usb utils v4l vaapi vdpau vorbis vpx wavpack wicd wifi wma wxwidgets x264 xattr xcb xcomposite xft xinerama xpm xscreensaver xv xvid zlib" ABI_X86="64 32" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en ru_RU en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby20" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="vesa vga nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.7 3.4" Unset: CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS CROSSDEV TARGET EMERGE INFO: $ emerge-i686-gentoo-freebsd9.2 --info Portage 2.2.14 (python 2.7.9-final-0, default/bsd/fbsd/x86/9.2, gcc-4.8.3, unavailable, 3.14.36-gentoo.45 x86_64) ================================================================= System uname: Linux-3.14.36-gentoo.45-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.2 KiB Mem: 4050856 total, 1390272 free KiB Swap: 4192252 total, 4184364 free Timestamp of tree: Mon, 30 Mar 2015 00:45:01 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 sys-freebsd/freebsd-lib: 9.2::crossdev Repositories: gentoo local-overlay crossdev ACCEPT_KEYWORDS="x86-fbsd ~x86-fbsd" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -fomit-frame-pointer" CHOST="i686-gentoo-freebsd9.2" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo" CXXFLAGS="-O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FCFLAGS="-march=i486 -O2 -pipe" FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr" FFLAGS="-march=i486 -O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="/usr/lib/systemd" LANG="ru_RU.utf8" LDFLAGS="" PKGDIR="/usr/i686-gentoo-freebsd9.2/packages/" PORTAGE_CONFIGROOT="/usr/i686-gentoo-freebsd9.2/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/usr/i686-gentoo-freebsd9.2/tmp/" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage_crossdev" USE="acl berkdb cracklib crypt cxx dri gdbm iconv ipv6 java5 java6 libav modules ncurses nls oss pcre python2 readline ssl tcpd unicode x86-fbsd zlib" ABI_X86="32" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="FreeBSD" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="BSD" VIDEO_CARDS="apm ark chips cirrus cyrix dummy i128 intel mach64 mga nv r128 radeon rendition s3 s3virge savage siliconmotion sis tga trident tseng vmware fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Created attachment 400142 [details] build.log It's not big, it fails on configure step. checking build system type... x86_64-pc-linux-gnu checking host system type... i686-gentoo-freebsd9.2 checking for python interpreter for cross build... python2.7 checking for --enable-universalsdk... no checking for --with-universal-archs... 32-bit checking MACHDEP... configure: error: cross build not supported for i686-gentoo-freebsd9.2 !!! Please attach the following file when seeking support: !!! /usr/i686-gentoo-freebsd9.2/tmp/portage/dev-lang/python-2.7.9-r2/work/i686-gentoo-freebsd9.2/config.log * ERROR: dev-lang/python-2.7.9-r2::gentoo failed (configure phase): * econf failed * * Call stack: * ebuild.sh, line 93: Called src_configure * environment, line 4074: Called econf '--with-fpectl' '--enable-shared' '--enable-ipv6' '--with-threads' '--enable-unicode=ucs4' '--infodir=${prefix}/share/info' '--mandir=${prefix}/share/man' '--with-dbmliborder=gdbm' '--with-libc=' '--enable-loadable-sqlite-extensions' '--with-system-expat' '--with-system-ffi' '--without-ensurepip' * phase-helpers.sh, line 584: Called die * The specific snippet of code: * die "econf failed"
Created attachment 400144 [details] config.log