Windows build error penfhe

I am seeking assistance with an error I encountered while building OpenFHE on a Windows system using MinGW64. Below are the details of my setup and the error message.

I followed the instructions here:

Installing OpenFHE on Windows — OpenFHE documentation

Steps I followed:

  1. download MSYS2
  2. start MSYS2 MINGW64
  3. pacman –Syu
  4. pacman –S mingw-w64-x86_64-gcc
  5. pacman –S mingw-w64-x86_64-cmake
  6. pacman –S make
  7. pcaman –S git
  8. git clone GitHub - openfheorg/openfhe-development: This is the development repository for the OpenFHE library. The current (stable) version is v1.2.0 (released on June 25, 2024).
  9. cd openfhe-development
  10. mkdir build
  11. cd build
  12. cmake … (something reports ‘failed’)
  13. pacman -S autoconf
  14. make –j

Error Message: While running the make command, I encountered the following error:

In file included from C:/msys64/mingw64/include/c++/14.1.0/bits/stl_uninitialized.h:63,
from C:/msys64/mingw64/include/c++/14.1.0/memory:69,
from C:/msys64/home/TechSavyy/openfhe-development/src/pke/include/encoding/coefpackedencoding.h:40,
from C:/msys64/home/TechSavyy/openfhe-development/src/pke/lib/encoding/coefpackedencoding.cpp:36:
In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = long long unsigned int; _Up = long long unsigned int; bool _IsMove = false]’,
inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = long long unsigned int*; _OI = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_algobase.h:521:30,
inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = long long unsigned int*; _OI = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_algobase.h:548:42,
inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = long long unsigned int*; _OI = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_algobase.h:555:31,
inlined from ‘std::copy(_II, _II, _OI) [with _II = long long unsigned int*; _OI = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_algobase.h:651:7,
inlined from ‘static _ForwardIterator std::__uninitialized_copy::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = long long unsigned int*; _ForwardIterator = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_uninitialized.h:147:27,
inlined from ‘std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = long long unsigned int*; _ForwardIterator = long long unsigned int*]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_uninitialized.h:185:15,
inlined from ‘std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = long long unsigned int*; _ForwardIterator = long long unsigned int*; _Tp = long long unsigned int]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/stl_uninitialized.h:373:37,
inlined from ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long unsigned int; _Alloc = std::allocator]’ at C:/msys64/mingw64/include/c++/14.1.0/bits/vector.tcc:257:35,
inlined from ‘bigintdyn::ubint<limb_t>& bigintdyn::ubint<limb_t>::operator=(const bigintdyn::ubint<limb_t>&) [with limb_t = long long unsigned int]’ at C:/msys64/home/TechSavyy/openfhe-development/src/core/include/math/hal/bigintdyn/ubintdyn.h:230:17,
inlined from ‘void lbcrypto::encodeVec(P&, const PlaintextModulus&, int64_t, int64_t, const std::vector&, SCHEME) [with P = PolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > >]’ at C:/msys64/home/TechSavyy/openfhe-development/src/pke/lib/encoding/coefpackedencoding.cpp:67:17,
inlined from ‘virtual bool lbcrypto::CoefPackedEncoding::Encode()’ at C:/msys64/home/TechSavyy/openfhe-development/src/pke/lib/encoding/coefpackedencoding.cpp:85:18:
C:/msys64/mingw64/include/c++/14.1.0/bits/stl_algobase.h:452:30: error: ‘void* __builtin_memmove(void*, const void*, long long unsigned int)’ forming offset 8 is out of the bounds [0, 8] [-Werror=array-bounds=]
452 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
| ~^~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: all warnings being treated as errors
make[2]: *** [src/pke/CMakeFiles/pkeobj.dir/build.make:167: src/pke/CMakeFiles/pkeobj.dir/lib/encoding/coefpackedencoding.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:841: src/pke/CMakeFiles/pkeobj.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Could anyone provide guidance on how to resolve this error? Any help or pointers would be greatly appreciated.

@techman You can link OpenFHE v1.2 with g+±12 or any earlier version. We will address all g+±14 errors in the next release. Meanwhile, you can obtain older versions of MSYS2 here.

Hi Guys,
I have resolved the issue. I would like to add that obtaining old older versions of MSYS2 would not resolve the issue if you execute the command pacman -Syu. In my case it reverts back to g++14. So, you should ignore that command to resolve the issue.

hey, could you elaborate on what the solution is, I might have the same issue

See how this was solved here

Get an old version: I used this: msys2-x86_64-20230318.exe

and then follow these steps:
I followed the instructions here:

Installing OpenFHE on Windows — OpenFHE documentation

Steps I followed:

  1. Install an old version of MSYS2
  2. Admin run MSYS2 MINGW64
  3. pacman –S mingw-w64-x86_64-gcc
  4. pacman –S mingw-w64-x86_64-cmake
  5. pacman –S make
  6. pcaman –S git
  7. git clone GitHub - openfheorg/openfhe-development: This is the development repository for the OpenFHE library. The current (stable) version is v1.2.0 (released on June 25, 2024).
  8. cd openfhe-development
  9. mkdir build
  10. cd build
  11. cmake …
  12. pacman -S autoconf
  13. make –j