Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails for MSYS2 MinGW toolchain #692

Open
awvwgk opened this issue Dec 21, 2020 · 2 comments
Open

Build fails for MSYS2 MinGW toolchain #692

awvwgk opened this issue Dec 21, 2020 · 2 comments

Comments

@awvwgk
Copy link
Member

awvwgk commented Dec 21, 2020

Describe the bug

While trying to apply the MinGW64 toolchain from MSYS2 to a few projects I noticed DFTB+ does not work correctly in the MSYS2 bash shell.

To Reproduce

  1. Install MSYS2 on a Windows machine or checkout https://github.com/awvwgk/dftbplus/tree/mingw
  2. Use MSYS2 MinGW64 terminal with mingw-w64-x86_64-* packages
  3. Install fypp with pip (and set -DFYPP=$(which fypp) in the CMake configuration step)
  4. Try to build DFTB+ and observe failure while preprocessing (see https://github.com/awvwgk/dftbplus/runs/1588112700)
cmd.exe /C "cd /D D:\a\dftbplus\dftbplus\_build\prog\dftb+ && D:\a\dftbplus\dftbplus\external\fypp\bin\fypp -DTRAVIS -DELSI_VERSION=0 -DWITH_OMP -DWITH_C_EXECUTABLES -DDEBUG=1 -ID:/a/dftbplus/dftbplus/prog/dftb+/include -DRELEASE="'(UNKNOWN RELEASE)'" -DAPIVERSION="'0.2.0'" -DAPIMAJOR=0 -DAPIMINOR=2 -DAPIPATCH=0 D:/a/dftbplus/dftbplus/prog/dftb+/lib_io/hsdutils.F90 D:/a/dftbplus/dftbplus/_build/prog/dftb+/lib_io/hsdutils.f90"
'D:\a\dftbplus\dftbplus\external\fypp\bin\fypp' is not recognized as an internal or external command,
  1. Linking fails with (see https://github.com/awvwgk/dftbplus/runs/1619199655#step:6:12351)
    Linking only works if -DLAPACK_LIBRARY=... is explicitly specified, otherwise the link line is not propagated in the CustomLapack module:
 [765/828] Linking Fortran executable prog\dftb+\dftb+.exe
FAILED: prog/dftb+/dftb+.exe 
cmd.exe /C "cd . && D:\a\_temp\msys\msys64\mingw64\bin\gfortran.exe -g -Wall -std=f2008ts -pedantic -fbounds-check  prog/dftb+/CMakeFiles/dftb+.dir/prg_dftb/dftbplus.f90.obj -o prog\dftb+\dftb+.exe -Wl,--major-image-version,0,--minor-image-version,0  prog/dftb+/libdftbplus.a  external/mudpack/libmudpack.a  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0/libgomp.dll.a  D:/a/_temp/msys/msys64/mingw64/x86_64-w64-mingw32/lib/libmingwthrd.a && cd ."
D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: prog/dftb+/libdftbplus.a(blasroutines.f90.obj): in function `__dftbp_blasroutines_MOD_swap_dblecmplx':
  1. Testsuite is not setup correctly (see https://github.com/awvwgk/dftbplus/runs/1664663028#step:7:16):
/d/a/dftbplus/dftbplus/_build /d/a/dftbplus/dftbplus
Test project D:/a/dftbplus/dftbplus/_build
    Start 1: test_dptools
Process not started
 D:/a/dftbplus/dftbplus/test/tools/dptools/runtests.sh
[unknown error]
1/1 Test #1: test_dptools .....................***Not Run   0.00 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.01 sec

The following tests FAILED:
	  1 - test_dptools (BAD_COMMAND)
Errors while running CTest
Error: Process completed with exit code 8.

Testing might fail due to similar issues as with the fypp command not working

Expected behaviour

CMake shouldn't use the Windows CMD.exe but the MSYS2 (bash) shell to get the correctly setup environment.

LAPACK should be linked correctly.

Tests should be generated.

Additional Context
The preprocessing with fypp used in https://github.com/fortran-lang/stdlib works correctly with the MSYS2 MinGW64 toolchain and a similar workflow file.

Just creating this issue to keep track of it. I might come up with a fix if I find time to look into this.

@awvwgk
Copy link
Member Author

awvwgk commented Dec 28, 2020

The shipped fypp doesn't work on a clean Windows build due to missing Python installation. For Windows builds it is therefore always required to specify fypp by -DFYPP=$(which fypp) (for MSYS2 bash, command might differ for CMD.exe or PowerShell).

@awvwgk
Copy link
Member Author

awvwgk commented Jan 7, 2021

Found out that the CustomLapack module fails for default settings, but works fine if I explicitly provide the -DLAPACK_LIBRARY=... in the configuration step. At least it builds now with MinGW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant