zerotier / ZeroTierOne

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

Build fix for OpenBSD - See ticket #2397 #2405

Closed joseph-henry closed 1 week ago

juanpeha commented 1 week ago

Build still failing, but for a different cause:

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
joseph-henry commented 1 week ago

cpu_set_t

Thanks. I've omitted the CPU pinning code from OpenBSD builds for the time being. I'll look into what the equivalent of cpu_set_t is sometime and try to implement pinning again.

Let me know if this fixes things for you.

juanpeha commented 1 week ago

guess we're getting close, but not quite there yet:

clang++ -O3 -fstack-protector -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread -isystem ex
t -Iext/prometheus-cpp-lite-1.0/core/include -Iext/prometheus-cpp-lite-1.0/simpleapi/include -DNDEBU
G -DZT_USE_X64_ASM_SALSA2012 -DZT_BUILD_PLATFORM=9 -DZT_BUILD_ARCHITECTURE=2 -DZT_SOFTWARE_UPDATE_DE
FAULT="\"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' [-Wr
eorder-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:502:4: error: expected unqualified-id
                }));
                 ^
osdep/BSDEthernetTap.cpp:504:1: error: extraneous closing brace ('}')
}
^
osdep/BSDEthernetTap.cpp:506:1: error: extraneous closing brace ('}')
} // namespace ZeroTier
^
In file included from osdep/BSDEthernetTap.cpp:55:
osdep/BSDEthernetTap.hpp:68:15: warning: private field '_concurrency' is not used [-Wunused-private-
field]
        unsigned int _concurrency;
                     ^
osdep/BSDEthernetTap.hpp:69:7: warning: private field '_pinning' is not used [-Wunused-private-field]
        bool _pinning;
             ^
5 warnings and 3 errors generated.
gmake: *** [<builtin>: osdep/BSDEthernetTap.o] Error 1
joseph-henry commented 1 week ago

Sorry, I just don't have an OpenBSD system up right now to test compiles on. But I think this should fix it.

juanpeha commented 1 week ago

Bingo! Compiles now. Thank you very much.

joseph-henry commented 1 week ago

No problem. Thanks for validating this for us! Have a great day.