elmerfem icon indicating copy to clipboard operation
elmerfem copied to clipboard

Build instructions on windows using MinGW-MSYS2

Open Foadsf opened this issue 5 years ago • 6 comments

I have been trying here to compile the software on Windows using MinGW-MSYS2, with no success. Here is what I have tried so far:

cmake -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/msys64/mingw64/bin/g++.exe -DCMAKE_Fortran_COMPILER=C:/msys64/mingw64/bin/gfortran.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/mingw32-make.exe -DBLAS_INCLUDE_DIRS=C:/msys64/mingw64/include/liblas/ -DBLAS_LIBRARIES=C:/msys64/mingw64/lib/libcblas.dll.a -DLAPACK_LIBRARIES=C:/msys64/mingw64/lib/liblapacke.dll.a .. -G "MinGW Makefiles" -DWITH_Mumps=FALSE -DWITH_MPI=FALSE -DWITH_OpenMP=FALSE -DWITH_MKL=FALSE -DWITH_ELMERGUI=FALSE -DWITH_ELMERPOST=FALSE -DWITH_ELMERGUITESTER=FALSE

But in the end I get the error:

collect2.exe: error: ld returned 1 exit status
fhutiter\src\CMakeFiles\fhuti.dir\build.make:230: recipe for target 'fhutiter/src/libfhuti.dll' failed
mingw32-make[2]: *** [fhutiter/src/libfhuti.dll] Error 1
CMakeFiles\Makefile2:14279: recipe for target 'fhutiter/src/CMakeFiles/fhuti.dir/all' failed
mingw32-make[1]: *** [fhutiter/src/CMakeFiles/fhuti.dir/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

I would appreciate it if you could help me with the proper command-line instructions including the CMake command.

Foadsf avatar Mar 13 '20 01:03 Foadsf

There are scripts that work with msys2. Even make the packages including Qt5 and MPI. The only important library missing is oce (OpenCascade community edition). See,
http://www.nic.funet.fi/pub/sci/physics/elmer/bin/windows-test/

raback avatar Mar 13 '20 10:03 raback

@raback Thanks. I will dig into the shell script. Any way to compile it outside of MSYS2, using only MinGW compilers? a cmd/Batch or PowerShell script for example?

Foadsf avatar Mar 13 '20 12:03 Foadsf

@raback may you be kind to make a list of the specific packages required to be installed with mingw-get from cmd/PowerShell or pacman from inside MSYS2?

Foadsf avatar Mar 13 '20 18:03 Foadsf

I have also requested a Chocolatey package for the software. But, the issue is that the sourceforge link is for the nightly build. The FUNET link, however, has two sets of binaries, with and without the nightly tag. May I consider the non-nightly ones as stable?

Foadsf avatar Mar 13 '20 18:03 Foadsf

So far here are the instructions:

  1. Install MSYS2 from the official website and update the packages accordingly
  2. install below packages inside the MSYS2 with pacman -S <packageName>:
  • mingw64/mingw-w64-x86_64-gcc
  • mingw64/mingw-w64-x86_64-make
  • mingw64/mingw-w64-x86_64-cmake
  • mingw64/mingw-w64-x86_64-gcc-libgfortran and mingw64/mingw-w64-x86_64-gcc-fortran
  • mingw64/mingw-w64-x86_64-msmpi
  • mingw64/mingw-w64-x86_64-openblas
  1. add C:\msys64\mingw64\bin folder to the Windows Environment Variables path
  2. open cmd and go to the downloaded Elmer's source and create-go inside the build folder
  3. run cmake -DCMAKE_C_COMPILER:FILEPATH=gcc -DCMAKE_CXX_COMPILER:FILEPATH=g++ .. -G "MinGW Makefiles"
  4. run cmake --build .

Foadsf avatar Mar 14 '20 03:03 Foadsf

This is my list of installed packages in msys2. oce not yet functional.

pacman -Sy
pacman --needed -S bash pacman pacman-mirrors msys2-runtime
! exit msys & restart 
pacman -Su
pacman -S git
pacman -S emacs
pacman -S make mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-gcc-fortran # (includes gcc)
pacman -S mingw-w64-x86_64-openblas
pacman -S mingw-w64-x86_64-nsis # (packaging under Windows)
pacman -S mingw-w64-x86_64-qt5
pacman -S mingw-w64-x86_64-qwt-qt5 # (includes qt5)
pacman -S mingw-w64-x86_64-msmpi # (for parallel version)
pacman -S mingw-w64-x86_64-oce # (OpenCASCADE community version)
pacman -S mingw-w64-x86_64-vtk
pacman -S mingw-w64-x86_64-lapack # (needed by MUMPS)

raback avatar Mar 17 '20 10:03 raback