Skip to content

Commit

Permalink
[improve](cloud) support arm compilation in cloud mode (apache#42467) (
Browse files Browse the repository at this point in the history
…apache#43377)

pick master apache#42467 

Azure is not supported yet. You need to export DISABLE_BUILD_AZURE=ON &&
sh build.sh --cloud when compiling.
  • Loading branch information
luwei16 authored Nov 7, 2024
1 parent 77459ab commit da61d29
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 32 deletions.
6 changes: 0 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,6 @@ else
fi
fi

ARCH="$(uname -m)"
if [[ "${ARCH}" == "aarch64" ]]; then
echo "WARNING: Cloud module is not supported on ARM platform, will skip building it."
BUILD_CLOUD=0
fi

if [[ "${HELP}" -eq 1 ]]; then
usage
fi
Expand Down
44 changes: 28 additions & 16 deletions cloud/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,30 +413,42 @@ endif ()

# Add libs if needed, download to current dir -- ${BUILD_DIR}
set(FDB_LIB "fdb_lib_7_1_23.tar.xz")
if (ARCH_AARCH64)
set(FDB_LIB "fdb_lib_7_1_57.aarch64.tar.xz")
endif ()
file(GLOB RELEASE_FILE_LIST LIST_DIRECTORIES false "/etc/*release*")
execute_process(COMMAND "cat" ${RELEASE_FILE_LIST}
RESULT_VARIABLE CAT_RET_CODE
OUTPUT_VARIABLE CAT_RET_CONTENT)
string(TOUPPER "${CAT_RET_CONTENT}" CAT_RET_CONTENT)
if ("${CAT_RET_CONTENT}" MATCHES "UBUNTU")
message("Ubuntu OS")
SET(OS_RELEASE "Ubuntu")
set(FDB_LIB_URL "https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/ubuntu/")
string(APPEND FDB_LIB_URL "${FDB_LIB}")
set(FDB_LIB_MD5SUM "a00fe45da95cfac4e0caffa274bb2b30")
else()
# If it is not ubuntu, it is regarded as centos by default
message("Centos OS")
SET(OS_RELEASE "Centos")
set(FDB_LIB_URL "https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/centos/")
string(APPEND FDB_LIB_URL "${FDB_LIB}")
set(FDB_LIB_MD5SUM "f9839a564849c0232a351143b4340de0")

if (ARCH_AARCH64)
message("Centos OS")
SET(OS_RELEASE "Centos")
set(FDB_LIB_URL "https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/aarch64/")
string(APPEND FDB_LIB_URL "${FDB_LIB}")
set(FDB_LIB_MD5SUM "2d01a431b7a7465077e4ae5520f89693")
else ()
if ("${CAT_RET_CONTENT}" MATCHES "UBUNTU")
message("Ubuntu OS")
SET(OS_RELEASE "Ubuntu")
set(FDB_LIB_URL "https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/ubuntu/")
string(APPEND FDB_LIB_URL "${FDB_LIB}")
set(FDB_LIB_MD5SUM "a00fe45da95cfac4e0caffa274bb2b30")
else()
# If it is not ubuntu, it is regarded as centos by default
message("Centos OS")
SET(OS_RELEASE "Centos")
set(FDB_LIB_URL "https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/centos/")
string(APPEND FDB_LIB_URL "${FDB_LIB}")
set(FDB_LIB_MD5SUM "f9839a564849c0232a351143b4340de0")
endif()
endif()

if (NOT EXISTS "${THIRDPARTY_SRC}/${FDB_LIB}")
file(MAKE_DIRECTORY ${THIRDPARTY_SRC})
execute_process(COMMAND "curl --retry 10 --retry-delay 2 --retry-max-time 30" "${FDB_LIB_URL}"
"-o" "${THIRDPARTY_SRC}/${FDB_LIB}" "-k"
execute_process(COMMAND curl --retry 10 --retry-delay 2 --retry-max-time 30 ${FDB_LIB_URL}
-o ${THIRDPARTY_SRC}/${FDB_LIB} -k
RESULTS_VARIABLE DOWNLOAD_RET)
if (NOT ${DOWNLOAD_RET} STREQUAL "0")
execute_process(COMMAND "rm" "-rf" "${THIRDPARTY_SRC}/${FDB_LIB}")
Expand All @@ -454,7 +466,7 @@ if (NOT EXISTS ${THIRDPARTY_DIR}/include/foundationdb)
execute_process(COMMAND "rm" "-rf" "${THIRDPARTY_SRC}/${FDB_LIB}")
message(FATAL_ERROR "${THIRDPARTY_SRC}/${FDB_LIB} md5sum check failed, remove it")
endif ()
execute_process(COMMAND "tar" "xf" "${THIRDPARTY_SRC}/${FDB_LIB}" "-C" "${THIRDPARTY_DIR}/")
execute_process(COMMAND tar xf ${THIRDPARTY_SRC}/${FDB_LIB} -C ${THIRDPARTY_DIR}/)
endif ()

# enable glog custom prefix
Expand Down
38 changes: 28 additions & 10 deletions tools/fdb/fdb_ctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,35 @@ function download_fdb() {
return
fi

local URL="https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/"
local TMP="${FDB_PKG_DIR}-tmp"

rm -rf "${TMP}"
mkdir -p "${TMP}"
arch=$(uname -m)
if [[ "${arch}" == "x86_64" ]]; then
local URL="https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/"
local TMP="${FDB_PKG_DIR}-tmp"

rm -rf "${TMP}"
mkdir -p "${TMP}"

wget "${URL}/fdbbackup.x86_64" -O "${TMP}/fdbbackup"
wget "${URL}/fdbserver.x86_64" -O "${TMP}/fdbserver"
wget "${URL}/fdbcli.x86_64" -O "${TMP}/fdbcli"
wget "${URL}/fdbmonitor.x86_64" -O "${TMP}/fdbmonitor"
wget "${URL}/libfdb_c.x86_64.so" -O "${TMP}/libfdb_c.x86_64.so"
elif [[ "${arch}" == "aarch64" ]]; then
local URL="https://doris-build.oss-cn-beijing.aliyuncs.com/thirdparty/fdb/aarch64"
local TMP="${FDB_PKG_DIR}-tmp"

rm -rf "${TMP}"
mkdir -p "${TMP}"

wget "${URL}/fdbbackup" -O "${TMP}/fdbbackup"
wget "${URL}/fdbserver" -O "${TMP}/fdbserver"
wget "${URL}/fdbcli" -O "${TMP}/fdbcli"
wget "${URL}/fdbmonitor" -O "${TMP}/fdbmonitor"
wget "${URL}/libfdb_c.aarch64.so" -O "${TMP}/libfdb_c.aarch64.so"
else
echo "Unsupported architecture: ""${arch}"
fi

wget "${URL}/fdbbackup.x86_64" -O "${TMP}/fdbbackup"
wget "${URL}/fdbserver.x86_64" -O "${TMP}/fdbserver"
wget "${URL}/fdbcli.x86_64" -O "${TMP}/fdbcli"
wget "${URL}/fdbmonitor.x86_64" -O "${TMP}/fdbmonitor"
wget "${URL}/libfdb_c.x86_64.so" -O "${TMP}/libfdb_c.x86_64.so"
chmod +x "${TMP}"/fdb*

mv "${TMP}" "${FDB_PKG_DIR}"
Expand Down

0 comments on commit da61d29

Please sign in to comment.