Created
May 24, 2022 02:20
-
-
Save district10/ab3c5bd7df0cabbb83f6e8b61fefbce8 to your computer and use it in GitHub Desktop.
abseil QNX build, based on lts_2021_11_02 (commit: 215105818)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 750a475..110a1b5 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -21,6 +21,16 @@ | |
# and then issuing `yum install cmake3` on the command line. | |
cmake_minimum_required(VERSION 3.5) | |
+set(CMAKE_CXX_STANDARD 11) | |
+set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | |
+if (CMAKE_SYSTEM_NAME STREQUAL "QNX") | |
+ add_definitions(-D_QNX_SOURCE) | |
+ add_definitions(-D_XOPEN_SOURCE=500) | |
+ add_definitions(-DSIGSTKSZ=65536) | |
+ add_definitions(-DSA_ONSTACK=0x08000000) | |
+endif() | |
+ | |
# Compiler id for Apple Clang is now AppleClang. | |
if (POLICY CMP0025) | |
cmake_policy(SET CMP0025 NEW) | |
diff --git a/absl/base/config.h b/absl/base/config.h | |
index 585485c..47ad302 100644 | |
--- a/absl/base/config.h | |
+++ b/absl/base/config.h | |
@@ -294,6 +294,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
#else // !defined(__APPLE__) | |
#define ABSL_HAVE_THREAD_LOCAL 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_THREAD_LOCAL | |
+#define ABSL_HAVE_THREAD_LOCAL 0 | |
+#endif | |
// There are platforms for which TLS should not be used even though the compiler | |
// makes it seem like it's supported (Android NDK < r12b for example). | |
@@ -417,6 +421,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
defined(__HAIKU__) | |
#define ABSL_HAVE_MMAP 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_MMAP | |
+#define ABSL_HAVE_MMAP 0 | |
+#endif | |
// ABSL_HAVE_PTHREAD_GETSCHEDPARAM | |
// | |
@@ -428,6 +436,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
defined(_AIX) || defined(__ros__) | |
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_PTHREAD_GETSCHEDPARAM | |
+#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 0 | |
+#endif | |
// ABSL_HAVE_SCHED_GETCPU | |
// | |
@@ -437,6 +449,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
#elif defined(__linux__) | |
#define ABSL_HAVE_SCHED_GETCPU 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_SCHED_GETCPU | |
+#define ABSL_HAVE_SCHED_GETCPU 0 | |
+#endif | |
// ABSL_HAVE_SCHED_YIELD | |
// | |
@@ -447,6 +463,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) | |
#define ABSL_HAVE_SCHED_YIELD 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_SCHED_YIELD | |
+#define ABSL_HAVE_SCHED_YIELD 0 | |
+#endif | |
// ABSL_HAVE_SEMAPHORE_H | |
// | |
@@ -462,6 +482,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
#elif defined(__linux__) || defined(__ros__) | |
#define ABSL_HAVE_SEMAPHORE_H 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_SEMAPHORE_H | |
+#define ABSL_HAVE_SEMAPHORE_H 0 | |
+#endif | |
// ABSL_HAVE_ALARM | |
// | |
@@ -491,6 +515,10 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || | |
// other standard libraries | |
#define ABSL_HAVE_ALARM 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_HAVE_ALARM | |
+#define ABSL_HAVE_ALARM 0 | |
+#endif | |
// ABSL_IS_LITTLE_ENDIAN | |
// ABSL_IS_BIG_ENDIAN | |
diff --git a/absl/base/internal/low_level_alloc.h b/absl/base/internal/low_level_alloc.h | |
index db91951..8dd837f 100644 | |
--- a/absl/base/internal/low_level_alloc.h | |
+++ b/absl/base/internal/low_level_alloc.h | |
@@ -39,6 +39,10 @@ | |
#elif !defined(ABSL_HAVE_MMAP) && !defined(_WIN32) | |
#define ABSL_LOW_LEVEL_ALLOC_MISSING 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_LOW_LEVEL_ALLOC_MISSING | |
+#define ABSL_LOW_LEVEL_ALLOC_MISSING 1 | |
+#endif | |
// Using LowLevelAlloc with kAsyncSignalSafe isn't supported on Windows or | |
// asm.js / WebAssembly. | |
@@ -49,6 +53,10 @@ | |
#elif defined(_WIN32) || defined(__asmjs__) || defined(__wasm__) | |
#define ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING 1 | |
#endif | |
+#if defined(__QNX__) | |
+#undef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING | |
+#define ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING 1 | |
+#endif | |
#include <cstddef> | |
diff --git a/absl/debugging/failure_signal_handler.cc b/absl/debugging/failure_signal_handler.cc | |
index 689e597..9a16c41 100644 | |
--- a/absl/debugging/failure_signal_handler.cc | |
+++ b/absl/debugging/failure_signal_handler.cc | |
@@ -167,9 +167,13 @@ static bool SetupAlternateStackOnce() { | |
} | |
#endif | |
+#if defined(__QNX__) | |
+ // ABSL_RAW_LOG(FATAL, "sigaltstack() not supported"); | |
+#else | |
if (sigaltstack(&sigstk, nullptr) != 0) { | |
ABSL_RAW_LOG(FATAL, "sigaltstack() failed with errno=%d", errno); | |
} | |
+#endif | |
return true; | |
} | |
@@ -347,7 +351,7 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) { | |
// signal was received by doing this as early as possible, i.e. after | |
// verifying that this is not a recursive signal handler invocation. | |
int my_cpu = -1; | |
-#ifdef ABSL_HAVE_SCHED_GETCPU | |
+#if ABSL_HAVE_SCHED_GETCPU | |
my_cpu = sched_getcpu(); | |
#endif | |
diff --git a/absl/debugging/internal/elf_mem_image.h b/absl/debugging/internal/elf_mem_image.h | |
index a894bd4..fb0de63 100644 | |
--- a/absl/debugging/internal/elf_mem_image.h | |
+++ b/absl/debugging/internal/elf_mem_image.h | |
@@ -35,6 +35,11 @@ | |
!defined(__wasm__) | |
#define ABSL_HAVE_ELF_MEM_IMAGE 1 | |
#endif | |
+#if defined(__QNX__) | |
+#ifdef ABSL_HAVE_ELF_MEM_IMAGE | |
+#undef ABSL_HAVE_ELF_MEM_IMAGE | |
+#endif | |
+#endif | |
#ifdef ABSL_HAVE_ELF_MEM_IMAGE | |
diff --git a/absl/random/internal/nanobenchmark.cc b/absl/random/internal/nanobenchmark.cc | |
index c918181..13a3f0e 100644 | |
--- a/absl/random/internal/nanobenchmark.cc | |
+++ b/absl/random/internal/nanobenchmark.cc | |
@@ -708,7 +708,7 @@ void PinThreadToCPU(int cpu) { | |
} | |
const DWORD_PTR prev = SetThreadAffinityMask(GetCurrentThread(), 1ULL << cpu); | |
ABSL_RAW_CHECK(prev != 0, "SetAffinity failed"); | |
-#elif defined(ABSL_OS_LINUX) && !defined(ABSL_OS_ANDROID) | |
+#elif defined(ABSL_OS_LINUX) && !defined(ABSL_OS_ANDROID) && ABSL_HAVE_SCHED_GETCPU | |
if (cpu < 0) { | |
cpu = sched_getcpu(); | |
ABSL_RAW_CHECK(cpu >= 0, "PinThreadToCPU detect failed"); | |
diff --git a/conanfile.py b/conanfile.py | |
index 926ec5c..53c7bb3 100755 | |
--- a/conanfile.py | |
+++ b/conanfile.py | |
@@ -5,6 +5,7 @@ | |
# internally, so we won't know if it stops working. We may ask community | |
# members to help us debug any problems that arise. | |
+import os | |
from conans import ConanFile, CMake, tools | |
from conans.errors import ConanInvalidConfiguration | |
from conans.model.version import Version | |
@@ -44,8 +45,8 @@ class AbseilConan(ConanFile): | |
self.copy("*.lib", dst="lib", src=".", keep_path=False) | |
def package_info(self): | |
- if self.settings.os == "Linux": | |
- self.cpp_info.libs = ["-Wl,--start-group"] | |
+ self.cpp_info.libs = ['-Wl,--start-group'] | |
self.cpp_info.libs.extend(tools.collect_libs(self)) | |
- if self.settings.os == "Linux": | |
- self.cpp_info.libs.extend(["-Wl,--end-group", "pthread"]) | |
+ self.cpp_info.libs.append('-Wl,--end-group') | |
+ if self.settings.os == 'Linux': | |
+ self.cpp_info.libs.append('pthread') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for older version
see https://gist.github.com/district10/9937754bdcdd5321a56430f491088de9