Undefined references for nwchem6.6 on ubuntu 16.04


Click here for full thread
Just Got Here
Hello,

I have been trying to compile nwchem6.6 on ubuntu 16.04 but I receive a long list of linker errors about undefined references.

aoccsd2.F:(.text+0x2c03): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_getdjka_.constprop.0':
ccsd_trpdrv.F:(.text+0x1ec): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_doooo_':
ccsd_trpdrv.F:(.text+0x31b): undefined reference to `dgemm_'
ccsd_trpdrv.F:(.text+0x367): undefined reference to `dgemm_'
ccsd_trpdrv.F:(.text+0x3b7): undefined reference to `dgemm_'
ccsd_trpdrv.F:(.text+0x406): undefined reference to `dgemm_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_dovvv_':
ccsd_trpdrv.F:(.text+0x502): undefined reference to `dgemm_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o):ccsd_trpdrv.F:(.text+0x539): more undefined references to `dgemm_' follow
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_getdjka_':
ccsd_trpdrv.F:(.text+0x811): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_cpyloop_':
ccsd_trpdrv.F:(.text+0x9ac): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o): In function `ccsd_trpdrv_':
ccsd_trpdrv.F:(.text+0x1581): undefined reference to `dcopy_'
ccsd_trpdrv.F:(.text+0x15a2): undefined reference to `dcopy_'
ccsd_trpdrv.F:(.text+0x15c3): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv.o):ccsd_trpdrv.F:(.text+0x15e4): more undefined references to `dcopy_' follow
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv_omp.o): In function `ccsd_trpdrv_omp_':
ccsd_trpdrv_omp.F:(.text+0xf0e): undefined reference to `dgemm_'
ccsd_trpdrv_omp.F:(.text+0xf66): undefined reference to `dgemm_'
ccsd_trpdrv_omp.F:(.text+0xfb8): undefined reference to `dgemm_'
ccsd_trpdrv_omp.F:(.text+0x1006): undefined reference to `dgemm_'
ccsd_trpdrv_omp.F:(.text+0x1059): undefined reference to `dgemm_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(ccsd_trpdrv_omp.o):ccsd_trpdrv_omp.F:(.text+0x10aa): more undefined references to `dgemm_' follow
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(moints_trp.o): In function `mo_trp_jtrf34_':
moints_trp.F:(.text+0x504): undefined reference to `dcopy_'
/home/julian/uni/programs/nwchem-6.6/lib/LINUX64/libccsd.a(moints_trp.o): In function `mo_trp_jtrf34a_':
moints_trp.F:(.text+0x6f7): undefined reference to `dgemm_'
moints_trp.F:(.text+0x750): undefined reference to `dgemm_'
moints_trp.F:(.text+0x77c): undefined reference to `dcopy_'


and many more.

My environments are set as

export NWCHEM_TOP=/home/julian/uni/programs/nwchem-6.6
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES="all python"
export NWCHEM_MPIF_WRAP="/usr/bin/mpif90"
export NWCHEM_MPIC_WRAP="/usr/bin/mpicc"
export NWCHEM_MPICXX_WRAP="/usr/bin/mpicxx"
export NWCHEM_LONG_PATHS=Y
export USE_NOFSCHECK=Y
export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export MPI_INCLUDE="-I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib"
export MPI_LIB="-L/usr/lib/openmpi/lib"
export LIBMPI="-lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi"
export FC=gfortran
export CC=gcc
export CXX=g++
export ARMCI_NETWORK=
export MSG_COMMS=MPI
export BLAS_SIZE=4
export BLAS_LIB="-L/usr/lib/openmpi/lib -lblas"
export LAPACK_SIZE=4
export LAPACK_LIB="-L/usr/lib/openmpi/lib -llapack"
export PYTHON_EXE=/usr/bin/python
export PYTHONVERSION=2.7
export USE_PYTHON64=
export PYTHONCONFIGDIR=config-x86_64-linux-gnu
export PYTHONPATH=
export PYTHONHOME=/usr
export PYTHONLIBTYPE=a
export USE_INTERNALBLAS=y


I have also tried to set USE_64TO32=y according to this thread but with no success.

Any help would be highly appreciated.