Skip to content

Commit

Permalink
MINIFICPP-2139 Fix build on ARM7 architecture
Browse files Browse the repository at this point in the history
Closes #1590
Signed-off-by: Marton Szasz <[email protected]>
  • Loading branch information
lordgamez authored and szaszm committed Jul 20, 2023
1 parent 93bc729 commit 3624437
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/BundledRocksDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function(use_bundled_rocksdb SOURCE_DIR BINARY_DIR)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/lz4/dummy")
endif()

# Patch to fix build issue on ARM7 architecture: https://github.com/facebook/rocksdb/issues/8609#issuecomment-1009572506
set(PATCH_FILE "${SOURCE_DIR}/thirdparty/rocksdb/arm7.patch")
set(PC ${Bash_EXECUTABLE} -c "set -x && \
(\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE}\")")
# Define byproducts
if (WIN32)
set(BYPRODUCT "lib/rocksdb.lib")
Expand Down Expand Up @@ -71,6 +75,7 @@ function(use_bundled_rocksdb SOURCE_DIR BINARY_DIR)
URL_HASH "SHA256=9102704e169cfb53e7724a30750eeeb3e71307663852f01fa08d5a320e6155a8"
SOURCE_DIR "${BINARY_DIR}/thirdparty/rocksdb-src"
CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS}
PATCH_COMMAND ${PC}
BUILD_BYPRODUCTS "${BINARY_DIR}/thirdparty/rocksdb-install/${BYPRODUCT}"
EXCLUDE_FROM_ALL TRUE
LIST_SEPARATOR % # This is needed for passing semicolon-separated lists
Expand Down
3 changes: 3 additions & 0 deletions libminifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VER
list(APPEND LIBMINIFI_LIBRARIES stdc++fs)
endif()
target_link_libraries(core-minifi ${CMAKE_DL_LIBS} ${LIBMINIFI_LIBRARIES})
if (UNIX AND (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7"))
target_link_libraries(core-minifi "-latomic")
endif()

SET (LIBMINIFI core-minifi PARENT_SCOPE)

Expand Down
15 changes: 15 additions & 0 deletions thirdparty/rocksdb/arm7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
index 225e3fa72..cd5f935f1 100644
--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
@@ -131,6 +131,10 @@ static inline tokutime_t toku_time_now(void) {
uint64_t result;
__asm __volatile__("mrs %[rt], cntvct_el0" : [ rt ] "=r"(result));
return result;
+#elif defined(__arm__)
+ uint32_t lo, hi;
+ __asm __volatile__("mrrc p15, 1, %[lo], %[hi], c14" : [ lo ] "=r" (lo), [hi] "=r" (hi));
+ return (uint64_t)hi << 32 | lo;
#elif defined(__powerpc__)
return __ppc_get_timebase();
#elif defined(__s390x__)

0 comments on commit 3624437

Please sign in to comment.