pok3rtool icon indicating copy to clipboard operation
pok3rtool copied to clipboard

[MSYS2/MinGW] Statically link libgcc and libstdc++

Open hansemro opened this issue 2 years ago • 0 comments

This commit fixes a build step for MSYS2/QMK_MSYS with MinGW-w64 toolchain by statically linking libgcc and libstdc++ (instead of copying from invalid path).

The previous method of locating libraries in reference to CMAKE_CXX_COMPILER does not work in MSYS2 environments (with mingw-w64-x86_64-toolchain toolchain package installed).

Previous method expected to find libraries in: /path_with_cxx_compiler/../x86_64-w64-mingw32/lib/

For reference, required libraries in MSYS2 (MinGW-w64) are located in: /mingw64/bin/

Install guide for Windows (with this commit):

  1. Install MSYS2 from https://www.msys2.org/
  2. Launch MSYS2 MINGW64 console and run the following:
pacman -Syu
pacman -S cmake \
        base-devel \
        mingw-w64-x86_64-toolchain \
        mingw-w64-x86_64-cmake \
        git
  1. Clone repo and build pok3rtool as normal
git clone --recursive <pok3rtool_repo>
cd pok3rtool
mkdir build
cd build
cmake ..
# build pok3rtool executable
cmake --build .
# optionally install to C:\Program Files (x86)\Pok3rtool\
cmake --install .

hansemro avatar Nov 13 '22 13:11 hansemro