diff --git a/deps/ox/src/ox/CMakeLists.txt b/deps/ox/src/ox/CMakeLists.txt index ecf291c4..0a4e3ed0 100644 --- a/deps/ox/src/ox/CMakeLists.txt +++ b/deps/ox/src/ox/CMakeLists.txt @@ -1,3 +1,6 @@ +set(OX_FREEBSD ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") +set(OX_LINUX ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + if(OX_USE_STDLIB) add_subdirectory(oc) endif() diff --git a/deps/ox/src/ox/fs/CMakeLists.txt b/deps/ox/src/ox/fs/CMakeLists.txt index dae9621e..0a91c7ed 100644 --- a/deps/ox/src/ox/fs/CMakeLists.txt +++ b/deps/ox/src/ox/fs/CMakeLists.txt @@ -16,7 +16,7 @@ if(NOT MSVC) endif() if(NOT OX_BARE_METAL) - if(NOT APPLE AND NOT MSVC) + if(NOT APPLE AND NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") target_link_libraries( OxFS PUBLIC stdc++fs diff --git a/deps/ox/src/ox/logconn/CMakeLists.txt b/deps/ox/src/ox/logconn/CMakeLists.txt index a416a00d..da2a1427 100644 --- a/deps/ox/src/ox/logconn/CMakeLists.txt +++ b/deps/ox/src/ox/logconn/CMakeLists.txt @@ -20,6 +20,7 @@ target_link_libraries( OxLogConn PUBLIC OxStd OxMetalClaw + $<$:pthread> ) install( diff --git a/deps/ox/src/ox/std/CMakeLists.txt b/deps/ox/src/ox/std/CMakeLists.txt index 00158a11..5fa2355c 100644 --- a/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/ox/src/ox/std/CMakeLists.txt @@ -44,7 +44,7 @@ add_library( if(NOT MSVC) target_compile_options(OxStd PRIVATE -Wsign-conversion) target_compile_options(OxStd PRIVATE -Wconversion) - if(UNIX AND NOT APPLE) + if(${OX_LINUX}) target_compile_options(OxStd PUBLIC -export-dynamic) #target_link_options(OxStd PUBLIC -W1,-E) endif() @@ -74,6 +74,7 @@ endif() target_link_libraries( OxStd PUBLIC $<$:gcc> + $<$:execinfo> OxTraceHook ) diff --git a/deps/ox/src/ox/std/stacktrace.cpp b/deps/ox/src/ox/std/stacktrace.cpp index a19ff851..f9a1f389 100644 --- a/deps/ox/src/ox/std/stacktrace.cpp +++ b/deps/ox/src/ox/std/stacktrace.cpp @@ -18,6 +18,7 @@ #endif #endif +#include "defines.hpp" #include "string.hpp" #include "trace.hpp" #include "vector.hpp" @@ -32,7 +33,12 @@ static auto symbolicate([[maybe_unused]]void **frames, using StrT = BasicString<100>; Vector out; #if __has_include() && __has_include() - const auto mangledSymbols = backtrace_symbols(frames, static_cast(frameCnt)); +#ifdef OX_OS_FreeBSD + using FrameCnt_t = unsigned; +#else + using FrameCnt_t = signed; +#endif + const auto mangledSymbols = backtrace_symbols(frames, static_cast(frameCnt)); for (auto i = 0u; i < frameCnt; ++i) { Dl_info info; if (dladdr(frames[i], &info) && info.dli_sname) { @@ -55,7 +61,12 @@ void printStackTrace([[maybe_unused]]unsigned shave) noexcept { #if defined(OX_USE_STDLIB) && __has_include() && __has_include() constexpr auto FrameCnt = 100; Vector frames(FrameCnt); - frames.resize(static_cast(backtrace(frames.data(), static_cast(frames.size())))); +#ifdef OX_OS_FreeBSD + using FrameCnt_t = unsigned; +#else + using FrameCnt_t = signed; +#endif + frames.resize(static_cast(backtrace(frames.data(), static_cast(frames.size())))); if (frames.size() - shave > 2) { const auto symbolicatedStacktrace = symbolicate(frames.data() + shave, frames.size() - shave, "\t"); oxErr("Stacktrace:\n");