Skip to content

Get compile err with fswatch-1.18.3, please have a watch of this #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Staok opened this issue May 10, 2025 · 9 comments
Open

Get compile err with fswatch-1.18.3, please have a watch of this #344

Staok opened this issue May 10, 2025 · 9 comments

Comments

@Staok
Copy link

Staok commented May 10, 2025

MSYS2 ucrt env, win10, use gcc/g++, run in cmd:

./configure --prefix=<path/to/build> CC=gcc CXX=g++
make

get this:

Image

And I am tired, why not just put lib package into msys2 or something, I beleve most of people don't like compile everything by self...we use it, not play the compile process

@Staok Staok changed the title Get compile err with fswatch-1.18.3 Get compile err with fswatch-1.18.3, please have a watch of this May 10, 2025
@PolarGoose
Copy link

PolarGoose commented May 30, 2025

Unfortunately, even if you manage to build the binary using MSYS2, it will not work. I have tried. The resulting binary hangs when you press Ctrl+C. I think something is wrong with the MSYS2 POSIX implementation. I haven't investigated, because Cygwin works properly.

You don't need to build the binary yourself, please look at: #346

@Staok
Copy link
Author

Staok commented May 30, 2025

Unfortunately, even if you manage to build the binary using MSYS2, it will not work. I have tried. The resulting binary hangs when you press Ctrl+C. I think something is wrong with the MSYS2 POSIX implementation. I haven't investigated, because Cygwin works properly.

You don't need to build the binary yourself, please look at: #346

You know what, I want the lib .so or .a for programming and compile with my proj, a cli bin is not good to play with coding. And, from the err result of compilation I post above, its put a fs:path pass to a std::string, that sure err in gcc/mingw... so, the idea of this lib is pretty good, but ...

@PolarGoose
Copy link

PolarGoose commented May 30, 2025

Ok, sorry, I didn't know that you were trying to build only a library, because you are running make and it is building the whole codebase.

If you want to build only libfswatch, then you can do the following:

  • Run C:\msys64\ucrt64.exe
  • Execute the commands
pacman --sync --sysupgrade --refresh --noconfirm
pacman --sync --needed --noconfirm gcc base-devel cmake git autotools make gettext gettext-devel

git clone --branch 1.18.3 --depth 1 https://github.com/emcrisostomo/fswatch.git
cd fswatch
mkdir build
cd build
cmake .. -D BUILD_LIBS_ONLY=ON -D CMAKE_BUILD_TYPE=Release
make

By the way, you can just use C# FileSystemWatcher or Python watchfiles library. Is there any reason to use libfswatch?

@Staok
Copy link
Author

Staok commented May 30, 2025

Are we use the same things? I tried the very first way of mine(run ./configure), and your ways(cmake ..), and other several ways , they all not reach the lib compile output...I am tired again as the first time I write the issue..

for your way: running in cmd:

cmake .. -D BUILD_LIBS_ONLY=ON -D CMAKE_BUILD_TYPE=Release

the source code not have this BUILD_LIBS_ONLY, I got these msg from cmake:

CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_LIBS_ONLY

-- Build files have been written to: D:/toolchain/temp/fswatch/build

I ignore it and run make, guess what? there is no the Makefile in the build dir,
Because no '-G' for cmake, so cmake default use ninja as the generator, so get these msg from make:

make: *** No targets specified and no makefile found.  Stop.

——————————————————————————————

Try use cmake-gui to run the CMakeLists.txt of fswatch dir that using git downloaded you mentioned above, and use make, get the same result:

Image

@PolarGoose
Copy link

PolarGoose commented May 30, 2025

Ok, apparently the BUILD_LIBS_ONLY is only available if you clone master branch.
Anyway, it is not needed.

Run make libfswatch instead of make.
Also, make sure you follow the instructions that I provided.

To be honest, I think you are just wasting your time. What problem do you try to solve by using libfswatch?

@Staok
Copy link
Author

Staok commented May 30, 2025

The reason I use libfswatch is that need to integrate it into my program, and more flexible by using its APIs, to watch the filesystem changings. And I think this is also the wide way that people using this project, its not like a 'cp' or 'top' the basic cli tool, its more like a basic program lib for programing. And, I am looking for one lib that cross platforms that watch filesystem, not only for win, but win and linux both.

@PolarGoose
Copy link

PolarGoose commented May 30, 2025

@Staok,

If you need file system watching functionality and you really want C++, then why don't you use efsw, which is much easier to integrate (just use Conan or Vcpkg package manager)

@Staok
Copy link
Author

Staok commented May 30, 2025

@Staok,

If you need file system watching functionality and you really want C++, then why don't you use efsw, which is much easier to integrate (just use Conan or Vcpkg package manager)

OK, I will try efsw. But the hard of compile this lib is exists, the compile err exists above I post..

@Staok
Copy link
Author

Staok commented May 30, 2025

https://packages.msys2.org/base/mingw-w64-fswatch

And guess what? I found that MSYS2's fswatch packages though not provide sort of 'pkg-config' package, but installed the lib bin file liblibfswatch.dll.a, and head files ucrt64/include/libfswatch. So I just direct use them:
cmake:

target_link_libraries(${PROJECT_NAME} PRIVATE
    libfswatch
)

and in program include the head file(C APIs):

#include "libfswatch/c/libfswatch.h"

And everything of this lib can worked...

Why not provide the libfswatch.pc or libfswatchConfig.cmake files for us to use pkg_check_modules or find_package to link lib into our projects. There are many unusual things here, from compilation to link lib..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants