[ox] Fix FreeBSD build
This commit is contained in:
parent
ea266da691
commit
e5a7d8c0a9
3
deps/ox/src/ox/CMakeLists.txt
vendored
3
deps/ox/src/ox/CMakeLists.txt
vendored
@ -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()
|
||||
|
2
deps/ox/src/ox/fs/CMakeLists.txt
vendored
2
deps/ox/src/ox/fs/CMakeLists.txt
vendored
@ -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
|
||||
|
1
deps/ox/src/ox/logconn/CMakeLists.txt
vendored
1
deps/ox/src/ox/logconn/CMakeLists.txt
vendored
@ -20,6 +20,7 @@ target_link_libraries(
|
||||
OxLogConn PUBLIC
|
||||
OxStd
|
||||
OxMetalClaw
|
||||
$<$<BOOL:OX_FREEBSD>:pthread>
|
||||
)
|
||||
|
||||
install(
|
||||
|
3
deps/ox/src/ox/std/CMakeLists.txt
vendored
3
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -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
|
||||
$<$<CXX_COMPILER_ID:GNU>:gcc>
|
||||
$<$<BOOL:${OX_FREEBSD}>:execinfo>
|
||||
OxTraceHook
|
||||
)
|
||||
|
||||
|
15
deps/ox/src/ox/std/stacktrace.cpp
vendored
15
deps/ox/src/ox/std/stacktrace.cpp
vendored
@ -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<StrT, 30> out;
|
||||
#if __has_include(<cxxabi.h>) && __has_include(<execinfo.h>)
|
||||
const auto mangledSymbols = backtrace_symbols(frames, static_cast<int>(frameCnt));
|
||||
#ifdef OX_OS_FreeBSD
|
||||
using FrameCnt_t = unsigned;
|
||||
#else
|
||||
using FrameCnt_t = signed;
|
||||
#endif
|
||||
const auto mangledSymbols = backtrace_symbols(frames, static_cast<FrameCnt_t>(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(<unistd.h>) && __has_include(<execinfo.h>)
|
||||
constexpr auto FrameCnt = 100;
|
||||
Vector<void*, FrameCnt> frames(FrameCnt);
|
||||
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), static_cast<int>(frames.size()))));
|
||||
#ifdef OX_OS_FreeBSD
|
||||
using FrameCnt_t = unsigned;
|
||||
#else
|
||||
using FrameCnt_t = signed;
|
||||
#endif
|
||||
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), static_cast<FrameCnt_t>(frames.size()))));
|
||||
if (frames.size() - shave > 2) {
|
||||
const auto symbolicatedStacktrace = symbolicate(frames.data() + shave, frames.size() - shave, "\t");
|
||||
oxErr("Stacktrace:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user