erikzenker / inotify-cpp

A C++ interface for linux inotify
MIT License
136 stars 37 forks source link

Example cannot be built OOTB on Debian 10 Buster (cmake) #72

Closed schreiberstein closed 4 years ago

schreiberstein commented 4 years ago

Hello!

I just tried to build the example on a Debian GNU/Linux 10 Buster system (amd64), but it fails because cmake does not find a file. The file "inotify-cppTargets.cmake" is not generated by cmake, apparently. Perhaps this is an easy fix, I just think that it would be good for this example to work out-of-the-box on a popular Linux distribution.

Do you know how to fix this? Or am I doing something wrong?


cmake ../example -- Boost 1.54.0 found. CMake Error at /usr/local/lib/cmake/inotify-cpp/inotify-cppConfig.cmake:4 (include): include could not find load file:

/usr/local/lib/cmake/inotify-cpp/inotify-cppTargets.cmake Call Stack (most recent call first): CMakeLists.txt:8 (find_package)

-- Boost 1.54.0 found. -- Found Boost components: unit_test_framework;system;filesystem -- Configuring incomplete, errors occurred! See also "/home/alex/git/inotify-cpp/build-example/CMakeFiles/CMakeOutput.log". See also "/home/alex/git/inotify-cpp/build-example/CMakeFiles/CMakeError.log".

Contents of /usr/local/lib/cmake/inotify-cpp/inotify-cppConfig.cmake :

include(CMakeFindDependencyMacro) find_dependency(Boost 1.54.0)
include("${CMAKE_CURRENT_LIST_DIR}/inotify-cppTargets.cmake")

Directory listing of /usr/local/lib/cmake/inotify-cpp :

/usr/local/lib/cmake/inotify-cpp/inotify-cpp-sharedTargets-release.cmake /usr/local/lib/cmake/inotify-cpp/inotify-cpp-staticTargets.cmake /usr/local/lib/cmake/inotify-cpp/inotify-cppConfigVersion.cmake /usr/local/lib/cmake/inotify-cpp/inotify-cppConfig.cmake /usr/local/lib/cmake/inotify-cpp/inotify-cpp-sharedTargets.cmake /usr/local/lib/cmake/inotify-cpp/inotify-cppConfig.cmake~ /usr/local/lib/cmake/inotify-cpp/inotify-cpp-staticTargets-release.cmake

(It does not generate the file - even with static build disabled)


Thank you!

Best regards, schreiberstein

schreiberstein commented 4 years ago

If somebody needs a quick fix, you can attempt this: g++ -O2 -std=c++11 -lpthread -lboost_filesystem -linotify-cpp main.cpp -o inotify_example

If the library is not in the usual LD path (e.g. /usr/local), you can set this variable to make it work: export LD_LIBRARY_PATH=/usr/local/lib

erikzenker commented 4 years ago

@schreiberstein thank you for reporting the issue. I also have the issue when I follow the example. Let me work on a fix and update the documentation.

erikzenker commented 4 years ago

The readme is indeed wrong. You can build and run the example by the following commands:

mkdir build; cd build
cmake ..
cmake --build . --target inotify_example
./example/inotify_example
erikzenker commented 4 years ago

I will update the readme

erikzenker commented 4 years ago

@schreiberstein can you test if it works on your system?

schreiberstein commented 4 years ago

@schreiberstein can you test if it works on your system?

Thanks a lot! It is working now.