Skip to content
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

Configuration header leaked into public interface in v. 1.17.0 #291

Open
ziotom78 opened this issue Jun 29, 2022 · 8 comments
Open

Configuration header leaked into public interface in v. 1.17.0 #291

ziotom78 opened this issue Jun 29, 2022 · 8 comments

Comments

@ziotom78
Copy link

Hi, I am trying to compile the following program using libfswatch 1.17:

#include <libfswatch/c/libfswatch.h>
#include <stdio.h>

void my_callback(fsw_cevent const *const events, const unsigned int event_num, void * data) {
    puts("Called!");
}

int main() {
    // Initialize the library
    fsw_init_library();

    // Use the default monitor.
    const FSW_HANDLE handle = fsw_init_session(system_default_monitor_type);
    fsw_add_path(handle, "my/path");
    fsw_set_callback(handle, my_callback, NULL);
    fsw_start_monitor(handle);
}

I downloaded and installed the tarball for version 1.17 using the instructions found in the INSTALL file:

$ ./configure --prefix=$HOME/fswatch1.17 && make && make install

but the compiler complains about a missing libfswatch/libfswatch_config.h:

$ gcc -o test $(pkg-config --with-path $HOME/fswatch1.17/lib/pkgconfig --cflags --libs libfswatch) test.c
/home/tomasi/fswatch1.17/include/libfswatch/c/libfswatch_types.h:31:10: fatal error: libfswatch/libfswatch_config.h: No such file or directory
   31 | #include "libfswatch/libfswatch_config.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
$

However, the very same program compiles correctly if I install the tarball for version 1.16 and use it instead of 1.17:

$ gcc -o test $(pkg-config --with-path $HOME/fswatch1.16/lib/pkgconfig --cflags --libs libfswatch) test.c
$

It seems that the file libfswatch_types.h needs to include libfswatch_config.h because of this commit, but the file does not get installed by default.

@emcrisostomo
Copy link
Owner

Thanks @ziotom78, I'll have a look at it

@randrej
Copy link

randrej commented Jun 30, 2022

My project also fails to build because of this bug. It's present in the AUR build.

@emcrisostomo
Copy link
Owner

Actually, that file (a configuration header) should not be visible in an public interface header. It's correct that the configuration header does not get installed. I'll patch this, thanks for the report.

@emcrisostomo
Copy link
Owner

emcrisostomo commented Jul 1, 2022

I've updated that header. I've tried to compile your program locally @ziotom78 and it's working. Would you folks be willing. to test it before I merge it into master? Here's the candidate release tarball.
fswatch-1.17.1.tar.gz

@emcrisostomo emcrisostomo changed the title Unable to compile a simple example with version 1.17 Configuration header leaked into public interface in v. 1.17.0 Jul 1, 2022
@ziotom78
Copy link
Author

ziotom78 commented Jul 1, 2022

Hi @emcrisostomo , thanks, I can confirm that the problem is solved in version 1.17.1.

Thanks a lot!

@emcrisostomo
Copy link
Owner

Thanks for trying it out so quickly. I'm closing this and will merge to master.

@meator
Copy link

meator commented Aug 29, 2022

Hi. I think I might be getting the same error for C++ binding of libfswatch of version 1.17.1.

In file included from main.cpp:1:
<PREFIX>/lib/include/libfswatch/c++/monitor.hpp:33:12: fatal error: libfswatch/libfswatch_config.h: No such file or directory
   33 | #  include "libfswatch/libfswatch_config.h"
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

@emcrisostomo
Copy link
Owner

Yes, it's correct, thanks for pointing that out @meator

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

4 participants