Unresonable checks of Linux headers, while running CMake on FreeBSD 13

I am experiencing some inappropriate behavior of CMake (apparently cause of both lack of platform specific patch and due to a need to re-write project specific build rules).

Some headers have no sense on BSD systems. The current issue is more about specifically kqueue versus epoll headers.

I wasn’t to reference Github’s issue directly - but an opened one has an ID 42282.

So while building gollvm (FreeBSD 13.0, x86_64) I got this:

CMake Error at tools/gollvm/cmake/modules/AutoGenGo.cmake:389 (message):
*** struct epoll_event data.fd offset unknown
Call Stack (most recent call first):
tools/gollvm/libgo/CMakeLists.txt:323 (mkepoll)
This shouldn’t be even considered, since epoll is present on Linux (but not on FreeBSD).
Instead it has check for kqueue.
The above Github issue contains the list of libgo’s source files, some which depend on kqueue.
Despite the fact that gollvm project has CMake’s configuration as a replacement of “configure” and autotools - ensuring that libgo’s C files would compiled, by probing via some dummy, should be enough.
I wouldn’t expect anything expect an abort, if the probed sample source file wouldn’t compile.

These are the issues you are referring to:

This looks like a libgo CMakeLists.txt issue and not an issue with CMake itself AFAIK.

I see that this script is working, on FreeBSD 12.0 Aarch64:


$ git clone GitHub - skroll/cmake-modules: A collection of CMake modules to simplify projects.
Cloning into ‘cmake-modules’…
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 24 (delta 9), reused 24 (delta 9), pack-reused 0
Receiving objects: 100% (24/24), done.
Resolving deltas: 100% (9/9), done.
$ cd cmake-modules
$ ls
CMakeLists.txt README.md modules
$ mkdir build
$ cd build
$ cmake …
– The C compiler identification is Clang 8.0.1
– The CXX compiler identification is Clang 8.0.1
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of

Update the VERSION argument value or use a … suffix to tell
CMake that the project does not need compatibility with older versions.

– Check if the system supports kqueue
– Looking for kqueue
– Looking for kqueue - found
– Check if the system supports kqueue - yes
– Check if the system supports epoll
– Looking for epoll_create
– Looking for epoll_create - not found
– Check if the system supports epoll - no
– Configuring done
– Generating done
– Build files have been written to: /usr/home/oceanfish81/cmake-modules/build

$ uname -a
FreeBSD ams1-c1-large-arm-01 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC arm64

I don’t see checking any headers in that log.
But if you’re referring to the “epoll” - it’s not CMake itself - it’s the project that decides to check for it. From the other hand this is the role of this system - to check for stuff and setup build accordingly.