From 4fe2652c6cfe08ec5ee07623e07be7eba29f733f Mon Sep 17 00:00:00 2001 From: Naoki Ikeguchi Date: Sat, 27 Jul 2024 09:54:38 +0900 Subject: [PATCH] Fix Windows compilation (#2506) * docs: Fix Windows compile instructions Signed-off-by: Naoki Ikeguchi * fix: Use fallocate stub on MSYS2 Signed-off-by: Naoki Ikeguchi --------- Signed-off-by: Naoki Ikeguchi --- COMPILATION.md | 4 ++-- src/fdcache_entity.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/COMPILATION.md b/COMPILATION.md index 0af0429..1b05f6e 100644 --- a/COMPILATION.md +++ b/COMPILATION.md @@ -68,7 +68,7 @@ On Windows, use [MSYS2](https://www.msys2.org/) to compile for itself. 2. Install dependencies onto MSYS2: ```sh - pacman -S git autoconf automake gcc make pkg-config libopenssl-devel libcurl-devel libxml2-devel libzstd-devel + pacman -S git autoconf automake gcc make pkg-config openssl-devel libcurl-devel libxml2-devel libzstd-devel ``` 3. Clone this repository, then change directory into the cloned one. @@ -101,7 +101,7 @@ On Windows, use [MSYS2](https://www.msys2.org/) to compile for itself. ```sh ./autogen.sh PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(pwd)" ./configure - make + make CXXFLAGS="-I/usr/include" ``` 7. Copy binary files to distribute at one place: diff --git a/src/fdcache_entity.cpp b/src/fdcache_entity.cpp index 6d522c0..4b46087 100644 --- a/src/fdcache_entity.cpp +++ b/src/fdcache_entity.cpp @@ -2427,7 +2427,7 @@ int FdEntity::UploadPendingHasLock(int fd) // For systems where the fallocate function cannot be detected, use a dummy function. // ex. OSX // -#ifndef HAVE_FALLOCATE +#if !defined(HAVE_FALLOCATE) || defined(__MSYS__) static int fallocate(int /*fd*/, int /*mode*/, off_t /*offset*/, off_t /*len*/) { errno = ENOSYS; // This is a bad idea, but the caller can handle it simply.