Browse Source

Fix sysctl and CI on FreeBSD

default_compile_flags
vector-of-bool 3 years ago
parent
commit
66753f023e
2 changed files with 17 additions and 7 deletions
  1. +11
    -7
      src/dds/cli/cmd/install_yourself.cpp
  2. +6
    -0
      tools/dds_ci/toolchain.py

+ 11
- 7
src/dds/cli/cmd/install_yourself.cpp View File

#ifdef __APPLE__ #ifdef __APPLE__
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#elif __FreeBSD__ #elif __FreeBSD__
#include <sys/types.h>
// <sys/types.h> must come first
#include <sys/sysctl.h> #include <sys/sysctl.h>
#elif _WIN32 #elif _WIN32
#include <windows.h> #include <windows.h>
return fs::canonical(buffer); return fs::canonical(buffer);
#elif __FreeBSD__ #elif __FreeBSD__
std::string buffer; std::string buffer;
int mib[] = {CTRL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
std::size_t len = 0;
auto rc = ::sysctl(mib, 4, nullptr, &len, nullptr, 0);
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
std::size_t len = 0;
auto rc = ::sysctl(mib, 4, nullptr, &len, nullptr, 0);
auto errno_ = errno;
neo_assert(invariant, neo_assert(invariant,
rc == 0, rc == 0,
"Unexpected error from ::sysctl() while getting executable path", "Unexpected error from ::sysctl() while getting executable path",
errno);
errno_);
buffer.resize(len + 1); buffer.resize(len + 1);
rc = ::sysctl(mib, 4, buffer.data(), &len, nullptr, 0);
rc = ::sysctl(mib, 4, buffer.data(), &len, nullptr, 0);
errno_ = errno;
neo_assert(invariant, neo_assert(invariant,
rc == 0, rc == 0,
"Unexpected error from ::sysctl() while getting executable path", "Unexpected error from ::sysctl() while getting executable path",
errno);
return fs::canonical(nullptr);
errno_);
return fs::canonical(buffer);
#elif _WIN32 #elif _WIN32
std::wstring buffer; std::wstring buffer;
while (true) { while (true) {

+ 6
- 0
tools/dds_ci/toolchain.py View File

return paths.TOOLS_DIR / 'gcc-9-audit.jsonc' return paths.TOOLS_DIR / 'gcc-9-audit.jsonc'
if sys.platform == 'darwin': if sys.platform == 'darwin':
return paths.TOOLS_DIR / 'gcc-9-audit-macos.jsonc' return paths.TOOLS_DIR / 'gcc-9-audit-macos.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})') raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')




return paths.TESTS_DIR / 'msvc.tc.jsonc' return paths.TESTS_DIR / 'msvc.tc.jsonc'
if sys.platform in ('linux', 'darwin'): if sys.platform in ('linux', 'darwin'):
return paths.TESTS_DIR / 'gcc-9.tc.jsonc' return paths.TESTS_DIR / 'gcc-9.tc.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})') raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')




return paths.TOOLS_DIR / 'gcc-9-rel.jsonc' return paths.TOOLS_DIR / 'gcc-9-rel.jsonc'
if sys.platform == 'darwin': if sys.platform == 'darwin':
return paths.TOOLS_DIR / 'gcc-9-rel-macos.jsonc' return paths.TOOLS_DIR / 'gcc-9-rel-macos.jsonc'
if sys.platform == 'freebsd11':
return paths.TOOLS_DIR / 'freebsd-gcc-10.jsonc'
raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})') raise RuntimeError(f'Unable to determine the default toolchain (sys.platform is {sys.platform!r})')

Loading…
Cancel
Save