Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc-apple compilation fails on Mac OS 10.9
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
jcdx
n00b
n00b


Joined: 16 Dec 2013
Posts: 4

PostPosted: Tue Dec 17, 2013 11:37 pm    Post subject: gcc-apple compilation fails on Mac OS 10.9 Reply with quote

System: MacBook Pro, Intel Core i5, Mac OS 10.9, Xcode 5.0.2

Hi,

I would like to set up gentoo prefix on Mac OS 10.9. (used macports so far)
My aim is to use packages such as elmer fem, , freecad, gmsh and other scientific/engineering stuff from gentoo portage. I hope this is going to work ;-)

I followed these instructions: http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-solaris.xml

As requested I cleaned up my bash_profile completely. So no macports from "/opt/local/..." and manually installed gcc-4.9 from HPC (https://sites.google.com/site/dwhipp/tutorials/mac_compilers#mlion)
should interfere with the boostrapping process.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Until stage2 everything seems to work.

But stage3 failed when compiling gcc-apple.
$ ./bootstrap-prefix.sh $EPREFIX stage3

I also tried the procedure from: https://gist.github.com/ypresto/2145498
but it also failed when compiling gcc-apple.

$ CFLAGS="-march=native -pipe" emerge --oneshot --nodeps sys-devel/gcc-apple
I attached the output of the failed compilation, please tell me if you need further information.
There are also lots of warnings before.
Code:

...
5 warnings and 2 errors generated.
make[3]: *** [toplev.o] Error 1
make[3]: Leaving directory `/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
make: *** [bootstrap] Error 2
emake failed
 * ERROR: sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix failed (compile phase):
 *   emake failed
 *
 * Call stack:
 *     ebuild.sh, line  93:  Called src_compile
 *   environment, line 4736:  Called die
 * The specific snippet of code:
 *       emake bootstrap || die "emake failed"
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`.
 *
 * Please include /gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build/gcc-build-logs.tar.bz2 in your bug report
 *
 * The complete build log is located at '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'.
 * The ebuild environment file is located at '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/environment'.
 * Working directory: '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
 * S: '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-5666.3'

>>> Failed to emerge sys-devel/gcc-apple-4.2.1_p5666-r1, Log file:

>>>  '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'

 * Messages for package sys-devel/gcc-apple-4.2.1_p5666-r1:

 * ERROR: sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix failed (compile phase):
 *   emake failed
 *
 * Call stack:
 *     ebuild.sh, line  93:  Called src_compile
 *   environment, line 4736:  Called die
 * The specific snippet of code:
 *       emake bootstrap || die "emake failed"
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`.
 *
 * Please include /gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build/gcc-build-logs.tar.bz2 in your bug report
 *
 * The complete build log is located at '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'.
 * The ebuild environment file is located at '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/environment'.
 * Working directory: '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
 * S: '/gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-5666.3'


output from
emerge --info =sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix
Code:

$ emerge --info =sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix

Portage 2.2.7-prefix (prefix/darwin/macos/10.9/x64, gcc-4.2.1, unavailable, 13.0.0 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Darwin-13.0.0-x86_64-i386-64bit
Timestamp of tree: Sat, 09 Nov 2013 23:06:07 +0000
app-shells/bash:      4.0_p38
dev-util/pkgconfig:   0.28
sys-devel/autoconf:   2.69
sys-devel/automake:   1.12.4
sys-devel/gcc-config: 1.8-r00.1
sys-devel/libtool:    2.4.2
sys-devel/make:       3.82-r4
Repositories: gentoo_prefix
ACCEPT_KEYWORDS="~x64-macos"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-apple-darwin13"
CFLAGS="-march=nocona"
CHOST="x86_64-apple-darwin13"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/gentoo-release /etc/terminfo"
CPPFLAGS="-I/gentoo/usr/include -I/gentoo/tmp/usr/include"
CXXFLAGS=""
DISTDIR="/gentoo/usr/portage/distfiles"
FCFLAGS=""
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles force-prefix merge-sync nostrip parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-search_paths_first -L/gentoo/usr/lib -L/gentoo/lib -L/gentoo/tmp/usr/lib"
PKGDIR="/gentoo/usr/portage/packages"
PORTAGE_CONFIGROOT="/gentoo/"
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="/gentoo/var/tmp"
PORTDIR="/gentoo/usr/portage"
PORTDIR_OVERLAY=""
USE="aqua bootstrap coreaudio cracklib cxx internal-glib ipv6 modules ncurses objc objc++ prefix x64-macos zlib" 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="Darwin" 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 ubx" INPUT_DEVICES="keyboard mouse" KERNEL="Darwin" 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_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" 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:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON


outout from
emerge -pqv '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'
Code:

[ebuild  N    ] dev-libs/gmp-5.0.5  USE="cxx -doc -static-libs"
[ebuild  N    ] dev-libs/mpfr-3.1.2-r1  USE="-static-libs"
[ebuild  N    ] sys-devel/gcc-apple-4.2.1_p5666-r1  USE="cxx objc objc++ openmp -fortran -multislot -nls -nptl -regression-test -vanilla"


The build log "gcc-build-logs.tar.bz2" can be found here:
[url]
https://www.dropbox.com/s/8ty0snoe0zll1nf/gcc-build-logs.tar.bz2
[/url]

A more general question:
Do I have to use gcc-apple or could I also use gcc-4.7.2-r1 instead? gcc-apple = "gcc-4.2" seems a bit outdated.
After successfully building gentoo-prefix can I install another gcc version?
What is about llvm-gcc and clang?

I was excited when I found the gentoo prefix project but after several hours with no success on compiling gcc I am getting frustrated.
Please help.

Thank you very much!

JCD
Back to top
View user's profile Send private message
wsgilman
n00b
n00b


Joined: 18 Jul 2011
Posts: 4

PostPosted: Wed Dec 18, 2013 7:30 pm    Post subject: sys-devel/gcc-apple-4.2.1_p5666-r1 Error Reply with quote

I too am running into the same error.

Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-5666.3/gcc/toplev.h:180:1: note: previous definition is
here
exact_log2 (unsigned HOST_WIDE_INT x)
^
5 warnings and 2 errors generated.
make[3]: *** [toplev.o] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [bootstrap] Error 2
emake failed
* ERROR: sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix failed (compile phase):
* emake failed
*
* Call stack:
* ebuild.sh, line 93: Called src_compile
* environment, line 4740: Called die
* The specific snippet of code:
* emake bootstrap || die "emake failed"
*
* If you need support, post the output of `emerge --info '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`,
* the complete build log and the output of `emerge -pqv '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`.
*
* Please include /Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-build-logs.tar.bz2 in your bug report.
*
* The complete build log is located at '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'.
* The ebuild environment file is located at '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/environment'.
* Working directory: '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
* S: '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-5666.3'

>>> Failed to emerge sys-devel/gcc-apple-4.2.1_p5666-r1, Log file:

>>> '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'

* Messages for package sys-devel/gcc-apple-4.2.1_p5666-r1:

* ERROR: sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix failed (compile phase):
* emake failed
*
* Call stack:
* ebuild.sh, line 93: Called src_compile
* environment, line 4740: Called die
* The specific snippet of code:
* emake bootstrap || die "emake failed"
*
* If you need support, post the output of `emerge --info '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`,
* the complete build log and the output of `emerge -pqv '=sys-devel/gcc-apple-4.2.1_p5666-r1::gentoo_prefix'`.
*
* Please include /Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-build-logs.tar.bz2 in your bug report.
*
* The complete build log is located at '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/build.log'.
* The ebuild environment file is located at '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/temp/environment'.
* Working directory: '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/build'
* S: '/Users/Reciprocity/Gentoo/var/tmp/portage/sys-devel/gcc-apple-4.2.1_p5666-r1/work/gcc-5666.3'
Back to top
View user's profile Send private message
jcdx
n00b
n00b


Joined: 16 Dec 2013
Posts: 4

PostPosted: Mon Dec 23, 2013 11:18 pm    Post subject: Reply with quote

Hi again,

so far no success but I tested some things and may be somebody find this useful so solve gentoo prefix problems on Mac OS X 10.9.

I followed this script https://gist.github.com/ypresto/2145498
but I did some small modifications.

I did step by step manually in order to find out which critical error occurs first.
This is my script. I put a comment on each package I could successfully emerge. All others are marked with "fail".
Code:

#!/usr/bin/env bash

# Gentoo prefix installation on Mac OS X (Mar. 2012)
# This script may be outdated soon.
# Please refer: http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml

# Make gcc and gfortran from http://hpc.sourceforge.net/ the default C/C++ compilers
#export PATH=/usr/include:/usr/lib:/usr/local/bin:/usr/local/sbin:/usr/local/include:/usr/local/lib:/usr/local/share:$PATH
#hash -r

export EPREFIX="/gentoo"
export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$PATH"

export LATEST_TREE_YES=1

curl -o bootstrap-prefix.sh 'http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt'
chmod 755 bootstrap-prefix.sh
./bootstrap-prefix.sh $EPREFIX tree
./bootstrap-prefix.sh $EPREFIX/tmp make
./bootstrap-prefix.sh $EPREFIX/tmp wget
./bootstrap-prefix.sh $EPREFIX/tmp sed
./bootstrap-prefix.sh $EPREFIX/tmp python
./bootstrap-prefix.sh $EPREFIX/tmp coreutils
./bootstrap-prefix.sh $EPREFIX/tmp findutils
./bootstrap-prefix.sh $EPREFIX/tmp tar
./bootstrap-prefix.sh $EPREFIX/tmp patch
./bootstrap-prefix.sh $EPREFIX/tmp grep
./bootstrap-prefix.sh $EPREFIX/tmp gawk
./bootstrap-prefix.sh $EPREFIX/tmp bash
./bootstrap-prefix.sh $EPREFIX portage
hash -r

echo "BOOTSTRAPPING DONE"

rsync -avz rsync://rsync.jp.gentoo.org/gentoo-portage/sys-devel/binutils-apple/ $EPREFIX/usr/portage/sys-devel/binutils-apple && \
rsync -avz rsync://rsync.jp.gentoo.org/gentoo-portage/metadata/md5-cache/sys-devel/binutils-apple-4.3 $EPREFIX/usr/portage/sys-devel/binutils-apple-4.3 && \
echo "RSYNC DONE"
emerge --oneshot sed # works
#FEATURES="-collision-protect" emerge --oneshot --nodeps -e "<app-shells/bash-4.1" && \ # fails at this point
#emerge --oneshot --nodeps "<app-shells/bash-4.1" && \ # fails at this point
emerge --oneshot pax-utils && \  # works
emerge --oneshot --nodeps xz-utils && \ # works
emerge --oneshot --nodeps "<wget-1.13.4-r1" && \  # works
#emerge --oneshot --nodeps wget && \  # fails
emerge --oneshot --nodeps baselayout-prefix && \ # works but patching fails
emerge --oneshot --nodeps m4 && \ # works
emerge --oneshot --nodeps flex && \ # works
emerge --oneshot --nodeps bison && \ # works
emerge --oneshot --nodeps ncurses && \ # works
emerge --oneshot --nodeps sys-libs/readline && \ # works
emerge --oneshot --nodeps bash && \ # works at this point
emerge --oneshot --nodeps sys-devel/binutils-config && \ # works
#emerge --oneshot --nodeps sys-devel/native-cctools && \ # fails --> masked should not be used
#emerge --oneshot --nodeps ">sys-devel/binutils-apple-4.2.1" && \ # fails due to dependencies
##emerge --oneshot --nodeps sys-devel/binutils && \ # fails due to masking
#CFLAGS="-march=core2" emerge --oneshot --nodeps sys-devel/gcc-config && \ # works
#CFLAGS="-march=core2" emerge --oneshot --nodeps sys-devel/gcc-apple && \ # gcc-apple
emerge --oneshot --nodeps perl && \ # works
emerge --oneshot autoconf && \ # works
emerge --oneshot automake && \ # works
##emerge --oneshot --nodeps texinfo && \
##emerge --oneshot --nodeps "=automake-1.9*" "=automake-1.10*" && \
##emerge --oneshot --nodeps libtool && \
emerge --oneshot --nodeps sys-apps/coreutils && \ # works
emerge --oneshot --nodeps sys-apps/findutils && \ # work
emerge --oneshot --nodeps app-arch/tar && \ # works
emerge --oneshot grep && \ # works
emerge --oneshot sys-devel/patch && \ # works
emerge --oneshot sys-apps/gawk && \ # works
emerge --oneshot sys-devel/make && \ # works
emerge --oneshot --nodeps file && \ # works
emerge --oneshot --nodeps eselect && \ # works
emerge --oneshot "<dev-lang/python-3.0" && \ # python 2.7.5 works but python 3.3.3 fails
#emerge --oneshot llvm && \ # fails
#emerge --oneshot clang && \ # fails
##emerge --oneshot dragonegg && \ # not tried
#FEATURES="-collision-protect" emerge --oneshot sys-apps/portage && \ # not tried

#rm -Rf $EPREFIX/tmp/* && \ # not tried
#hash -r && \ # not tried
#emerge -e system # not tried
#emerge subversion # not tried
#emerge --sync && \ # not tried

#USE=-git emerge -u system && \ # not tried

echo << HERE
* *** IMPORTANT ***
*
* Now, please create your $EPREFIX/etc/make.conf
* After that, call `emerge -e system' to complete installation.
* Please refer: http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml
*
* For using prefix, startscript is recommended in document.
* $ cd $EPREFIX/usr/portage/scripts
* $ ./bootstrap-prefix.sh $EPREFIX startscript
* Then you can use `startscript' in $EPREFIX/startscript to get into prefix shell.
*
* *** END OF IMPORTANT ***
HERE


Here are the errors and logs from building binutils-apple and gcc-apple.
https://www.dropbox.com/s/qn4dveu5a9l5hxt/errors_and_logs.zip

I also tried to install and use llvm and clang but this fails due to dependencies on gcc-apple and binutils-apple.

Please let me know, if I can help with further information.

I would really like to have gentoo-prefix running.

Merry Christmas!
Back to top
View user's profile Send private message
Robert_09
n00b
n00b


Joined: 25 Dec 2013
Posts: 2

PostPosted: Wed Dec 25, 2013 9:48 am    Post subject: Reply with quote

nice post!
Back to top
View user's profile Send private message
jaysonsantos
n00b
n00b


Joined: 21 Dec 2013
Posts: 4

PostPosted: Wed Dec 25, 2013 11:12 pm    Post subject: Reply with quote

I tried to apply this patch to check if it would work, however it didn't. Appears that compiler is ignoring the #if.

--- a/gcc/toplev.h 2013-12-25 19:54:35.000000000 -0200
+++ b/gcc/toplev.h 2013-12-25 19:55:30.000000000 -0200
@@ -151,11 +151,13 @@
/* Return true iff flags are set as if -ffast-math. */
extern bool fast_math_flags_set_p (void);

+#if GCC_VERSION < 3004
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);

/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
+#endif /* GCC_VERSION < 3004 */

/* Inline versions of the above for speed. */
#if GCC_VERSION >= 3004
Back to top
View user's profile Send private message
jaysonsantos
n00b
n00b


Joined: 21 Dec 2013
Posts: 4

PostPosted: Sun Dec 29, 2013 2:43 am    Post subject: Reply with quote

Using gcc-apple-4.2.1_p5666-r2.ebuild and its patch found on bugtracker [1] i've managed to install gentoo prefix on macos 10.9.1
https://bugs.gentoo.org/show_bug.cgi?id=491098
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum