Skip to content

[BUG] Compilation fails in v2.7.2 due to syntax error and missing object file. #186

@hongyi-zhao

Description

@hongyi-zhao

Description

WannierTools v2.7.2 fails to compile with Intel Fortran Compiler due to two issues:

  1. Syntax error in module.f90 (missing comma)
  2. Missing orbital_hall.o in Makefile.intel-mpi-with-ARPACK

Environment

  • WannierTools version: v2.7.2
  • Compiler: Intel Fortran Compiler Classic (ifort) with OneAPI 2024.2.0
  • System: Linux
  • MPI: Intel MPI
  • ARPACK: arpack-ng/master-oneapi.2024.2.0
  • BLAS/LAPACK: Intel MKL

Error Messages

Error 1: Syntax Error

module.f90(497): error #5082: Syntax error, found IDENTIFIER 'LINEAR_OPTIC_CALC' when expecting one of: , <END-OF-STATEMENT> ; /
                          linear_optic_calc, BPVE_calc, Intra_orbital_hall_calc
--------------------------^

Error 2: Linking Error

ld: main.o: in function `MAIN__':
main.f90:(.text+0x4043): undefined reference to `intra_orbital_hall_conductivity_'
make: *** [Makefile.intel-mpi-with-ARPACK:41: main] Error 1

Root Cause

  1. Line 496 in src/module.f90: Missing comma after BdG_phase_calc
  2. Makefile.intel-mpi-with-ARPACK: Missing orbital_hall.o in the OBJ list, even though orbital_hall.f90 exists and contains the required subroutine Intra_Orbital_hall_conductivity

Steps to Reproduce

  1. Clone WannierTools repository
  2. git checkout v2.7.2
  3. cd src
$ module load oneapi/2024.2.0
$ module load arpack-ng/master-oneapi.2024.2.0

$ echo $ARPACK_NG_ROOT 
/home/werner/Public/repo/github.com/opencollab/arpack-ng/master-oneapi.2024.2.0
$ ls $ARPACK_NG_ROOT
include  lib

$ make clean -f Makefile.intel-mpi-with-ARPACK
$ make ARPACK="-L${ARPACK_NG_ROOT}/lib -larpack" F90="mpiifort -fpp -DMPI -fpe3 -O3 -DARPACK -DINTELMKL" CC="mpiicc -cpp -O3 -DINTELMKL" -f Makefile.intel-mpi-with-ARPACK

Solution

Apply the following two fixes:

Fix 1: Add missing comma in module.f90

sed -i 's/BdG_phase_calc &/BdG_phase_calc, \&/' src/module.f90

or manually edit line 496:

# Before (incorrect):
valley_projection_calc, Matrix_Element_calc, BdGChern_calc, SlabBdG_calc, BdG_phase_calc &

# After (correct):  
valley_projection_calc, Matrix_Element_calc, BdGChern_calc, SlabBdG_calc, BdG_phase_calc, &

Fix 2: Add orbital_hall.o to Makefile

sed -i 's/2D_TSC\.o optic\.o\\/2D_TSC.o optic.o orbital_hall.o \\/' src/Makefile.intel-mpi-with-ARPACK

or manually edit the OBJ line in Makefile.intel-mpi-with-ARPACK:

# Before:
2D_TSC.o optic.o\

# After:
2D_TSC.o optic.o orbital_hall.o \

Verification

After applying both fixes, compilation completes successfully:

$ make clean -f Makefile.intel-mpi-with-ARPACK
$ make ARPACK="-L${ARPACK_NG_ROOT}/lib -larpack" F90="mpiifort -fpp -DMPI -fpe3 -O3 -DARPACK -DINTELMKL" CC="mpiicc -cpp -O3 -DINTELMKL" -f Makefile.intel-mpi-with-ARPACK

Suggested Action

Please apply these fixes to the v2.7.2 release or create a patch release v2.7.3 with these corrections.

Additional Notes

  • The function Intra_Orbital_hall_conductivity exists in orbital_hall.f90 but was not being compiled due to missing makefile entry
  • This issue likely affects all users trying to compile v2.7.2 with Intel compilers
  • The syntax error suggests the code may not have been tested with strict Fortran compilers before release

Regards,
Zhao

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions