zerotier / ZeroTierOne

A Smart Ethernet Switch for Earth
https://zerotier.com
Other
14.57k stars 1.71k forks source link

BSDEthernetTap build failure on OpenBSD #2397

Closed juanpeha closed 1 week ago

juanpeha commented 3 weeks ago

ZeroTier 1.14.2 fails to build on OpenBSD 7.6.

$ gmake
clang++ -O3 -fstack-protector -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread -isystem ext -Iext/prometheus-cpp-lite-1.0/core/include -Iext/prometheus-cpp-lite-1.0/simpleapi/include -DNDEBUG -DZT_USE_X64_ASM_SALSA2012 -DZT_BUILD_PLATFORM=9 -DZT_BUILD_ARCHITECTURE=2 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -std=c++17    -c -o osdep/EthernetTap.o osdep/EthernetTap.cpp
osdep/EthernetTap.cpp:143:42: error: no matching constructor for initialization of 'BSDEthernetTap'
        return std::shared_ptr<EthernetTap>(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg));
                                                ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
osdep/BSDEthernetTap.hpp:36:2: note: candidate constructor not viable: requires 10 arguments, but 8 were provided
        BSDEthernetTap(
        ^
osdep/BSDEthernetTap.hpp:33:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 8 were provided
class BSDEthernetTap : public EthernetTap
      ^
1 error generated.
gmake: *** [<builtin>: osdep/EthernetTap.o] Error 1

1.14.0 is building fine, but 1.14.1 does not.

joseph-henry commented 1 week ago

Thanks for the report. Some of the arguments for the tap weren't added for OpenBSD. PR #2405 should fix it. Re-open this if not.

juanpeha commented 1 week ago

Thank you very much for having a look at this, looks like there's an additional issue a bit deeper as well. @joseph-henry, can't figure out how to re-open issue here. Hope you will notice this comment.

clang++ -O3 -fstack-protector -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread -isystem ext -Iext/prometheus-cpp-lite-1.0/core/include -Iext/prometheus-cpp-lite-1.0/simpleapi/include -DNDEBUG -DZT_USE_X64_ASM_SALSA2012 -DZT_BUILD_PLATFORM=9 -DZT_BUILD_ARCHITECTURE=2 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -std=c++17    -c -o osdep/BSDEthernetTap.o osdep/BSDEthernetTap.cpp
osdep/BSDEthernetTap.cpp:78:2: warning: field '_pinning' will be initialized after field '_arg' [-Wreorder-ctor]
        _pinning(pinning),
        ^~~~~~~~~~~~~~~~~
        _concurrency(concurrency)
osdep/BSDEthernetTap.cpp:338:2: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
        std::unique(r.begin(),r.end());
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
osdep/BSDEthernetTap.cpp:393:2: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
        std::unique(newGroups.begin(),newGroups.end());
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
osdep/BSDEthernetTap.cpp:443:5: error: unknown type name 'cpu_set_t'
                                cpu_set_t cpuset;
                                ^
osdep/BSDEthernetTap.cpp:447:50: error: use of undeclared identifier 'cpu_set_t'; did you mean 'cpuset'?
                                int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset);
                                                                             ^~~~~~~~~
                                                                             cpuset
osdep/BSDEthernetTap.cpp:443:15: note: 'cpuset' declared here
                                cpu_set_t cpuset;
                                          ^
3 warnings and 2 errors generated.
gmake: *** [<builtin>: osdep/BSDEthernetTap.o] Error 1