Search code examples
c++windowsgccboostmingw-w64

mFAST project fails to build with Mingw-w64(ucrt64)


I am trying to compile mFAST library on my Windows 10 system.

I am using VS Code as IDE, and GCC(ucrt64) compiler from MSYS64 to build the library.

I have installed boost using pacman -S mingw-w64-ucrt-x86_64-boost which installed all the required files in location C:\msys64\ucrt64\include\boost.

Then, in the build sub0directory, I run cmake using command cmake .. -G "Unix Makefiles" -DBOOST_ROOT="C:\msys64\ucrt64\include\boost". The output is:

The CXX compiler identification is GNU 13.2.0
Detecting CXX compiler ABI info
Check for working CXX compiler: C:/msys64/ucrt64/bin/c++.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Found Boost: C:/msys64/ucrt64/lib/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.56.0")  

CMAKE_COMMAND: C:/Program Files/CMake/bin/cmake.exe
CMAKE_SYSTEM: Windows-10.0.19045
CMAKE_SYSTEM_PROCESSOR: AMD64
CMAKE_CXX_COMPILER: C:/msys64/ucrt64/bin/c++.exe
CMAKE_CXX_FLAGS: 
CMAKE_BUILD_TYPE: Debug
BUILD_SHARED_LIBS: OFF
BUILD_TESTS: ON
BUILD_EXAMPLES: ON
BUILD_PACKAGES: ON
--
Configuring done
Generating done
Build files have been written to: D:/mFAST/build

After this step when I run make, I get following errors:

`D:/mFAST/src/mfast/decimal_ref.cpp:24:15: error: template-id 'hash_combine<boost::multiprecision::backends::cpp_dec_float<18>::enum_fpclass_type>' for 
'void boost::hash_combine(long unsigned int&, const multiprecision::backends::cpp_dec_float<18>::enum_fpclass_type&)' does not match any template declaration
24 | template void boost::hash_combine<boost::multiprecision::backends::cpp_dec_float<18u, int, void>::enum_fpclass_type>(unsigned long&, boost::multiprecision::backends::cpp_dec_float<18u, int, void>::enum_fpclass_type const&);
  |               ^~~~~
In file included from C:/msys64/ucrt64/include/boost/functional/hash.hpp:6,
             from D:/mFAST/src/mfast/decimal_ref.cpp:18:
C:/msys64/ucrt64/include/boost/container_hash/hash.hpp:561:17: note: candidate is: 'template<class T> void boost::hash_combine(std::size_t&, const T&)'    
561 |     inline void hash_combine( std::size_t& seed, T const& v )
  |                 ^~~~~~~~~~~~
D:/mFAST/src/mfast/decimal_ref.cpp:26:15: error: template-id 'hash_combine<bool>' for 'void boost::hash_combine(long unsigned int&, const bool&)' does not match any template declaration
26 | template void boost::hash_combine<bool>(unsigned long&, bool const&);

I have looked into it for a very long time and found that all the required boost files (which the compiler is not able to find) are available in the C:\msys64\ucrt64\include\boost directory.

On digging further, the line of error in file C:/msys64/ucrt64/include/boost/functional/hash.hpp:6 is #include <boost/container_hash/hash.hpp> which is present in the boost directory but somehow compiler is unable to find it.

I have come to the conclusion, which could be very wrong, that I am not able to set my boost root/installation correctly.

If anyone can help, it will be greatly appreciated. Thanks


Solution

  • I was able to build mFAST using MSVC comiler, cmake with 'Visual Studio 16 2019' Generator to be specific.

    I think mingw64 is not supported to build the mFAST project.

    Built and installed the project successfully.

    Thanks for all the ideas though.