Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINIFICPP-2139 Fix build on ARM7 architecture #1590

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=b8ac9784a342b2e314c821f6d701148912215666ac5e9bdbccd93cf3767cb611"
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
fgerlits marked this conversation as resolved.
Show resolved Hide resolved
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__)