Once I upgraded, I typed
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix
The latest versions of Xcode now alias the default C and C++ compilers as gcc and g++, respectively; thus, invoking g++, the default compiler for NucNet Tools, in fact invokes clang++. I tested that the NucNet Tools examples codes could run with clang++ by changing into nucnet-tools-code, updating, and then compiling the network example codes:
All of the codes compiled except run_multiple_zone_omp.cpp. This is because openMP is not yet supported in the Clang mainline. I will wait until that is done before I pursue openMP calculations with NucNet Tools compiled with the LLVM compilers.
I next compiled the codes with Sparskit2, which requires a fortran compiler. I typed
sudo port install gcc49
After installation, I typed
which showed that my Mac still had gcc set to clang. To set gcc to my recently installed gcc 4.9, I first checked that it was there by typing:
port select --list gcc
Available versions for gcc: mp-gcc49 none (active)
I then typed
sudo port select --set gcc mp-gcc49
to set gcc to gcc 4.9 and
to make sure my current shell knew about the change. When I typed
Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin14/4.9.2/lto-wrapper Target: x86_64-apple-darwin14 Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc49/gcc49/work/gcc-4.9.2/configure --prefix=/opt/local --build=x86_64-apple-darwin14 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc49 --includedir=/opt/local/include/gcc49 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.9 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.9 --with-gxx-include-dir=/opt/local/include/gcc49/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --disable-isl-version-check --with-cloog=/opt/local --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc49 4.9.2_1' Thread model: posix gcc version 4.9.2 (MacPorts gcc49 4.9.2_1)
indicating that indeed gcc was now set to gcc 4.9. I next typed
In this case, all the codes compiled because I was using the full gcc compiler suite (in my case, g++ and gfortran). I then tested compiling with clang++ and gfortran. I couldn't do this resetting gcc to clang by typing
sudo port select --set gcc none
because that would make gfortran invisible again. (If you try this and then type gfortran -v, it will return command not found. You'll then need to port select back to mp-gcc49.) Instead, what I did was to change the compiler in the examples/network/Makefile to clang++ by editing the file to read:
NNT_DIR = $(NUCNET_TARGET)/nnt USER_DIR = $(NUCNET_TARGET)/user BUILD_DIR = $(NUCNET_TARGET)/build GC = clang++ #/////////////////////////////////////////////////////////////////////////////// # End of lines to be edited. #///////////////////////////////////////////////////////////////////////////////
and the code built the C++ parts with clang++ and the fortran parts with gfortran. I note that the Makefile now explicitly links with libstdc++ when compiling with clang++ to get it to work with gfortran. run_multi_zone_omp.cpp did not compile again because the default clang++ compiler does not yet support openMP.
For the foreseeable future, I will continue to use the gnu compilers, so to restore the original Makefile and remake, I typed
svn revert Makefile
Nevertheless, I will try to keep abreast of developments with the LLVM compilers since some users may prefer them.