gbaudic/guisan

Appveyor build

Closed this issue · 2 comments

Make the library build successfully on Appveyor. At the time of this writing, I am already able to build it locally with MSYS2, but the distant build is giving me headaches.

Solved after 16 attempts by 2cbd665

I am leaving this here as future reference for anyone struggling with the same issue, in the hope that it will get indexed by search engines.

Here is your issue:

  • your software needs pkg-config to find dependencies
  • you are using MSYS2 on Appveyor

It turns out that the MSYS2 platform offered by Appveyor already comes with a lot of preinstalled software. In our case, both packages pkg-config and mingw-w64-x86_64-pkg-config are available. The former is the MSYS version, and outputs Unix-like file paths. The latter is the MINGW64 version, and outputs Windows file paths. For our use case (compiling guisan in msys for further use), we need simultaneously to use the MINGW64 version of the environment (otherwise the C++ linker will complain about a missing lmingw32 library) and a version of pkg-config which outputs Unix-like paths.

My solution is as follows:

  • somewhere in your appveyor.yml build, set the MSYSTEM environment variable to the correct value:

      - set MSYSTEM=MINGW64
    
  • remove the conflicting version of pkg-config for our use case. Put this instruction as late as possible in your list of install instructions, because the metapackage mingw-w64-x86_64-toolchain will reinstall it.

      - bash -lc "pacman -R --noconfirm mingw-w64-x86_64-pkg-config"
    
  • edit the path for pkg-config to use the nonstandard location used in MSYS2

      - bash -lc "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/mingw64/lib/pkgconfig; <your_calls_using_pkg-config _here>"
    

Hope this helps someone...