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

Fix cmake build without automake #250

Closed
wants to merge 1 commit into from

Conversation

1whatleytay
Copy link

I want to use this as a library by including it via cmake as a git submodule! I can't right now because of how fswatch configures stuff with cmake :(

I wrote something here as to why a cmake build system would be helpful. I'd appeciate any feedback!

@tomas321
Copy link

tomas321 commented Dec 10, 2020

@1whatleytay great PR!. It's sad that this PR is not being considered (yet). Even though I applied your changes to my newly created fork and encounter a problem:

/snap/clion/137/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -G "CodeBlocks - Unix Makefiles" /home/tomas/dev/fswatch
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for include file sys/inotify.h
-- Looking for include file sys/inotify.h - found
-- Looking for include file sys/event.h
-- Looking for include file sys/event.h - not found
-- Looking for include file port.h
-- Looking for include file port.h - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tomas/dev/fswatch/cmake-build-debug

Cannot get compiler information:
	Compiler exited with error code 1: /usr/bin/g++ -xc++ -D-HAVE_STRUCT_STAT_ST_MTIMESPEC -I/home/tomas/dev/fswatch/libfswatch/.. -I/home/tomas/dev/fswatch/libfswatch/src/libfswatch -I/home/tomas/dev/fswatch/libfswatch/src -g -std=gnu++11 -fpch-preprocess -v -dD -E
	Using built-in specs.
	COLLECT_GCC=/usr/bin/g++
	OFFLOAD_TARGET_NAMES=nvptx-none
	OFFLOAD_TARGET_DEFAULT=1
	Target: x86_64-linux-gnu
	Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
	Thread model: posix
	gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 
	COLLECT_GCC_OPTIONS='-D' '-HAVE_STRUCT_STAT_ST_MTIMESPEC' '-I' '/home/tomas/dev/fswatch/libfswatch/..' '-I' '/home/tomas/dev/fswatch/libfswatch/src/libfswatch' '-I' '/home/tomas/dev/fswatch/libfswatch/src' '-g' '-std=gnu++11' '-fpch-preprocess' '-v' '-dD' '-E' '-D' '___CIDR_DEFINITIONS_END' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
	 /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -E -quiet -v -I /home/tomas/dev/fswatch/libfswatch/.. -I /home/tomas/dev/fswatch/libfswatch/src/libfswatch -I /home/tomas/dev/fswatch/libfswatch/src -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D -HAVE_STRUCT_STAT_ST_MTIMESPEC -D ___CIDR_DEFINITIONS_END /tmp/compiler-file13017098905077137266 -mtune=generic -march=x86-64 -std=gnu++11 -fpch-preprocess -g -fworking-directory -fstack-protector-strong -Wformat -Wformat-security -dD
	ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7"
	ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
	ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
	#include "..." search starts here:
	#include <...> search starts here:
	 /home/tomas/dev/fswatch/libfswatch/..
	 /home/tomas/dev/fswatch/libfswatch/src/libfswatch
	 /home/tomas/dev/fswatch/libfswatch/src
	 /usr/include/c++/7
	 /usr/include/x86_64-linux-gnu/c++/7
	 /usr/include/c++/7/backward
	 /usr/lib/gcc/x86_64-linux-gnu/7/include
	 /usr/local/include
	 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
	 /usr/include/x86_64-linux-gnu
	 /usr/include
	End of search list.
	<command-line>:0:1: error: macro names must be identifiers
	
	

[Failed to reload]

The errors weren't saying much, but after some time I found the typo in one of the files - problematic line.

There is a missing D int the option. So it should be like this - -DHAVE_STRUCT_STAT_ST_MTIMESPEC

In addition, #258 includes a crucial cmake typo. I suggest you include it to your changes to minimize the number of PRs.

After that I noticed the missing compile option when HAVE_SYS_INOTIFY_H is set to TRUE - missing code segment in libfswatch/CMakeLists.txt:

set(LIB_COMPILE_DEFINITIONS
            ${LIB_COMPILE_DEFINITIONS}
            -DHAVE_SYS_INOTIFY_H)

Hope it gets merged!

@emcrisostomo
Copy link
Owner

Hi @1whatleytay, I'd really like to get this merged. Unfortunately, I'm not maintaining the CMake build system. I lack the expertise, and I've decided to move the CMake stuff on a separate branch, in case somebody with the required expertise can have a look at it. It seems you've done a great job here. If you're feeling like having a look at this, feel free, and I'll gladly integrate the CMake support back into master.

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

Successfully merging this pull request may close these issues.

3 participants