Segmentation fault in tutorial 3_1, abinit installed with parallel support on macbook pro (intel x86-64)

Hi all,
I am a newcomer trying to get an abinit install to work on OSX to educate myself in abinit (hw is macbook pro with intel x86_64) according to the install instructions given in the docs. I succeeded to build all libs from source except the linear algebra where I used the system-provided accelerate framework.

My configure was:

../configure --enable-openmp --with-mpi --with-netcdf --with-netcdf-fortran=/usr/local --with-libxc
FCFLAGS_EXTRA="-g -Wall -fallow-argument-mismatch -fallow-argument-mismatch" --enable-zdot-bugfix="yes"

after which everything seems hunky-dory and make -j8 and make install terminate without errors.
The first two simple tutorials work fine but then I get a segmentation fault directly in when running the simple tutorial 3_1:


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

Backtrace for this error:

Could not print backtrace: executable file is not an executable
#0  0x10f00f86e
#1  0x10f00ea4d
#2  0x7ff806d9bdfc
#3  0x7ff807723d2c
#4  0x10afafc39
#5  0x10a83432b
#6  0x10a20aecb
#7  0x10a2160fe
#8  0x10a1873c5
#9  0x10a19210c
#10  0x10a0a4615
#11  0x10a0ae8bb
#12  0x10a086abc
#13  0x10a02adb3
#14  0x10a0309a7

I guess I made a beginners mistake somewhere, but I don’t know what to include as diagnostics. But maybe you can see whether there is something foul with the package dependencies?

fabian@MBP-FW-2020 Work3 % otool -L /usr/local/bin/abinit 
/usr/local/bin/abinit:
	/usr/local/opt/libxc/lib/libxc.9.dylib (compatibility version 12.0.0, current version 12.3.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/local/lib/libnetcdff.7.dylib (compatibility version 9.0.0, current version 9.0.0)
	/usr/local/lib/libnetcdf.19.dylib (compatibility version 21.0.0, current version 21.0.0)
	/usr/local/lib/libhdf5_hl.200.dylib (compatibility version 202.0.0, current version 202.0.0)
	/usr/local/lib/libhdf5.200.dylib (compatibility version 203.0.0, current version 203.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/local/opt/open-mpi/lib/libmpi_usempif08.40.dylib (compatibility version 71.0.0, current version 71.0.0)
	/usr/local/opt/open-mpi/lib/libmpi_usempi_ignore_tkr.40.dylib (compatibility version 71.0.0, current version 71.0.0)
	/usr/local/opt/open-mpi/lib/libmpi_mpifh.40.dylib (compatibility version 71.0.0, current version 71.0.0)
	/usr/local/opt/open-mpi/lib/libmpi.40.dylib (compatibility version 71.0.0, current version 71.4.0)
	/usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/usr/local/opt/gcc/lib/gcc/current/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0)
	/usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
	/usr/local/opt/gcc/lib/gcc/current/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

Thanks for reading this far and hoping for a hint how to proceed,
Fabian

Since I cannot upload files yet, I include the log file as quotation:

  ABINIT 9.4.2
  
ABI_PSPDIR  found in environment, with value /Users/fabian/Git/abinit/abinit-9.4.2/tests//Psps_for_tests/
-instrng: 75 lines of input have been read from file tbase3_1.abi


--- !COMMENT
src_file: m_dtfil.F90
src_line: 1476
message: |
    Output file: tbase3_1.abo already exists.
...


--- !COMMENT
src_file: m_dtfil.F90
src_line: 1500
message: |
    Renaming old: tbase3_1.abo to: tbase3_1.abo0004
...


.Version 9.4.2 of ABINIT 
.(MPI version, prepared for a x86_64_darwin21.6.0_gnu12.2 computer) 

.Copyright (C) 1998-2021 ABINIT group . 
 ABINIT comes with ABSOLUTELY NO WARRANTY.
 It is free software, and you are welcome to redistribute it
 under certain conditions (GNU General Public License,
 see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt).

 ABINIT is a project of the Universite Catholique de Louvain,
 Corning Inc. and other collaborators, see ~abinit/doc/developers/contributors.txt .
 Please read https://docs.abinit.org/theory/acknowledgments for suggested
 acknowledgments of the ABINIT effort.
 For more information, see https://www.abinit.org .

.Starting date : Fri 14 Oct 2022.
- ( at 16h02 )
  

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 === Build Information === 
  Version       : 9.4.2
  Build target  : x86_64_darwin21.6.0_gnu12.2
  Build date    : 20221014

 === Compiler Suite === 
  C compiler       : llvm14.0
  C++ compiler     : llvm14.0
  Fortran compiler : gnu12.2
  CFLAGS           : -g -O2 -mtune=native -mcpu=native
  CXXFLAGS         : -g -O2 -mtune=native -mcpu=native
  FCFLAGS          : -g -ffree-line-length-none  -fopenmp    -I/usr/local/include
  FC_LDFLAGS       : 

 === Optimizations === 
  Debug level        : basic
  Optimization level : standard
  Architecture       : unknown_unknown

 === Multicore === 
  Parallel build : yes
  Parallel I/O   : 
  openMP support : yes
  GPU support    : 

 === Connectors / Fallbacks === 
  LINALG flavor  : netlib
  FFT flavor     : goedecker
  HDF5           : yes
  NetCDF         : yes
  NetCDF Fortran : yes
  LibXC          : yes
  Wannier90      : no

 === Experimental features === 
  Exports             : 
  GW double-precision : 

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Default optimizations:
   -O2 -mtune=native -march=native


 Optimizations for 43_ptgroups:
   -O0


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 CPP options activated during the build:

                   CC_LLVM                  CXX_LLVM                    FC_GNU
 
 HAVE_FC_ALLOCATABLE_DT...             HAVE_FC_ASYNC         HAVE_FC_BACKTRACE
 
  HAVE_FC_COMMAND_ARGUMENT      HAVE_FC_COMMAND_LINE        HAVE_FC_CONTIGUOUS
 
           HAVE_FC_CPUTIME              HAVE_FC_EXIT             HAVE_FC_FLUSH
 
             HAVE_FC_GAMMA            HAVE_FC_GETENV   HAVE_FC_IEEE_ARITHMETIC
 
   HAVE_FC_IEEE_EXCEPTIONS          HAVE_FC_INT_QUAD             HAVE_FC_IOMSG
 
     HAVE_FC_ISO_C_BINDING  HAVE_FC_ISO_FORTRAN_2008        HAVE_FC_LONG_LINES
 
        HAVE_FC_MOVE_ALLOC  HAVE_FC_ON_THE_FLY_SHAPE           HAVE_FC_PRIVATE
 
         HAVE_FC_PROTECTED           HAVE_FC_SHIFTLR         HAVE_FC_STREAM_IO
 
            HAVE_FC_SYSTEM          HAVE_FORTRAN2003                 HAVE_HDF5
 
        HAVE_LIBPAW_ABINIT      HAVE_LIBTETRA_ABINIT                HAVE_LIBXC
 
                  HAVE_MPI                 HAVE_MPI2       HAVE_MPI_IALLGATHER
 
       HAVE_MPI_IALLREDUCE        HAVE_MPI_IALLTOALL       HAVE_MPI_IALLTOALLV
 
           HAVE_MPI_IBCAST         HAVE_MPI_IGATHERV        HAVE_MPI_INTEGER16
 
               HAVE_MPI_IO HAVE_MPI_TYPE_CREATE_S...               HAVE_NETCDF
 
       HAVE_NETCDF_FORTRAN         HAVE_OMP_COLLAPSE               HAVE_OPENMP
 
         HAVE_TIMER_ABINIT                                                      
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

- input  file    -> tbase3_1.abi
- output file    -> tbase3_1.abo
- root for input  files -> tbase3_1i
- root for output files -> tbase3_1o

ABI_PSPDIR  found in environment, with value /Users/fabian/Git/abinit/abinit-9.4.2/tests//Psps_for_tests/
-instrng: 75 lines of input have been read from file tbase3_1.abi

 For atom type 1, psp file is /Users/fabian/Git/abinit/abinit-9.4.2/tests//Psps_for_tests/Pseudodojo_nc_sr_04_pw_standard_psp8/Si.psp8
  read the values zionpsp=  4.0 , pspcod=   8 , lmax=   2

 inpspheads: deduce mpsang = 3, n1xccc = 2501.

======================================================= 
 invars1m : enter jdtset= 0

 symlatt: the Bravais lattice is cF (face-centered cubic)
  xred   is defined in input file
 ingeo: takes atomic coordinates from input array xred

--- !COMMENT
src_file: m_ingeo.F90
src_line: 900
message: |
    The tolerance on symmetries =   1.000E-05 is bigger than 1.0e-8.
    In order to avoid spurious effects, the atomic coordinates have been
    symmetrized before storing them in the dataset internal variable.
    So, do not be surprised by the fact that your input variables (xcart, xred, ...)
    do not correspond exactly to the ones echoed by ABINIT, the latter being used to do the calculations.
    This is not a problem per se.
    Still, in order to avoid this symmetrization (e.g. for specific debugging/development), decrease tolsym to 1.0e-8 or lower,
    or (much preferred) use input primitive vectors that are accurate to better than 1.0e-8.
    This message will only be printed once, even if there are other datasets where tolsym is bigger than 1.0e-8.
...


 symlatt: the Bravais lattice is cF (face-centered cubic)

 symlatt: the Bravais lattice is cF (face-centered cubic)
 symspgr: spgroup= 227  Fd -3 m   (=Oh^7)
 symspgr: optical characteristics = isotropic
 invars2: take the default value of fband=  1.25000000E-01
 For input ecut=  1.200000E+01 best grid ngfft=      24      24      24
       max ecut=  1.371408E+01

 ==== FFT mesh ====
  FFT mesh divisions ........................    24   24   24
  Augmented FFT divisions ...................    25   25   24
  FFT algorithm .............................   112
  FFT cache size ............................    16
 getmpw: optimal value of mpw= 525

 Symmetries : space group Fd -3 m (#227); Bravais cF (face-center cubic)

 getdim_nloc : deduce lmnmax  =  18, lnmax  =   6,
                      lmnmaxso=  18, lnmaxso=   6.
memory: analysis of memory needs
================================================================================
 Values of the parameters that define the memory need of the present run
     intxc =       0    ionmov =       0      iscf =       7    lmnmax =       6
     lnmax =       6     mgfft =      24  mpssoang =       3    mqgrid =    3001
     natom =       2  nloc_mem =       1    nspden =       1   nspinor =       1
    nsppol =       1      nsym =      48    n1xccc =    2501    ntypat =       1
    occopt =       1   xclevel =       1
-    mband =           5        mffmem =           1         mkmem =           2
       mpw =         525          nfft =       13824          nkpt =           2
================================================================================
P This job should need less than                       4.782 Mbytes of memory.
  Rough estimation (10% accuracy) of disk space for files :
_ WF disk file :      0.082 Mbytes ; DEN or POT disk file :      0.107 Mbytes.
================================================================================

 Biggest array : f_fftgr(disk), with      1.6895 MBytes.
 memana : allocated an array of      1.690 Mbytes, for testing purposes.
 memana: allocated       4.782Mbytes, for testing purposes. 
 The job will continue.
--------------------------------------------------------------------------------
------------- Echo of variables that govern the present computation ------------
--------------------------------------------------------------------------------
-
- outvars: echo of selected default values                                      
-   iomode0 =  0 , fftalg0 =112 , wfoptalg0 =  0
-
- outvars: echo of global parameters not present in the input file              
-  max_nthreads =    8
-
 -outvars: echo values of preprocessed input variables --------
 
 These variables are accessible in NetCDF format (tbase3_1o_OUT.nc)

            acell      1.0180000000E+01  1.0180000000E+01  1.0180000000E+01 Bohr
              amu      2.80855000E+01
           diemac      1.20000000E+01
             ecut      1.20000000E+01 Hartree
-          fftalg         112
              ixc       -1012
              kpt     -2.50000000E-01  5.00000000E-01  0.00000000E+00
                      -2.50000000E-01  0.00000000E+00  0.00000000E+00
         kptrlatt        2   -2    2     -2    2    2     -2   -2    2
          kptrlen      2.03600000E+01
P           mkmem           2
            natom           2
            nband           5
            ngfft          24      24      24
             nkpt           2
            nstep          10
             nsym          48
           ntypat           1
              occ      2.000000  2.000000  2.000000  2.000000  0.000000
            rprim      0.0000000000E+00  5.0000000000E-01  5.0000000000E-01
                       5.0000000000E-01  0.0000000000E+00  5.0000000000E-01
                       5.0000000000E-01  5.0000000000E-01  0.0000000000E+00
           shiftk      5.00000000E-01  5.00000000E-01  5.00000000E-01
          spgroup         227
           symrel      1  0  0   0  1  0   0  0  1      -1  0  0   0 -1  0   0  0 -1
                       0 -1  1   0 -1  0   1 -1  0       0  1 -1   0  1  0  -1  1  0
                      -1  0  0  -1  0  1  -1  1  0       1  0  0   1  0 -1   1 -1  0
                       0  1 -1   1  0 -1   0  0 -1       0 -1  1  -1  0  1   0  0  1
                      -1  0  0  -1  1  0  -1  0  1       1  0  0   1 -1  0   1  0 -1
                       0 -1  1   1 -1  0   0 -1  0       0  1 -1  -1  1  0   0  1  0
                       1  0  0   0  0  1   0  1  0      -1  0  0   0  0 -1   0 -1  0
                       0  1 -1   0  0 -1   1  0 -1       0 -1  1   0  0  1  -1  0  1
                      -1  0  1  -1  1  0  -1  0  0       1  0 -1   1 -1  0   1  0  0
                       0 -1  0   1 -1  0   0 -1  1       0  1  0  -1  1  0   0  1 -1
                       1  0 -1   0  0 -1   0  1 -1      -1  0  1   0  0  1   0 -1  1
                       0  1  0   0  0  1   1  0  0       0 -1  0   0  0 -1  -1  0  0
                       1  0 -1   0  1 -1   0  0 -1      -1  0  1   0 -1  1   0  0  1
                       0 -1  0   0 -1  1   1 -1  0       0  1  0   0  1 -1  -1  1  0
                      -1  0  1  -1  0  0  -1  1  0       1  0 -1   1  0  0   1 -1  0
                       0  1  0   1  0  0   0  0  1       0 -1  0  -1  0  0   0  0 -1
                       0  0 -1   0  1 -1   1  0 -1       0  0  1   0 -1  1  -1  0  1
                       1 -1  0   0 -1  1   0 -1  0      -1  1  0   0  1 -1   0  1  0
                       0  0  1   1  0  0   0  1  0       0  0 -1  -1  0  0   0 -1  0
                      -1  1  0  -1  0  0  -1  0  1       1 -1  0   1  0  0   1  0 -1
                       0  0  1   0  1  0   1  0  0       0  0 -1   0 -1  0  -1  0  0
                       1 -1  0   0 -1  0   0 -1  1      -1  1  0   0  1  0   0  1 -1
                       0  0 -1   1  0 -1   0  1 -1       0  0  1  -1  0  1   0 -1  1
                      -1  1  0  -1  0  1  -1  0  0       1 -1  0   1  0 -1   1  0  0
            tnons      0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
                       0.0000000  0.0000000  0.0000000     0.2500000  0.2500000  0.2500000
           toldfe      1.00000000E-06 Hartree
            typat      1  1
              wtk        0.75000    0.25000
           xangst      0.0000000000E+00  0.0000000000E+00  0.0000000000E+00
                       1.3467559959E+00  1.3467559959E+00  1.3467559959E+00
            xcart      0.0000000000E+00  0.0000000000E+00  0.0000000000E+00
                       2.5450000000E+00  2.5450000000E+00  2.5450000000E+00
             xred      0.0000000000E+00  0.0000000000E+00  0.0000000000E+00
                       2.5000000000E-01  2.5000000000E-01  2.5000000000E-01
            znucl       14.00000

================================================================================

 chkinp: Checking input parameters for consistency.
 DATA TYPE INFORMATION: 
 REAL:      Data type name: REAL(DP) 
            Kind value:      8
            Precision:      15
            Smallest nonnegligible quantity relative to 1: 0.22204460E-015
            Smallest positive number:                      0.22250739E-307
            Largest representable number:                  0.17976931E+309
 INTEGER:   Data type name: INTEGER(default) 
            Kind value: 4
            Bit size:   32
            Largest representable number: 2147483647
 LOGICAL:   Data type name: LOGICAL 
            Kind value: 4
 CHARACTER: Data type name: CHARACTER             Kind value: 1

  ==== OpenMP parallelism is ON ====
- Max_threads:       8
- Num_threads:       8
- Num_procs:         8
- Dynamic:           F
- Nested:            F
 
  ==== Using MPI-2 specifications ==== 
  MPI-IO support is ON
  xmpi_tag_ub ................   2147483647
  xmpi_bsize_ch ..............            1
  xmpi_bsize_int .............            4
  xmpi_bsize_sp ..............            4
  xmpi_bsize_dp ..............            8
  xmpi_bsize_spc .............            8
  xmpi_bsize_dpc .............           16
  xmpio_bsize_frm ............            4
  xmpi_address_kind ..........            8
  xmpi_offset_kind ...........            8
  MPI_WTICK ..................    9.9999999999999995E-007

================================================================================
== DATASET  1 ==================================================================
-   mpi_nproc: 1, omp_nthreads: 8 (-1 if OMP is not activated)


--- !COMMENT
src_file: m_xgScalapack.F90
src_line: 236
message: |
    xgScalapack in auto mode
...


 getdim_nloc : deduce lmnmax  =  18, lnmax  =   6,
                      lmnmaxso=  18, lnmaxso=   6.
 Slater exchange
 P. A. M. Dirac, Math. Proc. Cambridge Philos. Soc. 26, 376 (1930)
 F. Bloch, Z. Phys. 57, 545 (1929)
 Perdew & Wang

As a guess, this could come from OpenMP. Could you check the OMP_* variables in your environment and make sure OpenMP nesting is disabled?

What happens if you type export OMP_NUM_THREADS=1 before running ABINIT?

If this still fails, you could try to recompile without OpenMP.

If this still fails afterwards, you could look at the contents of your DYLD_LIBRARY_PATH and see whether the dynamic linker could hit the wrong version of a library.

Thanks a lot for the guidance, I have tried with restricting the number of threads and without OpenMP and the error persists. On the DYLD_LIBRARY_PATH I am unsure how it could help since I tried to build everything under /usr/local so the libraries should go into /usr/local/lib where I guess the build system of abinit should find them.

So I started all over again and decided to use the intel compilers icc and ifort to build everything from scratch (the intel compilers come packaged with mkl, so I have the linalg part covered).
HDF5, netcdf, netcdf-fortran and libXC are possible to install this way, but now the abinit configure script deems the netcdf-fortran installation as non-working, but the fallback is disabled. Since my experience with fortran is (cm-fortran) is from the 90’s I am little lost, but I include here the dependencies of the two libraries. Is it possible to find a hint as what to is wrong here:

fabian@MBP-FW-2020 build % otool -L /usr/local/lib/libnetcdf.dylib 
/usr/local/lib/libnetcdf.dylib:
	/usr/local/lib/libnetcdf.19.dylib (compatibility version 21.0.0, current version 21.0.0)
	/usr/local/lib/libhdf5_hl.200.dylib (compatibility version 202.0.0, current version 202.0.0)
	/usr/local/lib/libhdf5.200.dylib (compatibility version 203.0.0, current version 203.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
	/usr/local/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.2)
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
fabian@MBP-FW-2020 build % otool -L /usr/local/lib/libnetcdff.dylib
/usr/local/lib/libnetcdff.dylib:
	/usr/local/lib/libnetcdff.7.dylib (compatibility version 9.0.0, current version 9.0.0)
	/usr/local/lib/libnetcdf.19.dylib (compatibility version 21.0.0, current version 21.0.0)
	/usr/local/lib/libhdf5_hl.200.dylib (compatibility version 202.0.0, current version 202.0.0)
	/usr/local/lib/libhdf5.200.dylib (compatibility version 203.0.0, current version 203.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
	/usr/local/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.2)
	/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	@rpath/libifcoremt.dylib (compatibility version 1.0.0, current version 1.11.0)

And here is the summary of the configure script:


  +----------------+--------+--------+--------+--------+
  |Feature         |Enabled |Init    |Working |Fallback|
  +----------------+--------+--------+--------+--------+
  |abinit_common   |no      |def     |unknown |no      |
  |bigdft          |no      |def     |unknown |disabled|
  |fft             |yes     |def     |yes     |no      |
  |fftw3           |no      |def     |unknown |no      |
  |gpu             |no      |def     |no      |no      |
  |hdf5            |yes     |env     |yes     |disabled|
  |levmar          |no      |def     |unknown |no      |
  |libpaw          |no      |def     |unknown |no      |
  |libpsml         |no      |def     |unknown |disabled|
  |libxc           |yes     |env     |yes     |disabled|
  |libxml2         |no      |def     |unknown |no      |
  |linalg          |yes     |dir     |no      |disabled|
  |mpi             |no      |yon     |no      |no      |
  |netcdf          |yes     |env     |yes     |disabled|
  |netcdf_fortran  |yes     |env     |no      |disabled|
  |papi            |no      |def     |unknown |no      |
  |pfft            |no      |def     |unknown |no      |
  |triqs           |no      |def     |unknown |no      |
  |wannier90       |no      |def     |unknown |disabled|
  |xmlf90          |no      |def     |unknown |disabled|
  +----------------+--------+--------+--------+--------+

In order to make life a little easier I have also resorted to build without mpi, since I would be happy to build and run with the sequential version to go through the base tutorials and then go back to learn what goes into parallel builds.

Maybe I should also include the critical section of config.log around the netcdf-c, netcdf-fortran part of the script (I have tested with a variety of flags there and they may reflect my ignorance to get it right).

configure:40010: checking for the NetCDF Fortran interface library flags
configure:40016: result: -lnetcdff
configure:40054: checking whether the NetCDF Fortran interface works
configure:40074: ifort -o conftest -g -extend-source -nofpscomp  -qopenmp   -I/Users/fabian/Git/netcdf/netcdf-fortran-4.6.0/fortran   -L/usr/local/lib  -L/usr/local/lib  conftest.F90 -lnetcdff -lnetcdf -lhdf5  >&5
ld: warning: dylib (/usr/local/lib/libhdf5.dylib) was built for newer macOS version (12.0) than being linked (10.16)
Undefined symbols for architecture x86_64:
  "_netcdf_mp_nf90_open_", referenced from:
      _MAIN__ in ifortB1AhCi.o
ld: symbol(s) not found for architecture x86_64
configure:40074: $? = 1
configure: failed program was:
|       program main
| 
|           use netcdf
|           character(len=*), parameter :: path = "dummy"
|           integer :: mode, ncerr, ncid
|           ncerr = nf90_open(path,mode,ncid)
| 
|       end
configure:40074: ifort -o conftest -g -extend-source -nofpscomp  -qopenmp   -I/Users/fabian/Git/netcdf/netcdf-fortran-4.6.0/fortran  -I/usr/include  -L/usr/local/lib  -L/usr/local/lib  conftest.F90 -lnetcdff -lnetcdf -lhdf5  >&5
ld: warning: dylib (/usr/local/lib/libhdf5.dylib) was built for newer macOS version (12.0) than being linked (10.16)
Undefined symbols for architecture x86_64:
  "_netcdf_mp_nf90_open_", referenced from:
      _MAIN__ in ifort438QRX.o
ld: symbol(s) not found for architecture x86_64
configure:40074: $? = 1
configure: failed program was:
|       program main
| 
|           use netcdf
|           character(len=*), parameter :: path = "dummy"
|           integer :: mode, ncerr, ncid
|           ncerr = nf90_open(path,mode,ncid)
| 
|       end
configure:40095: result: no

Thanks for your kind help,
Fabian

Dear Fabian,
I would advise to compile the dependencies (libxc, hdf5, netcdf, netcdf-fortran) from the fallback directory, and making sure to pass those to the configure script. For me, this approach solves at least 90% of the problems when compiling on macOS…

Dear Antonius,
I have tried that too, but I have been unable to make it select netcdf-fortran as sole build target, so when the fallback configure script runs it terminates in the middle of making the libxc with the following message:

configure: Using FCFLAGS=" -fpp-name=fpp  "
checking whether /lib/cpp is usable for Fortran preprocessing... preprocessor cannot be run
checking whether icc -E is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether icc -E -ansi is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether icc -E -C -ffreestanding is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether icc -E -x c is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether icc -E -x c -ansi is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether icc -E -x c -C -ffreestanding is usable for Fortran preprocessing... preprocessor mangles C++ style comment
checking whether /usr/bin/cpp is usable for Fortran preprocessing... preprocessor does not concatenate tokens
checking whether /usr/bin/cpp -ansi is usable for Fortran preprocessing... preprocessor does not concatenate tokens
checking whether /usr/bin/cpp -C -ffreestanding is usable for Fortran preprocessing... preprocessor does not concatenate tokens
configure: error: Could not find preprocessor usable for Fortran.
make[2]: *** [stamps/libxc-config-stamp] Error 1
make[1]: [all-local] Error 2 (ignored)
Checking build of libxc fallback
test -e stamps/libxc-install-stamp
make[1]: *** [all-local] Error 1
make: *** [install-recursive] Error 1
We have detected a problem while generating fallbacks : contact Abinit's team

I am perplexed it wants to preprocess fortran with a c++ compiler??
Do you have any advice for this case?
Best regards,
Fabian

I believe Abinit will just use the cpp as a fortran preprocessor. I don’t have access to the intel compilers on my mac, so I cannot test your setup, but here is my configuration file (I use gcc-10 from Homebrew and the default Apple clang for cpp).

Issuing make will correctly generate the configuration files inside the fallback directory (most of the time).

# MPI support
with_mpi="/usr/local/"
with_debug_flavor="verbose"
FCFLAGS_EXTRA="-fallow-argument-mismatch -ffree-line-length-none"
fb=/Users/antonius/Software/Abinit/abinit-gitlab/build1/fallbacks/install_fb/gnu/10.3/

# libxc
with_libxc="${fb}/libxc/default/"

# NetCDF
with_netcdf="${fb}/netcdf4/default/"
with_netcdf_fortran="${fb}/netcdf4_fortran/default/"

# HDF5
with_hdf5="${fb}/hdf5/default/"

# linalg
LINALG_LIBS="-L${fb}/linalg/default/lib -llapack -lblas"

Dear Antonius,
this gets me close insofar as I now get through the .configure with .ac file for my host, but during make it shuts now down with an error in hdf5:

  CC       H5Ftest.lo
../../src/H5Fsuper.c:1397:16: error: implicit declaration of function 'H5O__fsinfo_set_version' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            if(H5O__fsinfo_set_version(f, &fsinfo) < 0)
               ^
  CC       H5FA.lo
1 error generated.
make[5]: *** [H5Fsuper.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
  CC       H5FAcache.lo
  CC       H5FAdbg.lo
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [stamps/hdf5-build-stamp] Error 2
make[1]: [all-local] Error 2 (ignored)
Checking build of hdf5 fallback
test -e stamps/hdf5-install-stamp
make[1]: *** [all-local] Error 1
make: *** [all-recursive] Error 1

I am grateful for your help, but I have to call it a day and restart tomorrow with renewed hopes.
Best regards,
Fabian

Dear Fabian,

In your first post, I read

I am a newcomer trying to get an abinit install to work on OSX to educate myself in abinit (hw is macbook pro with intel x86_64) according to the install instructions given in the docs.

We have several recipes usable on macOS that allow to install and run abinit!

Using MacPorts ( or Homebrew ), it is not necessary to compile the fallbacks…

I know that it is potentially better with the Intel compiler but if it’s to run the tutorials, it’s already a good base…

see config :

https://buildbot.abinit.org/builders/graphene_gnu_11.2_macports/builds/332

https://buildbot.abinit.org/builders/graphene_gnu_11.2_macports/builds/332/steps/buildbot.ac/logs/buildbot_ac/text

Hi jmbgmx,
I tried that since to learn abinit was the first prio, so I happily went ahead with the mac port but unfortunately none of the installation works on macOS 12 (different fails for gcc9, gcc11 and gcc12 with dependencies that are mutually inconsistent…). Also redoing the nightly build you linked in from yesterday failed due the disparity in macOS X for that machine. However I have came some way with icc/ifort builds from source which now only chokes in one the final make steps due to a misfortune in the compilation of blas source files (more on that if I am able to dig a way out).

For future reference I can mention that my original problem with netcdf-fortran build from source is solved with a workaround here: https://docs.unidata.ucar.edu/netcdf-c/current/known_problems.html#intel-fortran-macosx

In order not to take more of your time folks I mark this thread as solved and report back in case I run into trouble with abinit on xeon/linux/icc/ifort/mkl.

Thanks a lot and have a nice weekend,
Fabian