emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
4.96k stars 327 forks source link

[Msys2+MinGW64] The select function cannot be found. #283

Open SineStriker opened 2 years ago

SineStriker commented 2 years ago

I try to use msys and mingw-64 to run the configue process, which fails at

checking for std::unique_ptr<std::string>... yes
checking whether lstat correctly handles trailing slash... no
checking for modf... yes
checking for select... no
configure: error: The select function cannot be found.

It seems that a similar failure with realpath api has been reported and then fixed. But here comes the new problem.

SamuelMarks commented 2 years ago

@SineStriker Working on it - https://discourse.cmake.org/t/system-is-unknown-to-cmake-create-platform-mingw64-nt-10-0-19044/4734 - I think once it works with CMake (supported since 3.21 https://cmake.org/cmake/help/latest/release/3.21.html) then everything else will just work

wessven commented 8 months ago

I'm getting the same error. My setup:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Neon
Description:    KDE neon 5.27
Release:        22.04
Codename:       jammy

$ cmake --version
cmake version 3.27.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 10-win32 20220113
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SamuelMarks commented 8 months ago

@wessven New computer so trying to replicate on ba411e0:

$ pacman -S base-devel gcc git autotools gettext gettext-devel libtool automake doxygen cmake
$ autoreconf -fi
$ ./configure
$ make -j distcheck
# Errors about LaTeX not being installed
$ make -C fswatch
make[1]: *** No rule to make target '../../libfswatch/src/libfswatch.la', needed by 'fswatch.exe'.  Stop.
# 

After I did:

diff --git a/configure.ac b/configure.ac
index fd2ddc9..e92751b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,9 @@ AM_CONDITIONAL([HAVE_MAKEINFO], [test -n "${MAKEINFO_PROG}"])

 # Initialize gettext.
 AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.19.4])
+AM_GNU_GETTEXT_VERSION([0.19.6])
+AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
+
 AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])

 # Configure C++ compiler

PS: On the cmake side also in the MSYS2 MINGW64 terminal:

MINGW64 fswatch/build
$ cmake ..
$ cmake --build .
[ 87%] Built target libfswatch
[ 90%] Building CXX object fswatch/src/CMakeFiles/fswatch.dir/fswatch.cpp.o
/home/samue/repos/fswatch/fswatch/src/fswatch.cpp: In function ‘int main(int, char**)’:
/home/samue/repos/fswatch/fswatch/src/fswatch.cpp:868:27: error: ‘LOCALEDIR’ was not declared in this scope
  868 |   bindtextdomain(PACKAGE, LOCALEDIR);
      |                           ^~~~~~~~~
make[2]: *** [fswatch/src/CMakeFiles/fswatch.dir/build.make:76: fswatch/src/CMakeFiles/fswatch.dir/fswatch.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:215: fswatch/src/CMakeFiles/fswatch.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Really wanted it to work, so just hacked in these two lines; for a PR use the proper target or include a header that already defines it:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb82189..5c1c486 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,8 @@
 #
 cmake_minimum_required(VERSION 3.8)
 project(fswatch VERSION 1.17.1 LANGUAGES C CXX)
+include(GNUInstallDirs)
+add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}")

 #@formatter:off
 set(PACKAGE           "${PROJECT_NAME}")

Which gives the nice:

[ 87%] Linking CXX static library libfswatch.a
[ 87%] Built target libfswatch
[ 90%] Building CXX object fswatch/src/CMakeFiles/fswatch.dir/fswatch.cpp.o
[ 93%] Linking CXX executable fswatch.exe
[ 93%] Built target fswatch
[ 96%] Building C object test/src/CMakeFiles/fswatch_test.dir/fswatch_test.c.o
[100%] Linking CXX executable fswatch_test.exe
[100%] Built target fswatch_test