compiliation errors - CentOS 6.8 linux - serial generic linux

bmirand's picture
Submitted by bmirand on Thu, 02/02/2017 - 11:20

Forums 

Installation

Hi,
I'm trying to compile Berkeley GW ( 1.0.6), on a CentOS linux ver. 6.8 system ( just the serial GNU linux version) w/ GNU gfortran 4.4.7.
I've tried "tweaking" the compiler options but keep getting undefined reference errors, no matter what I do.
I tried using the "-fno-leading-underscore", "-fno-trailing-underscore" and "-fno-second-underscore" but keep getting the following errors,

-------------------------------------------------------------------------------------------------------------
...
fortran -O3 -o epsilon.real.x ../Common/bessel.o ../Common/subgrp.o ../Common/check_inversion.o ../Common/svninfo.o ../Common/sort.o ../Common/scalapack.o ../Common/misc.o ../Common/gmap.o ../Common/inversion.o ../Common/write_program_header.o ../Common/write_matrix.o ../Common/read_matrix.o ../Common/fftw.o ../Common/fullbz.o ../Common/irrbz.o ../Common/fft_parallel.o ../Common/minibzaverage.o ../Common/vcoul_generator.o ../Common/trunc_cell_wire.o ../Common/trunc_cell_box.o ../Common/trunc_cell_box_d.o ../Common/trunc_scell_box_d.o ../Common/checkbz.o ../Common/eqpcor.o ../Common/createpools.o ../Common/random.o ../Common/input_utils.o ../Common/wfn_rho_vxc_io.o ../Common/blas.o ../Common/lapack.o ../Common/splines.o ../Common/global.o ../Common/typedefs.o ../Common/nrtype.o ../Common/push_pop.o ../Common/message.o ../Common/peinfo.o ../Common/timing.o ../Common/system.o rqstar.o input.o input_q.o inread.o genwf_disk.o genwf_mpi.o mtxel.o epsinv.o mtxelmultiply.o extrapolar.o epsilon_main.o -L/usr/lib64 -lfftw -L/usr/lib64/atlas -L/usr/lib64/atlas/liblapack.so.3 -L/usr/lib64/atlas/libblas.so.3
../Common/misc.o: In function `__misc_m_MOD_checknorm':
misc.p.f:(.text+0x248): undefined reference to `dnrm2_'
../Common/inversion.o: In function `__inversion_m_MOD_dinvert_serial':
inversion.p.f:(.text+0x2e2): undefined reference to `dgesv_'
../Common/inversion.o: In function `__inversion_m_MOD_zinvert_serial':
inversion.p.f:(.text+0xa25): undefined reference to `zgesv_'
../Common/fftw.o: In function `__fftw_m_MOD_destroy_fftw_plans':
fftw.p.f:(.text+0x569): undefined reference to `fftwnd_f77_destroy_plan__'
fftw.p.f:(.text+0x573): undefined reference to `fftwnd_f77_destroy_plan__'
../Common/fftw.o: In function `__fftw_m_MOD_do_fft':
fftw.p.f:(.text+0x840): undefined reference to `fftwnd_f77_one__'
fftw.p.f:(.text+0x918): undefined reference to `fftwnd_f77_one__'
fftw.p.f:(.text+0xa77): undefined reference to `fftwnd_f77_create_plan__'
fftw.p.f:(.text+0xa94): undefined reference to `fftwnd_f77_create_plan__'
../Common/fft_parallel.o: In function `__fft_parallel_m_MOD_fft_r2g_s':
fft_parallel.p.f:(.text+0xf6d): undefined reference to `fftwnd_f77_one__'
../Common/fft_parallel.o: In function `__fft_parallel_m_MOD_fft_r2g_p':
fft_parallel.p.f:(.text+0x13db): undefined reference to `fftwnd_f77_one__'
fft_parallel.p.f:(.text+0x18d0): undefined reference to `fftwnd_f77_one__'
../Common/fft_parallel.o: In function `__fft_parallel_m_MOD_fft_g2r_s':
fft_parallel.p.f:(.text+0x1da1): undefined reference to `fftwnd_f77_one__'
../Common/fft_parallel.o: In function `__fft_parallel_m_MOD_fft_g2r_p':
fft_parallel.p.f:(.text+0x21d8): undefined reference to `fftwnd_f77_one__'
../Common/fft_parallel.o:fft_parallel.p.f:(.text+0x2732): more undefined references to `fftwnd_f77_one__' follow
../Common/trunc_cell_wire.o: In function `trunc_cell_wire__':
trunc_cell_wire.p.f:(.text+0x64f): undefined reference to `fftwnd_f77_create_plan__'
trunc_cell_wire.p.f:(.text+0x77a): undefined reference to `fftwnd_f77_destroy_plan__'
trunc_cell_wire.p.f:(.text+0x15a2): undefined reference to `fftwnd_f77_one__'
../Common/trunc_cell_box.o: In function `trunc_cell_box__':
trunc_cell_box.p.f:(.text+0x6d2): undefined reference to `fftwnd_f77_create_plan__'
trunc_cell_box.p.f:(.text+0x1308): undefined reference to `fftwnd_f77_one__'
trunc_cell_box.p.f:(.text+0x177e): undefined reference to `fftwnd_f77_destroy_plan__'
../Common/trunc_cell_box_d.o: In function `trunc_cell_box_d__':
trunc_cell_box_d.p.f:(.text+0x8ff): undefined reference to `fftwnd_f77_create_plan__'
trunc_cell_box_d.p.f:(.text+0x921): undefined reference to `fftwnd_f77_create_plan__'
trunc_cell_box_d.p.f:(.text+0x15db): undefined reference to `fftwnd_f77_one__'
trunc_cell_box_d.p.f:(.text+0x1b45): undefined reference to `fftwnd_f77_one__'
trunc_cell_box_d.p.f:(.text+0x1c55): undefined reference to `fftwnd_f77_destroy_plan__'
trunc_cell_box_d.p.f:(.text+0x1c62): undefined reference to `fftwnd_f77_destroy_plan__'
../Common/trunc_scell_box_d.o: In function `trunc_scell_box_d__':
trunc_scell_box_d.p.f:(.text+0xd5d): undefined reference to `fftwnd_f77_destroy_plan__'
trunc_scell_box_d.p.f:(.text+0xd6a): undefined reference to `fftwnd_f77_destroy_plan__'
trunc_scell_box_d.p.f:(.text+0x12c6): undefined reference to `fftwnd_f77_create_plan__'
trunc_scell_box_d.p.f:(.text+0x12e8): undefined reference to `fftwnd_f77_create_plan__'
trunc_scell_box_d.p.f:(.text+0x1fb2): undefined reference to `fftwnd_f77_one__'
trunc_scell_box_d.p.f:(.text+0x250a): undefined reference to `fftwnd_f77_one__'
genwf_mpi.o: In function `genwf_mpi__':
genwf_mpi.p.f:(.text+0x1037): undefined reference to `dgemm_'
genwf_mpi.p.f:(.text+0x366c): undefined reference to `dgemm_'
mtxelmultiply.o: In function `__mtxelmultiply_m_MOD_mtxelmultiply':
mtxelmultiply.p.f:(.text+0xd78): undefined reference to `dgemm_'
epsilon_main.o: In function `MAIN__':
epsilon_main.p.f:(.text+0xc6dd): undefined reference to `dgemm_'
epsilon_main.p.f:(.text+0xd0c1): undefined reference to `zgemm_'
epsilon_main.p.f:(.text+0x143a8): undefined reference to `zgemm_'
collect2: ld returned 1 exit status
make[1]: *** [epsilon.real.x] Error 1
make[1]: Leaving directory `/blackelk1/software/BerkeleyGW-1.0.6/Epsilon'
make: *** [epsilon-all] Error 2
----------------------
here is the arch.mk file I'm using,
------------------------------------------------
# arch.mk for BerkeleyGW codes
#
# Suitable for Generic single processor linux
# Tested on netbook running Ubuntu 10.04. You will need to have yum
# or apt-get installed liblapack-dev, fftw-dev, gfortran, g++ packages
#
# J. Deslippe
# Jun, 2008, UCB

# Precompiler options
#
COMPFLAG = -DGNU
MATHFLAG =
DEBUGFLAG = -DDEBUG -DVERBOSE

FCPP = cpp -ansi
F90free = gfortran -ffree-form -ffree-line-length-none -ff2c -fno-leading-underscore -fsecond-underscore
F77 = /usr/bin/g77
LINK = gfortran
FOPTS = -O3
FNOOPTS = $(FOPTS)
MOD_OPT = -J
INCFLAG = -I

CC_COMP = g++
C_COMP = gcc
C_LINK = g++
C_OPTS = -O3

REMOVE = /bin/rm -f

# Math Libraries
#
###FFTWLIB = -L/usr/lib/ -lfftw
FFTWLIB = -L/usr/lib64 -lfftw
###FFTWINCLUDE = /usr/share/doc/fftw-dev/fortran
FFTWINCLUDE = -I/usr/include -I/usr/local/intel/compilers_and_libraries_2016.2.181/linux/mkl/include/fftw
###LAPACKLIB = -L/usr/lib/ -llapack -lblas
##LAPACKLIB = -L/usr/lib64 -L/usr/lib64/liblapack.so.3 -L/usr/lib64/libblas.so.3 ## -llapack -lblas
LAPACKLIB = -L/usr/lib64/atlas -L/usr/lib64/atlas/liblapack.so.3 -L/usr/lib64/atlas/libblas.so.3 ## -lla
pack -lblas
---------------------------------------------------------------------------------

Can someone assist here?

I am not using the latest version because the system does not have the latest fftw and various other needed libs, to compile it.

Thanks,
Brian Mirand
SUNY at Buffalo Eng

jdeslip's picture

Submitted by jdeslip on Thu, 02/02/2017 - 22:09

L/usr/lib64/atlas/liblapack.so.3 -L/usr/lib64/atlas/libblas.so.3

Is not correct syntax. -L is for defining lib directories. Try getting rid of the -L and just giving the full path to libblas.so and liblapack.so

About the missing FFTW dependencies, the syntax looks ok. Maybe your lib is fftw3 and not fftw2? Can you check your rpm to make sure? Though typically libfftw is version 2.

Jack

bmirand's picture

Submitted by bmirand on Fri, 02/03/2017 - 07:57

Thanks Jack, I knew that the -L entry was questionable - but was desperate in trying to get this thing compiled.
I removed the fftw version 3 libs, also, - but I am still getting "undefined reference" errors,- see this latest error listing:
-----------------------------------------------------------------------------------------------------------
gfortran -ffree-form -ffree-line-length-none -ff2c -fno-leading-underscore -fno-second-underscore -I ../Common -I -I/usr/include -I/usr/local/intel/compilers_and_libraries_2016.2.181/linux/mkl/include/fftw -c -O3 epsilon_main.p.f -o epsilon_main.o -J./
gfortran -O3 -o epsilon.real.x ../Common/bessel.o ../Common/subgrp.o ../Common/check_inversion.o ../Common/svninfo.o ../Common/sort.o ../Common/scalapack.o ../Common/misc.o ../Common/gmap.o ../Common/inversion.o ../Common/write_program_header.o ../Common/write_matrix.o ../Common/read_matrix.o ../Common/fftw.o ../Common/fullbz.o ../Common/irrbz.o ../Common/fft_parallel.o ../Common/minibzaverage.o ../Common/vcoul_generator.o ../Common/trunc_cell_wire.o ../Common/trunc_cell_box.o ../Common/trunc_cell_box_d.o ../Common/trunc_scell_box_d.o ../Common/checkbz.o ../Common/eqpcor.o ../Common/createpools.o ../Common/random.o ../Common/input_utils.o ../Common/wfn_rho_vxc_io.o ../Common/blas.o ../Common/lapack.o ../Common/splines.o ../Common/global.o ../Common/typedefs.o ../Common/nrtype.o ../Common/push_pop.o ../Common/message.o ../Common/peinfo.o ../Common/timing.o ../Common/system.o rqstar.o input.o input_q.o inread.o genwf_disk.o genwf_mpi.o mtxel.o epsinv.o mtxelmultiply.o extrapolar.o epsilon_main.o -L/usr/lib64 -lfftw -L/usr/lib64/atlas -L/usr/lib64/atlas -L/usr/lib64
../Common/misc.o: In function `__misc_m_MOD_checknorm':
misc.p.f:(.text+0x248): undefined reference to `dnrm2_'
../Common/inversion.o: In function `__inversion_m_MOD_dinvert_serial':
inversion.p.f:(.text+0x2e2): undefined reference to `dgesv_'
../Common/inversion.o: In function `__inversion_m_MOD_zinvert_serial':
inversion.p.f:(.text+0xa25): undefined reference to `zgesv_'
genwf_mpi.o: In function `genwf_mpi_':
genwf_mpi.p.f:(.text+0x1037): undefined reference to `dgemm_'
genwf_mpi.p.f:(.text+0x366c): undefined reference to `dgemm_'
mtxelmultiply.o: In function `__mtxelmultiply_m_MOD_mtxelmultiply':
mtxelmultiply.p.f:(.text+0xd78): undefined reference to `dgemm_'
epsilon_main.o: In function `MAIN__':
epsilon_main.p.f:(.text+0xc6dd): undefined reference to `dgemm_'
epsilon_main.p.f:(.text+0xd0c1): undefined reference to `zgemm_'
epsilon_main.p.f:(.text+0x143a8): undefined reference to `zgemm_'
collect2: ld returned 1 exit status
make[1]: *** [epsilon.real.x] Error 1
make[1]: Leaving directory `/blackelk1/software/BerkeleyGW-1.0.6/Epsilon'
make: *** [epsilon-all] Error 2
[root@blackelk BerkeleyGW-1.0.6]#
----------------------------------------------------------
Thanks for responding!

Regards,
Brian Mirand
SUNY at Buffalo NY

bmirand's picture

Submitted by bmirand on Fri, 02/03/2017 - 08:20

Thanks Jack!!
I think i've got it compiled and linked!

Here is the ( modified) arch.mk

-------------------------------------------------------------------------
[root@blackelk BerkeleyGW-1.0.6]# more arch.mk
# arch.mk for BerkeleyGW codes
#
# Suitable for Generic single processor linux
# Tested on netbook running Ubuntu 10.04. You will need to have yum
# or apt-get installed liblapack-dev, fftw-dev, gfortran, g++ packages
#
# J. Deslippe
# Jun, 2008, UCB

# Precompiler options
#
COMPFLAG = -DGNU
#
MATHFLAG =
DEBUGFLAG = -DDEBUG -DVERBOSE

FCPP = cpp -ansi
F90free = gfortran -ffree-form -ffree-line-length-none -ff2c -fno-leading-underscore -fno-second-underscore
#F77 = /usr/bin/g77
F77 = /usr/bin/gfortran
LINK = gfortran
FOPTS = -O3
FNOOPTS = $(FOPTS)
MOD_OPT = -J
INCFLAG = -I

CC_COMP = g++
C_COMP = gcc
C_LINK = g++
C_OPTS = -O3

REMOVE = /bin/rm -f

# Math Libraries
#
###FFTWLIB = -L/usr/lib/ -lfftw
FFTWLIB = -L/usr/lib64 -lfftw
###FFTWINCLUDE = /usr/share/doc/fftw-dev/fortran
FFTWINCLUDE = -I/usr/include -I/usr/local/intel/compilers_and_libraries_2016.2.181/linux/mkl/include/fftw
###LAPACKLIB = -L/usr/lib/ -llapack -lblas
##LAPACKLIB = -L/usr/lib64 -L/usr/lib64/liblapack.so.3 -L/usr/lib64/libblas.so.3 ## -llapack -lblas
LAPACKLIB = -L/usr/lib64/atlas -L/usr/lib64/atlas -L/usr/lib64 -llapack -lblas ###-L/usr/lib64/atlas/libf77blas.a -L/usr/lib64/atlas/l
ibblas.so.3 -L/usr/lib64/libgfortran.so.3 -lpthread -L/usr/lib64/libg2c.so ## -llapack -lblas
[root@blackelk BerkeleyGW-1.0.6]#
----------------------------------------------------------------------------------
I took out the direct reference to the "-L" statements and added -llapack -lblas to the line.

I found "blas" missing ( in the /usr/lib64/atlas ) directory - the directory only had a "libf77blas.so " lib in it - so I symlinked libblas.so to libf77blas.so - re-compiled the program - and lo and behold it finally compiled.

here is the Lib listing for my /usr/lib64/atlas directory.
I assume that "libf77blas.so" was the correct lib to symlink "libblas.so" to.
---------------------------------------
[root@blackelk BerkeleyGW-1.0.6]# ls -la /usr/lib64/atlas
total 31204
drwxr-xr-x. 2 root root 4096 Feb 3 11:08 .
dr-xr-xr-x. 176 root root 131072 Feb 3 10:50 ..
-rw-r--r-- 1 root root 9577662 Mar 20 2012 libatlas.a
lrwxrwxrwx 1 root root 17 Jan 23 16:33 libatlas.so -> ./libatlas.so.3.0
lrwxrwxrwx. 1 root root 17 Feb 15 2016 libatlas.so.3 -> ./libatlas.so.3.0
-rwxr-xr-x 1 root root 4572488 Mar 20 2012 libatlas.so.3.0
lrwxrwxrwx 1 root root 13 Feb 3 11:08 libblas.so -> libf77blas.so
-rw-r--r-- 1 root root 464560 Mar 20 2012 libcblas.a
lrwxrwxrwx 1 root root 17 Jan 23 16:33 libcblas.so -> ./libcblas.so.3.0
lrwxrwxrwx. 1 root root 17 Feb 15 2016 libcblas.so.3 -> ./libcblas.so.3.0
-rwxr-xr-x 1 root root 133280 Mar 20 2012 libcblas.so.3.0
lrwxrwxrwx 1 root root 19 Jan 23 16:33 libclapack.so -> ./libclapack.so.3.0
lrwxrwxrwx. 1 root root 19 Feb 15 2016 libclapack.so.3 -> ./libclapack.so.3.0
-rwxr-xr-x. 1 root root 97752 Mar 20 2012 libclapack.so.3.0
-rw-r--r-- 1 root root 562242 Mar 20 2012 libf77blas.a
lrwxrwxrwx 1 root root 19 Jan 23 16:33 libf77blas.so -> ./libf77blas.so.3.0
lrwxrwxrwx. 1 root root 19 Feb 15 2016 libf77blas.so.3 -> ./libf77blas.so.3.0
-rwxr-xr-x 1 root root 130336 Mar 20 2012 libf77blas.so.3.0
-rw-r--r-- 1 root root 9639522 Mar 20 2012 liblapack.a
lrwxrwxrwx 1 root root 18 Jan 23 16:34 liblapack.so -> ./liblapack.so.3.0
lrwxrwxrwx. 1 root root 18 Feb 15 2016 liblapack.so.3 -> ./liblapack.so.3.0
-rwxr-xr-x 1 root root 5324624 Mar 20 2012 liblapack.so.3.0
-rw-r--r-- 1 root root 465086 Mar 20 2012 libptcblas.a
lrwxrwxrwx 1 root root 19 Jan 23 16:34 libptcblas.so -> ./libptcblas.so.3.0
lrwxrwxrwx. 1 root root 19 Feb 15 2016 libptcblas.so.3 -> ./libptcblas.so.3.0
-rwxr-xr-x. 1 root root 130936 Mar 20 2012 libptcblas.so.3.0
-rw-r--r-- 1 root root 562642 Mar 20 2012 libptf77blas.a
lrwxrwxrwx 1 root root 21 Jan 23 16:34 libptf77blas.so -> ./libptf77blas.so.3.0
lrwxrwxrwx. 1 root root 21 Feb 15 2016 libptf77blas.so.3 -> ./libptf77blas.so.3.0
-rwxr-xr-x. 1 root root 127952 Mar 20 2012 libptf77blas.so.3.0
[root@blackelk BerkeleyGW-1.0.6]#
--------------------------------------------------------------------------------------------
Thanks for your help!

Regards,

Brian Mirand
SUNY at Buffalo, NY