Skip to content

Commit 57c0a8a

Browse files
committed
Fix Windows CI build
Recent MSYS2 updates broke the build again. It turns out libff was being built by referencing the MSYS2-installed headers instead of the GHC-bundled ones. This adjusts the build process to have libff built with the same headers as the rest of hevm.
1 parent f838735 commit 57c0a8a

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

.github/scripts/install-libff.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ git checkout "v$INSTALL_VERSION" && git submodule init && git submodule update
2121
patch -p1 < ../.github/scripts/libff.patch
2222

2323
sed -i 's/find_library(GMP_LIBRARY gmp)/find_library(GMP_LIBRARY NAMES libgmp.a)/' CMakeLists.txt
24+
# This ends up causing the system headers to be included with -I and
25+
# thus they override the GHC mingw compiler ones. So this removes it
26+
# and re-adds the include with idirafter via the toolchain file
27+
sed -i '/INCLUDE_DIRECTORIES.*OPENSSL_INCLUDE_DIR/d' CMakeLists.txt
2428
PREFIX="$HOME/.local"
25-
ARGS=("-DCMAKE_INSTALL_PREFIX=$PREFIX" "-DWITH_PROCPS=OFF" "-G" "Ninja")
29+
ARGS=("-DCMAKE_INSTALL_PREFIX=$PREFIX" "-DWITH_PROCPS=OFF" "-G" "Ninja" "-DCMAKE_TOOLCHAIN_FILE=$PWD/../.github/scripts/windows-ghc-toolchain.cmake")
2630
CXXFLAGS="-fPIC"
2731

2832
mkdir -p build
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
3+
set(CMAKE_C_COMPILER "$ENV{HASKELL_MINGW_PATH}/bin/cc.exe")
4+
set(CMAKE_CXX_COMPILER "$ENV{HASKELL_MINGW_PATH}/bin/c++.exe")
5+
6+
set(CMAKE_C_FLAGS "-idirafter D:/a/_temp/msys64/clang64/include")
7+
set(CMAKE_CXX_FLAGS "-idirafter D:/a/_temp/msys64/clang64/include")
8+
9+
set(CMAKE_FIND_ROOT_PATH "$ENV{HASKELL_MINGW_PATH}")
10+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
11+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
12+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ jobs:
160160
run: |
161161
export PATH="$HASKELL_PATHS:$PATH"
162162
cabal configure --disable-documentation --enable-executable-static --enable-executable-stripping \
163-
--extra-include-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/x86_64-w64-mingw32/include")" --extra-lib-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/x86_64-w64-mingw32/lib")" \
164-
--extra-include-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/include")" --extra-lib-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/lib")" \
165-
--extra-include-dirs="D:/a/_temp/msys64/clang64/include" --extra-lib-dirs="D:/a/_temp/msys64/clang64/lib" \
163+
--extra-lib-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/x86_64-w64-mingw32/lib")" \
164+
--extra-lib-dirs="$(cygpath -m "$HASKELL_MINGW_PATH/lib")" \
165+
--extra-lib-dirs="D:/a/_temp/msys64/clang64/lib" \
166166
--extra-include-dirs="$HOME/.local/include" --extra-lib-dirs="$HOME/.local/lib" \
167-
--ghc-options=-pgml="$(cygpath -m "$HASKELL_MINGW_PATH/bin/clang.exe")" -fstatic-secp256k1 --constraint="zlib +bundled-c-zlib"
167+
--ghc-options=-pgml="$(cygpath -m "$HASKELL_MINGW_PATH/bin/clang.exe") -optc-idirafter -optcD:/a/_temp/msys64/clang64/include -optcxx-idirafter -optcxxD:/a/_temp/msys64/clang64/include" -fstatic-secp256k1 --constraint="zlib +bundled-c-zlib"
168168
cabal build --dry-run
169169
# The last step generates dist-newstyle/cache/plan.json for the cache key.
170170

0 commit comments

Comments
 (0)