zip: MinGW fails compilation

Reproducing on windows 10:

  1. Install MinGW-get from https://osdn.net/projects/mingw/releases/p15522
  2. Add the mingw32-base-bin and mingw-gcc-g+±bin packages.
  3. Install cmake.
  4. Add C:\MinGW\bin to path.
  5. mkdir build, cmake .. -G "MinGW Makefiles", cmake --build . error.log

Relevant MinGW header: (https://sourceforge.net/p/mingw/mingw-org-wsl/ci/21762bb4a1bd0c88c38eead03f59e8d994349e83/tree/include/sys/types.h)

MinGW doesn’t use any defines to indicate ssize_t has been declared. I suggest we detect MinGW directly. After adding a check for MINGW32 before the ssize_t typedef, it compiles and passes mingw32-make test. patch.txt I’ll create a PR if this looks OK.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

To recap… defines of ssize_t were generally added for MSVC compiler on windows, where we don’t have POSIX support. I walked through our commits and type headers and I believe it can be simplified just to: https://github.com/kuba--/zip/pull/148

Hopefully thanks to this PR we won’t have to worry about yet another missing macro.

PTAL.