Skip to content

GCC on Lion and above

10 messages · Charlie Sharpsteen, huang min, Simon Urbanek +2 more

#
Hi All,

HPC seem to be maintaining the gcc toolchain up to date (they have GCC 4.7 compiled with autovectoring using OpenMP?)

http://hpc.sourceforge.net

BUT the page  http://r.research.att.com/tools/  says "do not use compilers from HPC, they won't work correctly!? Is that the case?

Also, I wondered if http://www.macports.org might be the way to go to get a version of gcc with a non-crashing OpenMP library?

best wishes and thanks for your help

tim

PS: The att.com page talks about install disks for OS X, but I think it?s all via the app store now, including X Code.
#
Tim,
On Apr 2, 2012, at 11:30 AM, Timothy Bates wrote:

            
Two reasons: a) they do not use Apple's drivers, so those are incompatible with most "regular" flags on Mac OS X (including most basic ones like -arch). b) last time I checked they were broken, i.e. the distribution did not even include libraries that the compiler linked against and it had OS version issues (i.e. it worked only on a very specific version which was not even what they were advertized for). I would hope that the latter point may have been rectified in the meantime, but I don't know. Gaurav never responded to my comments so I stopped worrying about that build. (There was a point c) where his compilers don't support ppc cross-compilation but that is less relevant now).

It is stil possible to build FSF gcc and Apple drivers - that's what we used a while ago when Apple's branch was broken. 

But note that even the most recent compilers are not much better, OMP performance is unusable for R's purpose so last time I checked there were no noticeable gains after all the work, but more recent reports are welcome.
MacPorts are quite notorious for the quality of the binaries and conflicts they cause, so I would be wary about that. If you compile everything from scratch (R and libraries), then the HPC compilers may work - you just have to stick to FSF flags.

I am still weighting the options - the most reasonable way at the moment is clang because it is supported by Apple and under active development (personally, I have switched to clang because it's much better for development), but there is no OpenMP yet for clang, although it is (allegedly) brewing. But as I said, at least for R itself, the threading performance problem is deeper, so just updating the compiler or OMP doesn't seem to help (I didn't try MPC, though).
Yes, it varies by Xcode version and your OS X version. App store is the last resort, I prefer ADC which has always worked and still works. I think the FAQ is up to date.

Cheers,
Simon
4 days later
#
On Monday, April 2, 2012 8:30:46 AM UTC-7, Timothy Bates wrote:
As far as I am aware, the problem with HPC binaries or MacPorts builds is 
that they cannot compile universal binaries. In order to do this, you need 
to build GFortran from Apple's patched sources for GCC 4.2.x or use Simon's 
binaries from r.research.att.com.

If you don't care about a multi-architecture version of R, then the HPC and 
MacPorts builds will probably work just fine---you may need to set R_ARCHS 
or build a single-architecture version yourself so that R does not try to 
build universal binaries when compiling packages from source.

-Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20120407/819f2424/attachment.html>
#
Charlie,
On Apr 7, 2012, at 12:34 PM, Charlie Sharpsteen wrote:

            
You seem to be implying that you would use CRAN binary and then another compiler - that's not what we talked about and it has even more issues, because you will have potential problem with run-time libraries, ABIs etc. They differ by compiler version and R can load only one, so typically it will load the older, system library which may cause problem in the code that is compiled with the other compiler. If you want to use a different compiler, you should really compile R from sources, otherwise there is no guarantee that anything will work. It may or may not and the issues may be subtle, so beware. The discussion about compilers was really implying that you compile everything (including R) from sources, because otherwise it makes no sense as you will still have the same issues with GOMP etc.

Cheers,
Simon
2 days later
#
Huang,

you're on the wrong mailing list, I'm not a julia developer nor do I endorse or support julia - please ask their mailing lists for support. 

Cheers,
Simon
On Apr 10, 2012, at 6:07 AM, huang min wrote:

            
#
On Apr 10, 2012, at 10:26 AM, huang min wrote:

            
Note that your issue is really with julia's missing runtime, that's not really about the compilers per se. 

So if your question is "can I have two different gfortran compilers installed" then the answer is yes, if you know what you're doing - you have to make sure they don't pick each other's runtimes at compile time.
But it is a julia issue, because AFAICS you're using binaries of julia that are incomplete. Just adding the missing libraries should solve that problem (regardless of compilers).

If you compile everything from source, you can use pretty much any compiler (with the appropriate flags) and there will be no run-time issues, but then you can't use binaries.

Cheers,
Simon
#
Just as a point of reference -- I use Simon's gfortran and used it to
build my own Julia and R installations with no problems.

Michael

On Tue, Apr 10, 2012 at 10:47 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
14 days later
#
Dear all (simon...)

I?ve installed what I think is the recommended gcc+fortran installer pkg for Lion:

http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg 

but get no fortran in my /usr/local/bin and compiling an R package that needs it (http://openmx.psyc.virginia.edu) fails... no fortran.

I _think_ i have followed the instructions on http://r.research.att.com/tools/#gcc42
        (it?s confusing that up-to-date OS instructions are buried down in the (long) list of possible packages to install: I would be happy to help reorg this...)


gcc is fine
which gcc
/usr/local/bin/gcc

but
 gfortran
-bash: gfortran: command not found


config info follows... sorry for the hassle
t

*** Config info ***

Xcode 4.4 with command line tools installed

echo $PATH

:/usr/local/bin:/usr/local/mysql/bin/:/Users/tim/bin:/Users/tim/Applications/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/local/mysql/bin:/Users/tim/bin:/Users/tim/bin/plink



FYI, here?s the make trail from attempting to make OpenMx


spearman:Users tim$ cd ~/bin/OpenMx/; svn update; cd trunk/; make clean; make install; cd ..; svn status
At revision 2028.
rm -rf build/*
rm -rf models/passing/temp-files/*
rm -rf models/failing/temp-files/*
rm -rf build/*
rm -rf models/passing/temp-files/*
rm -rf models/failing/temp-files/*
cp DESCRIPTION DESCRIPTION.bak
sed '/Version:/d' DESCRIPTION.bak > DESCRIPTION
echo "Version: "999.0.0"-"2028 >> DESCRIPTION	
cd build; R CMD build ..
* checking for file ?../DESCRIPTION? ... OK
* preparing ?OpenMx?:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ?OpenMx/docs/source/static/Rdoc?
Removed empty directory ?OpenMx/docs/source/static/demo?
Removed empty directory ?OpenMx/docs/source/static?
Removed empty directory ?OpenMx/docs/source/templates?
Removed empty directory ?OpenMx/inst/unit-tests?
Removed empty directory ?OpenMx/models/failing/temp-files?
Removed empty directory ?OpenMx/models/passing/temp-files?
Removed empty directory ?OpenMx/testsuite?
* looking to see if a ?data/datalist? file should be added
* re-saving tabular files
* building ?OpenMx_999.0.0-2028.tar.gz?

mv DESCRIPTION.bak DESCRIPTION
cd build; R CMD INSTALL "--configure-args=--enable-openmp" OpenMx_999.0.0-2028.tar.gz  
* installing to library ?/Users/tim/Library/R/2.15/library?
* installing *source* package ?OpenMx? ...
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to support OpenMP... -fopenmp
checking whether gcc is installed... yes
checking build system type... i386-apple-darwin12.0.0
checking host system type... i386-apple-darwin12.0.0
checking for inst/npsol/osx/libnpsol.a... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: executing src/omxSymbolTable.h commands
config.status: executing src/omxSymbolTable.c commands
** libs
*** arch - i386
gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG  -I/usr/local/include   -Wall -fopenmp -mmacosx-version-min=10.4  -fPIC  -g -O2  -c merge.c -o merge.o
gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG  -I/usr/local/include   -Wall -fopenmp -mmacosx-version-min=10.4  -fPIC  -g -O2  -c npsolWrap.c -o npsolWrap.o
npsolWrap.c: In function ?constraintFunction_?:
npsolWrap.c:798:19: warning: variable ?size? set but not used [-Wunused-but-set-variable]
gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG  -I/usr/local/include   -Wall -fopenmp -mmacosx-version-min=10.4  -fPIC  -g -O2  -c omxAlgebra.c -o omxAlgebra.o
gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG  -I/usr/local/include   -Wall -fopenmp -mmacosx-version-min=10.4  -fPIC  -g -O2  -c omxAlgebraFunctions.c -o omxAlgebraFunctions.o
gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -DNDEBUG  -I/usr/local/include   -Wall -fopenmp -mmacosx-version-min=10.4  -fPIC  -g -O2  -c omxAlgebraObjective.c -o omxAlgebraObjective.o
gfortran -arch i386   -fPIC  -g -O2  -c omxBLAS.f -o omxBLAS.o
make[1]: gfortran: No such file or directory
make[1]: *** [omxBLAS.o] Error 1
ERROR: compilation failed for package ?OpenMx?
* removing ?/Users/tim/Library/R/2.15/library/OpenMx?
* restoring previous ?/Users/tim/Library/R/2.15/library/OpenMx?
make: *** [install] Error 1
?       typescript
?       .profile
?       trunk/demo/UnivariateTwinAnalysis_MatrixRaw_plusCov.R
?       trunk/build/OpenMx_999.0.0-2028.tar.gz
?       branches/three-matrix/src/.BC.szkLWC
?       branches/experimental/src/.BC.zDfeyx
spearman:OpenMx tim$