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
5.05k stars 330 forks source link

realpath on mingw-w64 #121

Open jeroen opened 8 years ago

jeroen commented 8 years ago

Trying to build on windows with msys2 (mingw-w64) fails with:

checking for working strtod... yes
checking for atexit... yes
checking for realpath... no
configure: error: The realpath function cannot be found.

From what I understand from this issue, realpath is actually not a standard ansi/posix function and therefore mingw-w64 does not implement it.

This topic seems to have a working version of realpath for windows. Perhaps we could include that within a #ifdef win32 or so?

emcrisostomo commented 8 years ago

Working on feature/windows-realpath.

gaborcsardi commented 8 years ago

@emcrisostomo You mean that it works already, or that you are working on it? :) Thanks!

emcrisostomo commented 8 years ago

Hi @gaborcsardi, you're welcome. It means that I'm working on it on that branch.

emcrisostomo commented 8 years ago

Hi MinGW users, would you mind trying to build the feature/windows-realpath branch?

gaborcsardi commented 8 years ago

@emcrisostomo Thanks! It is improving I believe, I get now:

checking whether lstat correctly handles trailing slash... no
checking for modf... yes
checking for regcomp... no
configure: error: The regcomp function cannot be found.
configure: error: ./configure failed for libfswatch

I don't know if msys2 has regcomp.

gaborcsardi commented 8 years ago

Maybe it is in glib2, trying now....

gaborcsardi commented 8 years ago

Unfortunately not. Anyway, thanks for the fix, that takes us one step closer.

allidev commented 7 years ago

It seems that c++11 has std::regex that can easily replace the regcomp function in the code. We should be able to get around this error. I am going to take a crack at this and file a PR when I am done.

emcrisostomo commented 7 years ago

Hi @allidev, regcomp is not what it's blocking this issue to proceed.

Also, take into account that the fact that we use regcomp instead of the <regex> library is that there was (is?) no support in all the platform I tested with and would like to support. gcc, for example, shipped the first implementation in 4.9. That's also why I'm not using any newer C++ standard

Hence: I do not believe much on the value of using <regex>, and take this into account:

If that doesn't happen, with a special emphasis on the portability check, the PR is not going to be merged.

allidev commented 7 years ago

@emcrisostomo, I understand your concern. In fact, in filter.cpp, you do use <regex>, so it seems that the value of using <regex> has been validated in the current codebase. Maybe I am missing something.

emcrisostomo commented 7 years ago

@allidev You're right, I had completely forgotten about it. Thanks.

emcrisostomo commented 7 years ago

I prefer to track this one in a dedicated issue: #178

jakirkham commented 6 years ago

Have a feeling that this issue/use case ends up being a (mis)use of MSYS2 as this thread or this even older thread suggests. That said, it looks like one might be able to #define an equivalent function to realpath. Admittedly that is quite old code that may need to be retested.

jakirkham commented 6 years ago

Also I believe regcomp and friends are available in pcre. So that would be another option to consider.

ulrikstrid commented 5 years ago

Is there any movement here? I saw that #214 had some solution, can parts of that be added in the repo?

As someone that have not done much c/c++-programming, is there something I can do to help move this forward?