Skip to content

Commit

Permalink
Added the flags to link librdd_cl.so and libdss.so properly from the …
Browse files Browse the repository at this point in the history
…artifacts/repos (#51)

* Added the flags to link librdd_cl.so and libdss.so properly from the artifacts/repos

* Fixed the issue while importing python dss library with undefined symbols
  • Loading branch information
grandsuri authored May 31, 2023
1 parent 1a8bcb6 commit 46a8e1d
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 8 deletions.
16 changes: 10 additions & 6 deletions dss_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ find_package(Python ${PYTHON_VERSION} REQUIRED COMPONENTS Interpreter)

execute_process(COMMAND python3-config --libs OUTPUT_VARIABLE PYTHON3_LINK_LIBRARIES_FLAG OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
separate_arguments(PYTHON3_LINK_LIBRARIES_FLAGS UNIX_COMMAND "${PYTHON3_LINK_LIBRARIES_FLAG}")
message(STATUS "PYTHON3_LINK_LIBRARIES_FLAG: ${PYTHON3_LINK_LIBRARIES_FLAG}")
message(STATUS "PYTHON_LIBRARIES:${PYTHON_LIBRARIES}")
message(STATUS "AWSSDK_LINK_LIBRARIES:${AWSSDK_LINK_LIBRARIES}")
message(STATUS "EXT_INCLUDE_FLAGS:${EXT_INCLUDE_FLAGS}")

execute_process(COMMAND git describe --abbrev=4 --always --tags OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND python3-config --extension-suffix OUTPUT_VARIABLE EXT_NAME_SUFFIX)
Expand Down Expand Up @@ -71,13 +75,12 @@ target_include_directories(${DSS_LIB} PUBLIC
$<BUILD_INTERFACE:${NKV_INC_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)

target_link_libraries(test_dss ${AWSSDK_LINK_LIBRARIES})
target_link_libraries(${DSS_LIB} ${AWSSDK_LINK_LIBRARIES})
target_link_libraries(test_dss "${PYTHON3_LINK_LIBRARIES_FLAGS} ${PYTHON_LIBRARIES} -L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl")
target_link_libraries(${DSS_LIB} "${PYTHON3_LINK_LIBRARIES_FLAGS} ${PYTHON_LIBRARIES} -L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl")


target_link_libraries(${DSS_LIB} "-L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl ${PYTHON3_LINK_LIBRARIES_FLAGS}")
target_compile_options(${DSS_LIB} PRIVATE ${EXT_INCLUDE_FLAGS})

target_link_libraries(test_dss ${AWSSDK_LINK_LIBRARIES})
target_link_libraries(test_dss "-L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl ${PYTHON3_LINK_LIBRARIES_FLAG}")
target_compile_options(test_dss PRIVATE ${EXT_INCLUDE_FLAGS})
target_link_options(test_dss PUBLIC "-Wl,--disable-new-dtags" "-Wl,-rpath,/usr/lib/x86_64-linux-gnu/")

Expand All @@ -92,7 +95,8 @@ target_include_directories(${DSS_PYTHON_LIB} PUBLIC
$<BUILD_INTERFACE:${NKV_INC_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)

target_link_libraries(${DSS_PYTHON_LIB} "${PYTHON3_LINK_LIBRARIES_FLAGS} ${PYTHON_LIBRARIES} -L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl")
target_link_libraries(${DSS_PYTHON_LIB} ${DSS_LIB})
target_link_libraries(${DSS_PYTHON_LIB} "-L${NKV_LIB_DIR} -lcrypto -lcurl -lrdd_cl ${PYTHON3_LINK_LIBRARIES_FLAGS}")

target_compile_options(${DSS_PYTHON_LIB} PRIVATE ${EXT_INCLUDE_FLAGS})
target_compile_options(${DSS_PYTHON_LIB} PRIVATE "-fvisibility=hidden")
Expand Down
9 changes: 8 additions & 1 deletion dss_elbencho/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ CXXFLAGS += -DS3_SUPPORT -Wno-overloaded-virtual
LDFLAGS += -L $(EXTERNAL_PATH)/aws-sdk-cpp_install/lib* -l:libaws-sdk-all.a \
$(LDFLAGS_S3_DYNAMIC) $(LDFLAGS_S3_STATIC)
else
LDFLAGS += -L$(AWS_LIB_DIR) -laws-c-auth -laws-c-cal -laws-c-common -laws-c-compression -laws-c-event-stream -laws-checksums -laws-c-http -laws-c-io -laws-c-mqtt -laws-cpp-sdk-core -laws-cpp-sdk-s3 -laws-crt-cpp -laws-c-s3 -laws-c-sdkutils -laws-cpp-sdk-transfer -ldss
ifndef $(DSS_LIB_DIR)
DSS_LIB_DIR="../dss_client/build"
endif
ifndef $(NKV_LIB_DIR)
NKV_LIB_DIR="../../host_out/lib"
NKV_LIB_DIR="../nkv-sdk/lib"
endif
LDFLAGS += -L$(AWS_LIB_DIR) -L$(DSS_LIB_DIR) -L$(NKV_LIB_DIR) -laws-c-auth -laws-c-cal -laws-c-common -laws-c-compression -laws-c-event-stream -laws-checksums -laws-c-http -laws-c-io -laws-c-mqtt -laws-cpp-sdk-core -laws-cpp-sdk-s3 -laws-crt-cpp -laws-c-s3 -laws-c-sdkutils -laws-cpp-sdk-transfer -lrdd_cl -ldss
endif

# Apply user-provided AWS SDK include dir if given
Expand Down
85 changes: 84 additions & 1 deletion dss_elbencho/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,87 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC1091
# The Clear BSD License
#
# Copyright (c) 2023 Samsung Electronics Co., Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted (subject to the limitations in the disclaimer
# below) provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Samsung Electronics Co., Ltd. nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

set -e

# Set path variables
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DSS_ELBENCHO_DIR=$(realpath "$SCRIPT_DIR/../")
DSS_ECOSYSTEM_DIR=$(realpath "$SCRIPT_DIR/../..")
TOPDIR=$(realpath "$DSS_ECOSYSTEM_DIR/..")
DSS_CLIENT_DIR="$DSS_ECOSYSTEM_DIR/dss_client"
DSS_CLIENT_LIB_DIR="$DSS_CLIENT_DIR/build"
DSS_CLIENT_INC_DIR="$DSS_CLIENT_DIR/include"
NKV_SDK_DIR="$TOPDIR/dss-sdk/host_out"
NKV_LIB_DIR="$NKV_SDK_DIR/lib"
STAGING_DIR="$DSS_ELBENCHO_DIR/staging"

# Print a message to console and return non-zero
die()
{
echo "$*"
exit 1
}

# Check for libaws libs
if [ ! -f /usr/local/lib64/libaws-c-common.so ]
then
die "Missing AWS libs. Build using devtoolset-11: https://github.com/breuner/aws-sdk-cpp.git"
fi

if [ ! -f "$NKV_LIB_DIR/librdd_cl.so" ]; then
die "librdd_cl.so is missing. Please clone and build dss-sdk: https://github.com/openMPDK/dss-sdk or download the nkv-sdk artifact and change the path accordingly"
fi

echo "Cleaning old artifacts"
rm -f "$DSS_ELBENCHO_DIR/dss_elbencho-*.tgz"

echo "Building the elbencho binary"
make clean
source /opt/rh/devtoolset-11/enable
make S3_SUPPORT=1 AWS_INCLUDE_DIR=/usr/local/include/ AWS_LIB_DIR=/usr/local/lib64 DSS_INCLUDE_DIR=../dss_client/include BUILD-VERBOSE=1 -j 2
make S3_SUPPORT=1 AWS_INCLUDE_DIR=/usr/local/include/ AWS_LIB_DIR=/usr/local/lib64 DSS_LIB_DIR="$DSS_CLIENT_LIB_DIR" NKV_LIB_DIR="$NKV_LIB_DIR" DSS_INCLUDE_DIR="$DSS_CLIENT_INC_DIR" BUILD-VERBOSE=1 -j 2

echo "Packaging the binaries to dss_elbencho-<release>.tgz"
# Get dss-ecosystem release string
pushd "$DSS_ECOSYSTEM_DIR"
# Get release string
git fetch --tags
RELEASESTRING=$(git describe --tags --exact-match || git rev-parse --short HEAD)
popd

mkdir -p "$STAGING_DIR"
cp "$DSS_ELBENCHO_DIR/bin/elbencho" "$STAGING_DIR"

pushd "$STAGING_DIR"
tar zvcf "$DSS_ELBENCHO_DIR/dss_elbencho-$RELEASESTRING.tgz" ./*
popd

rm -rf "$STAGING_DIR"

0 comments on commit 46a8e1d

Please sign in to comment.