I am trying to compile MMG with MinGW, but I am unable due to the (apparently) requirement for Scotch, which I am not able to compile in Windows with MinGW. The requirement (in the past I compiled for VS without Scotch) may be due to some preprocessor macro not properly detected?
Hello,
If I understand, you set the USE_SCOTCH flag of CMake to OFF but Mmg still tries to link with scotch?
Thank you by advance for you answer,
Regards,
Algiane
Apparently is not detected… I will try again later
This my configure (as MinGW it works as n UNIX):
#!/bin/sh
# this is an example file...please DO NOT MODIFY if you don't want to do it for everyone
# to use it, copy it to another file and run it
# additional compiler flags could be added customizing the corresponding var, for example
# -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -msse3 ". Note that the "defaults are already correctly coded"
# so we should add here only machine specific stuff
#the user should also note that the symbol "\" marks that the command continues on the next line. IT SHOULD ONLY BE FOLLOWED
#BY the "ENTER" and NOT by any space!!
cmake .. \
-G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DWIN32=TRUE \
-DCMAKE_EXE_LINKER_FLAGS="-s" \
-DCMAKE_SHARED_LINKER_FLAGS="-s" \
-DCMAKE_C_COMPILER="gcc" \
-DCMAKE_CXX_COMPILER="g++" \
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -msse3" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -msse3" \
-DUSE_SCOTCH=OFF \
-DSCOTCH_INCLUDE_DIR="/usr/include/scotch/" \
-DSCOTCH_LIBRARY="libscotchmetis-5.1.so" \
-DSCOTCHERR_LIBRARY="libscotcherr-5.1.so" \
cmake --build . -- -j 4
The output:
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: D:/DATA/v.mataix-ferrandiz/AppData/Local/msys64/mingw64/bin/gc
-- Check for working C compiler: D:/DATA/v.mataix-ferrandiz/AppData/Local/msys64/mingw64/bin/gc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/DATA/v.mataix-ferrandiz/AppData/Local/msys64/mingw64/bin/
-- Check for working CXX compiler: D:/DATA/v.mataix-ferrandiz/AppData/Local/msys64/mingw64/bin/
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for scotch -- scotch.h not found
-- Looking for scotch -- lib scotch not found
-- Looking for scotch -- lib scotcherrexit not found
-- Performing Test SCOTCH_Num_4
-- Performing Test SCOTCH_Num_4 - Failed
-- Performing Test SCOTCH_Num_8
-- Performing Test SCOTCH_Num_8 - Failed
-- Could NOT find SCOTCH (missing: SCOTCH_LIBRARIES SCOTCH_WORKS)
CMake Warning at CMakeLists.txt:208 (MESSAGE):
Scotch library not found:Using scotch reduce the execution time of mmg3d
(see https://gforge.inria.fr/frs/?group_id=248 to download it).If you have
already installed Scotch and want to use it, please set the CMake variable
or environment variable SCOTCH_DIR to your scotch directory.
-- Could NOT find ELAS (missing: ELAS_INCLUDE_DIR ELAS_LIBRARY)
-- Could NOT find ELAS (missing: ELAS_INCLUDE_DIR ELAS_LIBRARY)
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg2d/libmmg2d.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg2d/libmmgtypes.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmgs/libmmgs.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmgs/libmmgtypes.h
-- Vertex insertion by delaunay kernel
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg3d/libmmg3d.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg3d/libmmgtypes.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg//libmmgf.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg2d//libmmg2d.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg2d//libmmgtypes.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmgs//libmmgs.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmgs//libmmgtypes.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg3d//libmmg3d.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg/mmg3d//libmmgtypes.h
-- Up-to-date: E:/SRC/mmg/build/include/mmg//libmmg.h
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
M_LIB (ADVANCED)
linked by target "libmmg2d_a" in directory E:/SRC/mmg
linked by target "libmmgs_a" in directory E:/SRC/mmg
linked by target "mmgs" in directory E:/SRC/mmg
linked by target "libmmg3d_a" in directory E:/SRC/mmg
linked by target "mmg2d" in directory E:/SRC/mmg
linked by target "mmg3d" in directory E:/SRC/mmg
linked by target "libmmg_a" in directory E:/SRC/mmg
-- Configuring incomplete, errors occurred!
See also "E:/SRC/mmg/build/CMakeFiles/CMakeOutput.log".
See also "E:/SRC/mmg/build/CMakeFiles/CMakeError.log".
mingw32-make.exe: *** No targets specified and no makefile found. Stop.
Looks like the USE_SCOTCH is not even available (I see this with the CMake-GUI):
Hi,
In fact the scotch message is a warning only (it appears if scotch isn’t detected but doesn’t break the compilation).
The error is linked to the math library (libm.so on linux, M_LIB in the error message of CMake) that isn’t founded (and is required).
The list of the mingw packages that I have installed:
- mingw-developer-tools,
- mingw32-base,
- mingw32-gcc-fortran,
- mingw32-gcc-g++,
- msys-base.
Moreover, I have succeed to build scotch on windows (but long time ago, with the 5.1.12b version). Here some tips:
- Launch MSYS C:/MinGW/msys/1.0/msys.bat
- Get into scotch 5.1.12b source directory
- copy Make.inc/Makefile.inc.i686_pc_mingw32 into Makefile.inc.
- Edit the Makefile.in file:
- Add the missing # before "LDFLAGS variables."
- Add “-Drestrict= -DCOMMON_WINDOWS -DHAVE_STDINT_H” to the CFLAGS_DEF
- Remove all lines related to mpi
- Remove the -DSCOTCH_PTSCOTCH from the CFLAGS_DEF line
- Comment section related to pthreads
- Run
make
Hope this will helps,
Regards,
Algiane
Thanks, for now I tried with https://msys2.duckdns.org/package/msys2-runtime-devel?repo=msys&variant=x86_64, which includes /usr/lib/libm.a
. Does not work, maybe I need to manually specify it
I fix it, I modified CMakeLists.txt, and defined manually libm. BTW, there is an alternative implemenetation here https://packages.msys2.org/package/mingw-w64-x86_64-openlibm?repo=mingw64
In fact it is this alternative implementation the one which actually works (the rpeviously posted give me linking error). I will do a PR
Hi,
Thank you, It is now merged into the master branch.
Regards,
Dear @Algiane ,
why you do not use .gitmodules
to automatically include the scotch library? something like:
[submodule "scotch"]
path = include/scotch
url = https://github.com/poulson/scotch
Dear @Foadsf,
As often the users have already an installation of Scotch
, I prefer let them the choice of the scotch package that they want to link with Mmg.
But thank you for your feedback,
Regards,
Algiane
Following the discussion here an alternative option would be to add scotch to some of the popular package managers such as Conan and Vcpkg. for now, I will use the -D USE__SCOTCH=OFF
option to avoid the annoying warning.