Netmap build fails under Zeek 4.0.0-RC3

HI all,

When I try to build bro-netmap in a FreeBSD13-STABLE host resturns me a lot of errors:

=== STDERR ===
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:2:
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.h:10:33: warning: 'Plugin' is deprecated: Remove in v4.1. Use zeek::plugin::Plugin instead [-Wdeprecated-declarations]
class Plugin : public ::plugin::Plugin
                                ^
/opt/zeek/include/zeek/plugin/Plugin.h:909:16: note: 'Plugin' has been explicitly marked deprecated here
using Plugin [[deprecated("Remove in v4.1. Use zeek::plugin::Plugin instead")]] = zeek::plugin::Plugin;
               ^
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:2:
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.h:14:18: warning: 'Configuration' is deprecated: Remove in v4.1. Use zeek::plugin::Configuration instead [-Wdeprecated-declarations]
        virtual plugin::Configuration Configure();
                        ^
/opt/zeek/include/zeek/plugin/Plugin.h:905:23: note: 'Configuration' has been explicitly marked deprecated here
using Configuration [[deprecated("Remove in v4.1. Use zeek::plugin::Configuration instead")]] = zeek::plugin::Configuration;
                      ^
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:3:
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Netmap.h:9:
In file included from /usr/include/net/netmap_user.h:104:
In file included from /usr/include/net/netmap.h:814:
/usr/include/stdatomic.h:186:17: error: unknown type name '_Bool'
typedef _Atomic(_Bool) atomic_bool;
                ^
/usr/include/stdatomic.h:186:26: error: C++ requires a type specifier for all declarations
typedef _Atomic(_Bool) atomic_bool;
~~~~~~~ ^
/usr/include/stdatomic.h:378:17: error: unknown type name '_Bool'
static __inline _Bool
                ^
/usr/include/stdatomic.h:382:10: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile atomic_bool *' (aka 'volatile int *') invalid)
        return (atomic_exchange_explicit(&__object->__flag, 1, __order));
                ^ ~~~~~~~~~~~~~~~~~
/usr/include/stdatomic.h:242:2: note: expanded from macro 'atomic_exchange_explicit'
        __c11_atomic_exchange(object, desired, order)
        ^ ~~~~~~
/usr/include/stdatomic.h:389:2: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile atomic_bool *' (aka 'volatile int *') invalid)
        atomic_store_explicit(&__object->__flag, 0, __order);
        ^ ~~~~~~~~~~~~~~~~~
/usr/include/stdatomic.h:256:2: note: expanded from macro 'atomic_store_explicit'
        __c11_atomic_store(object, desired, order)
        ^ ~~~~~~
/usr/include/stdatomic.h:393:17: error: unknown type name '_Bool'
static __inline _Bool
                ^
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:3:
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Netmap.h:17:39: warning: 'PktSrc' is deprecated: Remove in v4.1. Use zeek::iosource::PktSrc. [-Wdeprecated-declarations]
class NetmapSource : public iosource::PktSrc {
                                      ^
/opt/zeek/include/zeek/iosource/PktSrc.h:372:16: note: 'PktSrc' has been explicitly marked deprecated here
using PktSrc [[deprecated("Remove in v4.1. Use zeek::iosource::PktSrc.")]] = zeek::iosource::PktSrc;
               ^
In file included from /root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:3:
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Netmap.h:45:33: warning: 'Packet' is deprecated: Remove in v4.1. Use zeek::Packet. [-Wdeprecated-declarations]
        virtual bool ExtractNextPacket(Packet* pkt);
                                       ^
/opt/zeek/include/zeek/iosource/Packet.h:251:16: note: 'Packet' has been explicitly marked deprecated here
using Packet [[deprecated("Remove in v4.1. Use zeek::Packet.")]] = zeek::Packet;
               ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:10:9: warning: 'Configuration' is deprecated: Remove in v4.1. Use zeek::plugin::Configuration instead [-Wdeprecated-declarations]
plugin::Configuration Plugin::Configure()
        ^
/opt/zeek/include/zeek/plugin/Plugin.h:905:23: note: 'Configuration' has been explicitly marked deprecated here
using Configuration [[deprecated("Remove in v4.1. Use zeek::plugin::Configuration instead")]] = zeek::plugin::Configuration;
                      ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:12:31: warning: 'PktSrcComponent' is deprecated: Remove in v4.1. Use zeek::iosource::PktSrcComponent. [-Wdeprecated-declarations]
        AddComponent(new ::iosource::PktSrcComponent("NetmapReader", "netmap", ::iosource::PktSrcComponent::LIVE, ::iosource::pktsrc::NetmapSource::InstantiateNetmap));
                                     ^
/opt/zeek/include/zeek/iosource/Component.h:175:25: note: 'PktSrcComponent' has been explicitly marked deprecated here
using PktSrcComponent [[deprecated("Remove in v4.1. Use zeek::iosource::PktSrcComponent.")]] = zeek::iosource::PktSrcComponent;
                        ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:12:100: warning: 'PktSrcComponent' is deprecated: Remove in v4.1. Use zeek::iosource::PktSrcComponent. [-Wdeprecated-declarations]
        AddComponent(new ::iosource::PktSrcComponent("NetmapReader", "netmap", ::iosource::PktSrcComponent::LIVE, ::iosource::pktsrc::NetmapSource::InstantiateNetmap));
                                                                                                          ^
/opt/zeek/include/zeek/iosource/Component.h:175:25: note: 'PktSrcComponent' has been explicitly marked deprecated here
using PktSrcComponent [[deprecated("Remove in v4.1. Use zeek::iosource::PktSrcComponent.")]] = zeek::iosource::PktSrcComponent;
                        ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:13:31: warning: 'PktSrcComponent' is deprecated: Remove in v4.1. Use zeek::iosource::PktSrcComponent. [-Wdeprecated-declarations]
        AddComponent(new ::iosource::PktSrcComponent("NetmapReader", "vale", ::iosource::PktSrcComponent::LIVE, ::iosource::pktsrc::NetmapSource::InstantiateVale));
                                     ^
/opt/zeek/include/zeek/iosource/Component.h:175:25: note: 'PktSrcComponent' has been explicitly marked deprecated here
using PktSrcComponent [[deprecated("Remove in v4.1. Use zeek::iosource::PktSrcComponent.")]] = zeek::iosource::PktSrcComponent;
                        ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:13:98: warning: 'PktSrcComponent' is deprecated: Remove in v4.1. Use zeek::iosource::PktSrcComponent. [-Wdeprecated-declarations]
        AddComponent(new ::iosource::PktSrcComponent("NetmapReader", "vale", ::iosource::PktSrcComponent::LIVE, ::iosource::pktsrc::NetmapSource::InstantiateVale));
                                                                                                        ^
/opt/zeek/include/zeek/iosource/Component.h:175:25: note: 'PktSrcComponent' has been explicitly marked deprecated here
using PktSrcComponent [[deprecated("Remove in v4.1. Use zeek::iosource::PktSrcComponent.")]] = zeek::iosource::PktSrcComponent;
                        ^
/root/.zkg/testing/bro-netmap/clones/bro-netmap/src/Plugin.cc:15:10: warning: 'Configuration' is deprecated: Remove in v4.1. Use zeek::plugin::Configuration instead [-Wdeprecated-declarations]
        plugin::Configuration config;
                ^
/opt/zeek/include/zeek/plugin/Plugin.h:905:23: note: 'Configuration' has been explicitly marked deprecated here
using Configuration [[deprecated("Remove in v4.1. Use zeek::plugin::Configuration instead")]] = zeek::plugin::Configuration;
                      ^
10 warnings and 6 errors generated.
=== STDOUT ===
Build Directory : build
Zeek Source Directory :
-- The C compiler identification is Clang 11.0.1
-- The CXX compiler identification is Clang 11.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
-- Performing Test cxx17_already_works
-- Performing Test cxx17_already_works - Failed
-- Performing Test cxx17_works
-- Performing Test cxx17_works - Success
-- Found BinPAC: /opt/zeek/bin/binpac
-- Found CAF: 0.18.0 found components: core io openssl
-- Found Broker: /opt/zeek/lib/libbroker.so
-- Zeek executable : /opt/zeek/bin/zeek
-- Zeek source :
-- Zeek build :
-- Zeek install prefix : /opt/zeek
-- Zeek plugin directory: /opt/zeek/lib/zeek/plugins
-- Zeek debug mode :
-- Found Netmap: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /root/.zkg/testing/bro-netmap/clones/bro-netmap/build
Scanning dependencies of target bro-plugin-Zeek_Netmap
[ 20%] Creating __bro_plugin__ for Zeek::Netmap
[ 20%] Built target bro-plugin-Zeek_Netmap
Scanning dependencies of target copy-scripts-Zeek_Netmap
[ 20%] Built target copy-scripts-Zeek_Netmap
Scanning dependencies of target generate_outputs
[ 20%] Built target generate_outputs
Scanning dependencies of target Zeek-Netmap.freebsd-amd64
[ 40%] Building CXX object CMakeFiles/Zeek-Netmap.freebsd-amd64.dir/src/Plugin.cc.o
*** Error code 1

Stop.
make[2]: stopped in /root/.zkg/testing/bro-netmap/clones/bro-netmap/build
*** Error code 1

Stop.
make[1]: stopped in /root/.zkg/testing/bro-netmap/clones/bro-netmap/build
*** Error code 1

Stop.
make: stopped in /root/.zkg/testing/bro-netmap/clones/bro-netmap/build

Will be netmap in Zeek-4.X supported for FreeBSD13?

Best regards,
C. L. Martinez

Almost all of that is warnings for stuff that will just need to be fixed before 4.1… you can ignore that for now.

The parts that are errors are the issues with stdatomic.h… Try using https://github.com/shirkdog/bro-netmap . That repo has a patch that should get it to build… I think people just wanted to test it a bit before submitting a PR for the official repo?