1

I'm trying to compile gcc 4.x on osx 10.11 (mainly focusing around 4.9.2 and 4.9.3). No matter what I do, I can't get it to build properly, it always errors out somewhere. Using 5.x is not an option, and neither is using gcc from brew or macports.

I've got Xcode 7.2 and Command Line Tools installed (and updated). The following has worked fine for me on previous versions of osx (such as 10.9, but not sure about 10.10). Here's what I'm using to build it:

cd gcc-4.9.2 ./contrib/download_prerequisites cd .. mkdir objdir cd objdir $PWD/../gcc-4.9.2/configure --prefix=/usr/local/gcc-4.9.2 make make install 

Here's how this errors out (with a lot more ptrdiff_t errors as well):

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1854:29: error: use of undeclared identifier 'ptrdiff_t' const ptrdiff_t __m = (~ptrdiff_t(0) ^ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[3]: *** [graphite.o] Error 1 make[3]: *** Waiting for unfinished jobs.... 20 errors generated. make[3]: *** [graphite-blocking.o] Error 1 20 errors generated. 20 errors generated. make[3]: *** [graphite-clast-to-gimple.o] Error 1 make[3]: *** [graphite-dependences.o] Error 1 20 errors generated. make[3]: *** [graphite-interchange.o] Error 1 13 warnings generated. /bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-attrtab.c insn-attrtab.c /bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-dfatab.c insn-dfatab.c /bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-latencytab.c insn-latencytab.c make[2]: *** [all-stage1-gcc] Error 2 make[1]: *** [stage1-bubble] Error 2 make: *** [all] Error 2 

So, I guess the question here is if anyone knows any tricks to getting gcc 4.x to build on 10.11. Or if not, any advice for figuring out what's going on here. I've tried searching for days and haven't come up with much of anything. Not really sure how to approach this. I can definitely post more relevant info if needed (just not sure what's relevant).

1 Answer 1

1
tar xf gcc-4.9.3.tar.bz2 cd gcc-4.9.3 #fix - os x got now wget sed -i.bak 's/wget/curl -O/g' contrib/download_prerequisites ./contrib/download_prerequisites # this fixes your problem !!!! sed -i.bak '/__need_size_t/d' gmp/gmp-h.in mkdir build cd build #for example ../configure --target=x86_64-apple-darwin15.5.0 --build=x86_64-apple- darwin15.5.0 \ --prefix=/usr/local --program-suffix=-4.9 \ --enable-languages=c,c++ --with-system-zlib --enable-libstdcxx-time=yes \ --enable-stage1-checking --enable-checking=release --enable-lto \ --disable-multilib --disable-nls 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.