Help installing siesta, error on make

Asked by Oscar Xavier on 2020-02-13

I am trying to install siesta on Ubuntu 18.04.4 LTS inside windows (Linux sub-system for windows). I have processor AMD FX(tm).
This is what I did:

1. I downloaded siesta4,1-b4.

2. I ran "sh Src/".

3. Then, "cp Obj/DOCUMENTED-TEMPLATE.make arch.make"

4. I modified arch.make to change the relevant options for mpi (as described by the pdf):
CC = mpicc
FC = mpifort # or mpif90
MPI_INTERFACE = libmpi_f90.a

5. I installed some required libraries (mpi, openblas, etc).

5. I ran make and got errors saying I was missing some libraries so I installed them.

6. I then got this error:
               libSiestaXC.a libmpi_f90.a -llapack
/usr/bin/ld: diag.o: undefined reference to symbol 'dtrsm_'
//usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:493: recipe for target 'siesta' failed
make: *** [siesta] Error 1

Please correct me if I did something wrong and tell me if I need to provide more details.

Question information

English Edit question
Siesta Edit question
No assignee Edit question
Solved by:
Oscar Xavier
Last query:
Last reply:
Revision history for this message
Ilya (ilya963) said :

I'm not sure but perhaps you need to specify the path to the libraries. In my case, it looked like this:
BLACS_LIBS=/usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/ /usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/
SCALAPACK_LIBS=/usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/ /usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/

And also verify that these variables are indicated in LIBS

Revision history for this message
Oscar Xavier (oscarxavier-ox) said :

Thank you for your reply. I tried to specify the path to the libraries but I couldn't locate blacs or scalapack so I installed them. After adding them to the arch.make I got another symbol error.

I wrote this on the arch.make:
BLAS_LIBS = /usr/lib/x86_64-linux-gnu/openblas/
 LAPACK_LIBS = /usr/lib/x86_64-linux-gnu/openblas/
 BLACS_LIBS = /usr/lib/x86_64-linux-gnu/
 SCALAPACK_LIBS = /usr/lib/x86_64-linux-gnu/

This is the new error I got:
/usr/bin/ld: m_trimat_invert.o: undefined reference to symbol 'zgesv_'
//usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:493: recipe for target 'siesta' failed
make: *** [siesta] Error 1

Revision history for this message
Ilya (ilya963) said :

SIESTA 4.0 contains a script for automatic arch.make generation. This script is called configure and is located in the Src folder. The option --enable-mpi allows you to generate the arch.make for parallel SIESTA (sh path/to/Src/configure --enable-mpi). Perhaps the generated arch.make file will be useful to you.

Revision history for this message
Oscar Xavier (oscarxavier-ox) said :

I would like to try the automatic arch.make generation.
However, my siesta files do not have such a script.

from the siesta directory I ran:
        find . -name "*conf*"
        find . -type f -print | xargs grep -e "--enable-mpi"
both returned nothing. I have no files containing conf in their name nor having --enable-mpi in their text.

Could you point me to the correct filename or where I can download this script?

Revision history for this message
Ilya (ilya963) said :

I did not find this file in SIESTA 4.1, but it is present in SIESTA 4.0 (SIESTA 4.0 can be downloaded here: The arch.make files for SIESTA 4.0 and SIESTA 4.1 have slight differences, but most of the options are the same. The script for automatic generation is called "configure" and is present in siesta-4.0.2/Src folder. The script can be run with the command

sh path/to/siesta-4.0.2/Src/configure

As a result, an arch.make file will be generated to compile a serial SIESTA 4.0. You must specify an additional option "--enable-mpi" to generate an arch.make file for a parallel SIESTA:

 sh path/to/siesta-4.0.2/Src/configure --enable-mpi

You can learn more about additional script features using the -h option:

 sh path/to/siesta-4.0.2/Src/configure -h

It is possible that the script will not be able to detect some necessary libraries or compilers.

Revision history for this message
Oscar Xavier (oscarxavier-ox) said :

I ran the congifure --enable-mpi and as you said, some were not recognized

Here I paste the part where it says no:

checking for netcdf... no
checking is BLAS linked by default... no
checking for BLAS in -lblasmt... no
checking for BLAS in ATLAS... no
checking for sgemm in -lblas... yes
checking for dgemm in -ldgemm... no
checking for sgemm in -lcxml... no
checking for sgemm in -ldxml... no
checking for sgemm in -lscs... no
checking for sgemm in -lcomplib.sgimath... no
checking for sgemm in -lblas... (cached) yes
checking for sgemm in -lessl... no
checking for sgemm in -lblas... (cached) yes
checking LAPACK already linked... no
checking for LAPACK in -llapackmt... no
checking for LAPACK in -llapack... yes
checking LAPACK includes divide-and-conquer routines... yes
configure: using DC_LAPACK routines packaged with SIESTA due to bug in library. Linker flag might be needed to avoid duplicate symbols
checking if we can compile a BLACS program... no
checking for BLACS in -lblacs... no
checking for BLACS in -lblacsF77init -lblacs -lblacsF77init... no
checking for BLACS in -ls3l... no
configure: Don't know how to compile with BLACS - edit arch.make by hand
checking if we can compile a ScaLAPACK program... no
configure: Don't know how to compile with ScaLAPACK - edit arch.make by hand

The resulting arch.make had the blacs or scalapak options blank, so I filled them with the one I mentioned previously.

BLAS_LIBS = /usr/lib/x86_64-linux-gnu/openblas/
LAPACK_LIBS = /usr/lib/x86_64-linux-gnu/openblas/
BLACS_LIBS = /usr/lib/x86_64-linux-gnu/
SCALAPACK_LIBS = /usr/lib/x86_64-linux-gnu/

I got the same error:

               libSiestaXC.a libmpi_f90.a /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/openblas/ /usr/lib/x86_64-linux-gnu/openblas/
/usr/bin/ld: m_trimat_invert.o: undefined reference to symbol 'zgesv_'
//usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:493: recipe for target 'siesta' failed
make: *** [siesta] Error 1

Revision history for this message
Ilya (ilya963) said :

There may be several files in the BLACS and SCALAPACK libraries. In the case of the scalapack library on my computer, this is and I specified both files on the same line of arch.make: SCALAPACK_LIBS=/usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/ /usr/lib/hpc/gnu7/mpich/scalapack/2.0.2/lib64/

Probably, automatic generation with configure script fails because it is not possible to determine the location of the BLACS and SCALAPACK libraries. A description of how to make libraries visible to the system is described in these forums:

Revision history for this message
Oscar Xavier (oscarxavier-ox) said :

Thank you for that information. I was indeed missing some paths to the libraries. However, I still got the same error after adding the missing ones. This is what I added:

BLAS_LIBS = /usr/lib/x86_64-linux-gnu/openblas/ /usr/lib/x86_64-linux-gnu/openblas/ /usr/lib/ x86_64-linux-gnu/openblas/
 LAPACK_LIBS = /usr/lib/x86_64-linux-gnu/openblas/ /usr/lib/x86_64-linux-gnu/openblas/
 BLACS_LIBS = /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ /usr/lib/ x86_64-linux-gnu/
 SCALAPACK_LIBS = /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/ / usr/lib/x86_64-linux-gnu/

I also tried the suggestions in the stackexchange answers in the link you provided and still got the same error.

When I do `ldconfig -p` I get:

    ldconfig -p | grep openblas (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/
    ldconfig -p | grep lapack (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/openblas/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/
    ldconfig -p | grep blacs (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/ (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/

I notice I have several possibilities of libraries to choose, is it possible that some of those libraries don't work together well and I have to use a specific group of them?

Revision history for this message
Nick Papior (nickpapior) said :

Let me correct a few things you are doing:

1) When using shared libraries *.so typically is a link to *.so.<integer>. You can check this by doing
$> ls -l /usr/lib/x86_64-linux-gnu/
which will most likely show:
/usr/lib/x86_64-linux-gnu/ -> /usr/lib/x86_64-linux-gnu/

Hence, only link ONE of the libraries, and preferably do:

-L/usr/lib/x86_64-linux-gnu -lblacs-openmpi

Nothing more!

2) You seem to use wrong libraries, you have to link lapack and blas (you added BLAS two times). Please carefully go through your arch.make.

3) ScaLAPACK requires that you do not mix different MPI implementations. You have:
-lblacs-openmpi AND -lscalapack-mpich
OpenMPI and MPICH are not compatible. So please only use one of them! The library you use NEEDS to correspond to your mpif90 and mpicc command (i.e. if mpif90 is MPICH, then use MPICH libraries)

Lastly, you have never shown your complete arch.make which would probably help. However, you most severe mistake seems to be the above 2 things.

Revision history for this message
Oscar Xavier (oscarxavier-ox) said :

Thank you very much for your reply. This is the kind of information I needed. I modified the file based on what you told me and I no longer get the error in the libraries. Now I don't understand the output and don't know what I have to do next. Could you help me with this?

Here I paste the library paths:

/usr/lib/x86_64-linux-gnu/openblas/ ->
/usr/lib/x86_64-linux-gnu/openblas/ ->
/usr/lib/x86_64-linux-gnu/ ->
/usr/lib/x86_64-linux-gnu/ ->

Here's the arch.make file:

.SUFFIXES: .f .F .o .c .a .f90 .F90
SIESTA_ARCH = unknown
CC = mpicc
FPP = $(FC) -E -P -x c

FC = mpifort
FC_SERIAL = gfortran
FFLAGS = -O2 -fPIC -ftree-vectorize -march=native

AR = ar
RANLIB = ranlib
SYS = nag


FCFLAGS_fixed_f =
FCFLAGS_free_f90 =
FPPFLAGS_fixed_F =
FPPFLAGS_free_F90 =

BLAS_LIBS = -L/usr/lib/openblas/x86_64-linux-gnu -lblas
LAPACK_LIBS = -L/usr/lib/x86_64-linux-gnu -llapack
BLACS_LIBS = -L/usr/lib/x86_64-linux-gnu -lblacs-openmpi
SCALAPACK_LIBS = /usr/lib/x86_64-linux-gnu/



MPI_INTERFACE = libmpi_f90.a


FFLAGS_DEBUG = -g -O0 # your appropriate flags here...

atom.o: atom.F
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

And this is the complete output

Compilation architecture to be used: unknown
If this is not what you want, create the right
arch.make file using the models in Src/Sys

Hit ^C to abort...

==> Incorporating information about present compilation (compiler and flags)
make "FPPFLAGS=-DFC_HAVE_ABORT -DMPI" compinfo.o
make[1]: Entering directory '/home/izxle/siesta-4.1-b4'
mpifort -c -O2 -fPIC -ftree-vectorize -march=native -DFC_HAVE_ABORT -DMPI compinfo.F90
make[1]: Leaving directory '/home/izxle/siesta-4.1-b4'

mpifort -c -O2 -fPIC -ftree-vectorize -march=native -DFC_HAVE_ABORT -DMPI /home/izxle/siesta-4.1-b4/Src/m_io_yaml.F90
mpifort -c -O2 -fPIC -ftree-vectorize -march=native -DFC_HAVE_ABORT -DMPI /home/izxle/siesta-4.1-b4/Src/siesta.F
mpifort -o siesta \
        automatic_cell.o atom_options.o arw.o atomlwf.o bands.o basis_enthalpy.o bessph.o bonds.o born_charge.o cellxc_mod.o cgwf.o chkdim.o chkgmx.o chempot.o coceri.o coxmol.o cross.o compute_norm.o denmat.o denmatlomem.o detover.o dfscf.o diagon.o digcel.o fft.o dhscf.o constr.o diagk_file.o diagg.o diagk.o diagkp.o diag2g.o diag2k.o diag3g.o diag3k.o diagpol.o diagsprl.o dipole.o dismin.o dnaefs.o doping_uniform.o dot.o m_efield.o egandd.o ener3.o ener3lomem.o errorf.o extrapolon.o m_fixed.o interpolation.o gradient.o gradientlomem.o grdsam.o hsparse.o idiag.o initatom.o inver.o iodm_netcdf.o iodmhs_netcdf.o iogrid_netcdf.o iolwf.o iozm.o ipack.o iopipes.o iosockets.o iowfs_netcdf.o kgrid.o kgridinit.o kinefsm.o ksv.o ksvinit.o linpack.o local_DOS.o madelung.o mesh.o meshphi.o meshdscf.o memory.o meshsubs.o metaforce.o m_supercell.o mulliken.o minvec.o naefs.o m_new_dm.o normalize_dm.o ordern.o outcell.o outcoor.o m_fft_gpfa.o pdos.o pdosg.o pdosk.o pdoskp.o phirphi.o pixmol.o plcharge.o projected_DOS.o propor.o m_partial_charges.o randomg.o reclat.o redcel.o reinit.o reord.o reordpsi.o rhoofd.o rhoofdsp.o rhooda.o savepsi.o shaper.o timer_tree.o timer.o vmb.o vmat.o vmatsp.o volcel.o cgvc.o cgvc_zmatrix.o m_convergence.o iocg.o ioeig.o iofa.o iokp.o iomd.o kpoint_pdos.o typecell.o ofc.o poison.o readsp.o radfft.o write_md_record.o kpoint_grid.o find_kgrid.o proximity_check.o state_init.o siesta_move.o setup_hamiltonian.o compute_dm.o mixer.o scfconvergence_test.o post_scf_work.o state_analysis.o write_subs.o siesta_init.o struct_init.o siesta_options.o read_options.o siesta_geom.o siesta_analysis.o siesta_end.o siesta_forces.o io.o sparse_matrices.o coor.o atm_transfer.o broadcast_basis.o eggbox.o optical.o phirphi_opt.o reoptical.o transition_rate.o initparallel.o show_distribution.o setspatial.o setatomnodes.o uncell.o cart2frac.o obc.o precision.o sys.o m_cell.o files.o spatial.o parallel.o parallelsubs.o parsing.o chemical.o atom.o atmparams.o m_mpi_utils.o fdf_extra.o m_iorho.o atmfuncs.o listsc.o memoryinfo.o m_memory.o sorting.o atomlist.o atm_types.o old_atmfuncs.o radial.o alloc.o spher_harm.o periodic_table.o version.o timestamp.o basis_types.o xml.o pseudopotential.o basis_specs.o basis_io.o ldau.o ldau_specs.o onmod.o densematrix.o writewave.o on_subs.o fermid.o m_broyddj.o electrostatic.o mneighb.o globalise.o siesta_cmlsubs.o siesta_cml.o units.o zmatrix.o m_broyden_mixing.o forhar.o m_walltime.o m_wallclock.o m_iostruct.o nlefsm.o overfsm.o overlap.o conjgr.o conjgr_old.o m_energies.o m_steps.o m_broyddj_nocomm.o broyden_optim.o ioxv.o dynamics.o md_out.o molecularmechanics.o zm_broyden_optim.o cell_broyden_optim.o remove_intramol_pressure.o m_ntm.o m_dipol.o m_kinetic.o m_rmaxh.o m_forces.o m_stress.o m_eo.o m_spin.o m_hsx.o m_fire.o setup_H0.o get_kpoints_scale.o get_target_stress.o fire_optim.o zm_fire_optim.o cell_fire_optim.o m_fire_para.o m_fire_mixing.o write_raw_efs.o pdos2g.o pdos2k.o pdos3g.o pdos3k.o spinorbit.o moments.o fsiesta_mpi.o final_H_f_stress.o debugmpi.o qsort.o save_density_matrix.o m_dscfcomm.o schecomm.o moremeshsubs.o domain_decom.o printmatrix.o mmio.o pspltm1.o lenstr.o setup_ordern_indexes.o m_iodm.o m_iodm_old.o m_filter.o m_io.o m_io_yaml.o m_timer.o extrae_module.o extrae_eventllist.o moreParallelSubs.o read_xc_info.o siesta_master.o bsc_xcmod.o bsc_cellxc.o xc.o vacuum_level.o write_orb_indx.o die.o m_pexsi.o m_pexsi_driver.o m_pexsi_dos.o m_pexsi_local_dos.o m_redist_spmatrix.o class_Distribution.o m_dminim.o m_zminim.o m_getopts.o f2kcli.o m_svd.o m_matio.o rusage.o memory_snapshot.o compute_ebs_shift.o memory_all.o matel_registry.o register_rfs.o new_matel.o kpoint_convert.o m_target_stress.o compute_max_diff.o init_output.o diag_option.o diag.o m_mixing.o m_mixing_scf.o m_trialorbitalclass.o siesta2wannier90.o m_planewavematrixvar.o delk.o m_planewavematrix.o m_digest_nnkp.o broadcast_projections.o compute_pw_matrix.o m_writedelk.o mmn.o m_noccbands.o amn.o m_overkkneig.o write_inp_wannier.o diagonalizeHk.o m_orderbands.o m_check_walltime.o print_spin.o class_OrbitalDistribution.o class_Sparsity.o class_Data1D.o class_Data2D.o class_SpData1D.o class_SpData2D.o restructSpData2D.o extrapolateSpData2D.o class_Geometry.o class_Fstack_Data1D.o class_Pair_Data1D.o class_Fstack_Pair_Data1D.o class_Pair_Geometry_SpData2D.o class_Fstack_Pair_Geometry_SpData2D.o class_Pair_SpData1D.o class_Fstack_Pair_SpData1D.o class_TriMat.o m_trimat_invert.o m_uuid.o object_debug.o m_rhog.o rhofft.o m_diis.o compute_energies.o m_char.o m_os.o intrinsic_missing.o geom_helper.o m_sparse.o m_handle_sparse.o m_mesh_node.o create_Sparsity_SC.o create_Sparsity_Union.o m_gauss_quad.o m_gauss_fermi_inf.o m_gauss_fermi_30.o m_gauss_fermi_28.o m_gauss_fermi_26.o m_gauss_fermi_24.o m_gauss_fermi_22.o m_gauss_fermi_20.o m_gauss_fermi_19.o m_gauss_fermi_18.o m_gauss_fermi_17.o m_integrate.o m_interpolate.o m_mat_invert.o m_monitor.o m_iterator.o m_pivot_array.o dm_charge.o m_pivot.o m_pivot_methods.o atom_graph.o m_geom_aux.o m_geom_objects.o m_geom_box.o m_geom_coord.o m_geom_square.o m_geom_plane.o m_charge_add.o m_hartree_add.o m_io_s.o m_region.o m_sparsity_handling.o m_ncdf_siesta.o m_ncdf_io.o m_exp_coord.o flook_siesta.o siesta_dicts.o m_cite.o m_ts_io.o m_ts_global_vars.o m_ts_options.o m_ts_aux.o m_ts_kpoints.o m_ts_iodm.o m_ts_electrode.o m_ts_gf.o m_ts_cctype.o ts_init.o ts_show_regions.o m_ts_electype.o m_ts_method.o m_ts_elec_se.o m_ts_debug.o m_ts_tdir.o m_ts_chem_pot.o m_transiesta.o m_ts_hartree.o m_ts_voltage.o m_ts_contour_eq.o m_ts_contour_neq.o m_ts_io_ctype.o m_ts_contour.o m_ts_io_contour.o m_ts_rgn2trimat.o m_ts_dm_update.o m_ts_weight.o m_ts_sparse.o m_ts_sparse_helper.o m_ts_charge.o m_ts_pivot.o m_ts_fullg.o m_ts_fullk.o m_ts_full_scat.o m_ts_tri_init.o m_ts_tri_common.o m_ts_trimat_invert.o m_ts_tri_scat.o m_ts_trig.o m_ts_trik.o m_ts_mumps_init.o m_ts_mumpsg.o m_ts_mumpsk.o m_ts_mumps_scat.o nag.o pxf.o sockets.o fsockets.o siesta.o libfdf.a libwxml.a libxmlparser.a \
               libSiestaXC.a libmpi_f90.a -L/usr/lib/x86_64-linux-gnu/openblas -lblas -L/usr/lib/x86_64-linux-gnu/openblas -llapack -L/usr/lib/x86_64-linux-gnu -lblacs-openmpi /usr/lib/x86_64-linux-gnu/