Compilation on Mac OS X


Just Got Here
Hi,

I'm trying to complile nwchem on a Mac running OS X Sierra (10.12.2).I'm following method 2 (using homebrew) from the wiki. Running make results in the following error:

configure: error: in `/Users/dvr/Documents/nwchem-6.6/src/tools/build':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
make[1]: *** [build/config.status] Error 1
make: *** [libraries] Error 1

Logfile contents can be found here [1]. Could anyone show me how to fix this?

Thanks in advance,

Dries

Forum Vet
Conflicts coming from MacPorts
After looking at your config.log, I can see that 1) you have /opt/local/bin and /opt/local/sbin in your path and 2) that some stuff is picked up from the MacPorts /opt/local location (c++ (MacPorts gcc48 4.8.5_0) 4.8.5)
Please don't try to use Homebrew together with MacPorts.
Therefore, my suggestion is to
- open a shell with a PATH that does not contain the /opt/local/bin MacPorts location
- unset the following env. variables (if they are set at all)
MPI_LIB
MPI_INCLUDE
LIBMPI
CPP
CXX
CC

Just Got Here
Hi Edoapra,
Thanks, that fixed the compilation error. Unfortunately, I get a segfault when I try to run a sample SCF geometry optimization of the nitrogen molecule:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x1177566a9
#1  0x117755a75
#2  0x7fffcb182bb9
Segmentation fault: 11


I pasted the config.log [1], comex/config.log [2] and armci/config.log[3]. Please let me know if you need any further information.

Thanks for your time,

Dries

Forum Vet
Quote:Driesvr Jan 17th 1:49 am
Hi Edoapra,
Thanks, that fixed the compilation error. Unfortunately, I get a segfault when I try to run a sample SCF geometry optimization of the nitrogen molecule:


Thanks for your time,

Dries


Have you installed any of the patches listed at
http://nwchemgit.github.io/index.php/Download#Patches_for_the_27746_revision_of_NWChem_6.6
?


Your segfault failure could be fixed by the patch below
http://nwchemgit.github.io/download.php?f=Ga_argv.patch.gz

Here is how to apply it
cd $NWCHEM_TOP
wget http://nwchemgit.github.io/images/Ga_argv.patch.gz
gzip -d Ga_argv.patch.gz
patch -p0 < Ga_argv.patch
cd tools
make
cd ..
make link

Just Got Here
I've applied the Ga_argv patch and am still getting a similar segfault. I've also applied the Ga_defs, Gcc6_macs, and Gcc6_optfix patches.

I'm compiling with open-mpi from homebrew on sierra 10.12.6 following the directions on the compilation page. The GCC version is presently 7.1.0. config.log from the tools directory can be found here [1].

Thanks in advance for your help.

Matt Reuter

Forum Vet
Matt
I could not spot any obvious problem in your config.log
Could you please send the output of the command "make link"?

Just Got Here
Hi Edo,
Here it is.

/Library/Developer/CommandLineTools/usr/bin/make nwchem.o stubs.o
gfortran -cpp  -fdefault-integer-8 -Warray-bounds -g -fno-aggressive-loop-optimizations  -I.  -I/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/src/include -I/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DCOMPILATION_DATE="'`date +%a_%b_%d_%H:%M:%S_%Y`'" -DCOMPILATION_DIR="'/Users/mgreuter/Documents/Research/Codes/nwchem/6.6'" -DNWCHEM_BRANCH="'6.6'"  -c -o nwchem.o nwchem.F
gfortran -cpp  -fdefault-integer-8 -Warray-bounds -g -fno-aggressive-loop-optimizations  -I.  -I/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/src/include -I/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DCOMPILATION_DATE="'`date +%a_%b_%d_%H:%M:%S_%Y`'" -DCOMPILATION_DIR="'/Users/mgreuter/Documents/Research/Codes/nwchem/6.6'" -DNWCHEM_BRANCH="'6.6'"  -c -o stubs.o stubs.F
gfortran  -L/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/lib/MACX64 -L/Users/mgreuter/Documents/Research/Codes/nwchem/6.6/src/tools/install/lib  -o /Users/mgreuter/Documents/Research/Codes/nwchem/6.6/bin/MACX64/nwchem nwchem.o stubs.o -lnwctask -lccsd -lmcscf -lselci -lmp2 -lmoints -lstepper -ldriver -loptim -lnwdft -lgradients -lcphf -lesp -lddscf -lguess -lhessian -lvib -lnwcutil -lrimp2 -lproperty -lsolvation -lnwints -ldplot -lvscf -letrans -ltce -lbq -lcons -lnwcutil -lga -larmci -lpeigs -lperfm -lcons -lbq -lnwcutil -lnwclapack  -lnwcblas -lnwclapack  -lnwcblas   -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/2.1.1/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi      -lpthread   
nwchem is built


Thanks!
Matt

Forum Vet
Matt
I have tried to reproduce your environment on my Mac sierra 10.12.6, but, even though my link command seems to the same as yours, I am not seeing any segfault.
Did you recompile from scratch after applying the patch (e.g. make realclean)?
Could you send the output of the command
otool -L $NWCHEM_TOP/bin/MACX64/nwchem

Just Got Here
I hadn't done make realclean, but I had tried a fresh install by unpacking the source code in a new directory, applying the patches, and compiling. I just performed real makeclean and recompiled, and the problem appears to be solved. Very strange.

Thanks for your help.


Forum >> NWChem's corner >> Compiling NWChem