Skip to content
Merged
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
2 changes: 0 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ cc_library(
"@aws-sdk-cpp//:aws-sdk-cpp",
"@aws-sdk-cpp//:aws-sdk-cpp_cmake",
"@azure//:storage",
"@cpprest//:sdk",
"@boost//:boost",
"@google_cloud_cpp//:storage",],
"//:disable_cloud": []
})
Expand Down
79 changes: 47 additions & 32 deletions Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,53 @@ RUN echo -e "max_parallel_downloads=8\nretries=50" >> /etc/dnf/dnf.conf && \
wget && \
dnf clean all

####### Azure SDK needs new boost:
WORKDIR /boost
# hadolint ignore=DL3003
RUN wget -nv https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz && \
if [ "$VERBOSE_LOGS" == "ON" ] ; then export BVERBOSE="-d+2" ; else export BVERBOSE="" ; fi && \
tar xf boost_1_68_0.tar.gz && cd boost_1_68_0 && ./bootstrap.sh && \
./b2 -j ${JOBS} cxxstd=17 link=static variant=release \
cxxflags="-fPIC $LTO_CXX_FLAGS" \
cflags="-fPIC $LTO_CXX_FLAGS" \
linkflags="$LTO_LD_FLAGS" \
--with-chrono --with-date_time --with-filesystem \
--with-program_options --with-system \
--with-random --with-thread --with-atomic --with-regex \
--with-log --with-locale "$BVERBOSE" \
install
####### Azure SDK (modern azure-sdk-for-cpp: azure-core, azure-storage-blobs, azure-storage-files-shares)
ARG SDL_OPS="-Wl,-z,relro,-z,now,-z,noexecstack -Wall -Wextra -Wimplicit-fallthrough -fPIE -pie -fstack-protector-strong -fexceptions -fasynchronous-unwind-tables -fcf-protection -fpic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -Wall -Wno-unknown-pragmas -Wno-error=sign-compare -fno-delete-null-pointer-checks -fwrapv -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -s -D_GLIBCXX_USE_CXX11_ABI=1 -Wuninitialized"
WORKDIR /azure-sdk-for-cpp
RUN git clone --depth 1 --branch azure-storage-blobs_12.18.0 https://github.com/Azure/azure-sdk-for-cpp.git . && \
echo "# no-op: use system libcurl and openssl" > /azure-sdk-toolchain.cmake && \
cmake -S sdk/core/azure-core -B build/azure-core \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DDISABLE_AZURE_CORE_OPENTELEMETRY=ON \
-DBUILD_TRANSPORT_CURL=ON && \
cmake --build build/azure-core --parallel ${JOBS} && \
cmake --install build/azure-core --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-common -B build/azure-storage-common \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-common --parallel ${JOBS} && \
cmake --install build/azure-storage-common --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-blobs -B build/azure-storage-blobs \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-blobs --parallel ${JOBS} && \
cmake --install build/azure-storage-blobs --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-files-shares -B build/azure-storage-files-shares \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-files-shares --parallel ${JOBS} && \
cmake --install build/azure-storage-files-shares --prefix /azure-sdk-install
####### End of Azure SDK

COPY third_party/pugixml /ovms/third_party/pugixml

Expand All @@ -77,23 +109,6 @@ RUN git clone -b v1.13 https://github.com/zeux/pugixml && \
make all -j ${JOBS} && \
cp -P libpugixml.so* /usr/lib64/

####### Azure SDK
WORKDIR /azure
COPY third_party/azure /ovms/third_party/azure
COPY third_party/cpprest /ovms/third_party/cpprest
RUN git clone --recurse-submodules --depth 1 --branch v2.10.16 https://github.com/Microsoft/cpprestsdk.git && \
git clone --depth 1 --branch v7.5.0 https://github.com/Azure/azure-storage-cpp.git && \
patch -d /azure/cpprestsdk/ -p1 < /ovms/third_party/cpprest/rest_sdk_v2.10.16.patch && \
patch -d /azure/azure-storage-cpp/ -p1 </ovms/third_party/azure/azure_sdk.patch

WORKDIR /azure/cpprestsdk/Release/build.release
ARG SDL_OPS="-Wl,-z,relro,-z,now,-z,noexecstack -Wall -Wextra -Wimplicit-fallthrough -fPIE -pie -fstack-protector-strong -fexceptions -fasynchronous-unwind-tables -fcf-protection -fpic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -Wall -Wno-unknown-pragmas -Wno-error=sign-compare -fno-delete-null-pointer-checks -fwrapv -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -s -D_GLIBCXX_USE_CXX11_ABI=1 -Wuninitialized"
RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} -DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DWERROR=OFF -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF && make --jobs=$JOBS install

WORKDIR /azure/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release
RUN CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="${SDL_OPS} ${LTO_CXX_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LTO_LD_FLAGS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=${VERBOSE_LOGS} && make --jobs=$JOBS && make --jobs=$JOBS install
####### End of Azure SDK

####### Build OpenCV
COPY third_party/opencv /ovms/third_party/opencv
WORKDIR /ovms/third_party/opencv
Expand Down
76 changes: 43 additions & 33 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
gpg \
libcurl4-openssl-dev \
libssl-dev \
libuuid1 \
uuid-dev \
libva-dev \
libxml2-dev \
patch \
Expand All @@ -48,37 +50,48 @@ RUN apt-get update && apt-get install --no-install-recommends -y \

WORKDIR /

####### Azure SDK needs new boost:
WORKDIR /boost
# hadolint ignore=DL3003
RUN wget -nv https://sourceforge.net/projects/boost/files/boost/1.69.0/boost_1_69_0.tar.gz && \
tar xf boost_1_69_0.tar.gz && cd boost_1_69_0 && ./bootstrap.sh && \
sed -i -e 's|#if PTHREAD_STACK_MIN > 0|#ifdef PTHREAD_STACK_MIN|g' boost/thread/pthread/thread_data.hpp && \
# fix for compiler >=9.5 https://github.com/boostorg/thread/pull/297/files
./b2 -j ${JOBS} cxxstd=17 link=static cxxflags='-fPIC' cflags='-fPIC' \
--with-chrono --with-date_time --with-filesystem --with-program_options --with-system \
--with-random --with-thread --with-atomic --with-regex \
--with-log --with-locale \
install

COPY third_party/azure /ovms/third_party/azure
COPY third_party/cpprest /ovms/third_party/cpprest

####### Azure SDK
WORKDIR /azure
RUN apt-get update && apt-get install --no-install-recommends -y uuid uuid-dev && rm -rf /var/lib/apt/lists/*
RUN git clone --recurse-submodules --depth 1 --branch v2.10.16 https://github.com/Microsoft/cpprestsdk.git && \
git clone --depth 1 --branch v7.5.0 https://github.com/Azure/azure-storage-cpp.git && \
patch -d /azure/cpprestsdk/ -p1 < /ovms/third_party/cpprest/rest_sdk_v2.10.16.patch && \
patch -d /azure/azure-storage-cpp/ -p1 </ovms/third_party/azure/azure_sdk.patch

####### Azure SDK (modern azure-sdk-for-cpp: azure-core, azure-storage-blobs, azure-storage-files-shares)
ARG SDL_OPS="-Wl,-z,relro,-z,now,-z,noexecstack -Wall -Wextra -Wimplicit-fallthrough -fPIE -pie -fstack-protector-strong -fexceptions -fasynchronous-unwind-tables -fcf-protection -fpic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -Wall -Wno-unknown-pragmas -Wno-error=sign-compare -fno-delete-null-pointer-checks -fwrapv -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -s -D_GLIBCXX_USE_CXX11_ABI=1 -Wuninitialized"
WORKDIR /azure/cpprestsdk/Release/build.release
RUN cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="${SDL_OPS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DWERROR=OFF -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF && make --jobs=$JOBS install

WORKDIR /azure/azure-storage-cpp/Microsoft.WindowsAzure.Storage/build.release
RUN CASABLANCA_DIR=/azure/cpprestsdk cmake .. -DCMAKE_CXX_FLAGS="${SDL_OPS}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DBoost_USE_STATIC_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=ON && make --jobs=$JOBS && make --jobs=$JOBS install
# no-error flag related to https://github.com/aws/aws-sdk-cpp/issues/1582
WORKDIR /azure-sdk-for-cpp
RUN git clone --depth 1 --branch azure-storage-blobs_12.18.0 https://github.com/Azure/azure-sdk-for-cpp.git . && \
echo "# no-op: use system libcurl and openssl" > /azure-sdk-toolchain.cmake && \
cmake -S sdk/core/azure-core -B build/azure-core \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DDISABLE_AZURE_CORE_OPENTELEMETRY=ON \
-DBUILD_TRANSPORT_CURL=ON && \
cmake --build build/azure-core --parallel ${JOBS} && \
cmake --install build/azure-core --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-common -B build/azure-storage-common \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-common --parallel ${JOBS} && \
cmake --install build/azure-storage-common --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-blobs -B build/azure-storage-blobs \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-blobs --parallel ${JOBS} && \
cmake --install build/azure-storage-blobs --prefix /azure-sdk-install && \
cmake -S sdk/storage/azure-storage-files-shares -B build/azure-storage-files-shares \
-DCMAKE_TOOLCHAIN_FILE=/azure-sdk-toolchain.cmake \
-DCMAKE_CXX_FLAGS="${SDL_OPS}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_PREFIX_PATH=/azure-sdk-install && \
cmake --build build/azure-storage-files-shares --parallel ${JOBS} && \
cmake --install build/azure-storage-files-shares --prefix /azure-sdk-install
####### End of Azure SDK

####### Build OpenCV
Expand Down Expand Up @@ -320,9 +333,6 @@ ARG CHECK_COVERAGE=0
COPY run_unit_tests.sh prepare_llm_models.sh install_va.sh demos/common/export_models/export_model.py /ovms/

ARG FUZZER_BUILD=0
# Custom Nodes
# hadolint ignore=DL3059
RUN if [ "$FUZZER_BUILD" == "0" ]; then bazel build --jobs=$JOBS ${debug_bazel_flags} //src:release_custom_nodes; fi;

# OVMS
ARG OPTIMIZE_BUILDING_TESTS=0
Expand Down
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ PYTHON_CLIENT_TEST_CONTAINER_NAME ?= python-client-test$(shell date +%Y-%m-%d-%H

TEST_PATH ?= tests/functional/

BUILD_CUSTOM_NODES ?= false

VERBOSE_LOGS ?= OFF

BUILD_ARGS = --build-arg http_proxy=$(HTTP_PROXY)\
Expand Down Expand Up @@ -361,10 +359,6 @@ ifeq ($(NO_DOCKER_CACHE),true)
endif
endif

ifeq ($(BUILD_CUSTOM_NODES),true)
@echo "Building custom nodes"
@cd src/custom_nodes && make NO_DOCKER_CACHE=$(NO_DOCKER_CACHE) BASE_OS=$(OS) BASE_IMAGE=$(BASE_IMAGE)
endif
@echo "Building docker image $(BASE_OS)"
# Provide metadata information into image if defined
@mkdir -p .workspace
Expand Down
9 changes: 5 additions & 4 deletions MakefileCapi
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

cpp:
bazel build --jobs=${JOBS} ${CAPI_FLAGS} //src:ovms_shared
g++ src/main_capi.cpp -I/ovms/src/ -L/ovms/bazel-bin/src/ -lovms_shared -fPIC --std=c++17 -o /ovms/bazel-bin/src/capi_cpp_example
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/ /ovms/bazel-bin/src/capi_cpp_example
g++ src/main_capi.cpp -I/ovms/src/ -L/ovms/bazel-bin/src/ -L/azure-sdk-install/lib \
-Wl,-rpath-link,/azure-sdk-install/lib -lovms_shared -fPIC --std=c++17 -o /ovms/bazel-bin/src/capi_cpp_example
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/:/azure-sdk-install/lib /ovms/bazel-bin/src/capi_cpp_example

c:
bazel build --jobs=${JOBS} ${CAPI_FLAGS} //src:ovms_shared
gcc -c src/main_capi.c -o /ovms/bazel-bin/src/main_capi.o -std=c99
gcc -o /ovms/bazel-bin/src/capi_c_example /ovms/bazel-bin/src/main_capi.o -lovms_shared -L/ovms/bazel-bin/src/
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/ /ovms/bazel-bin/src/capi_c_example
gcc -o /ovms/bazel-bin/src/capi_c_example /ovms/bazel-bin/src/main_capi.o -lovms_shared -L/ovms/bazel-bin/src/ -L/azure-sdk-install/lib -Wl,-rpath-link,/azure-sdk-install/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/ovms/bazel-bin/src/:/azure-sdk-install/lib /ovms/bazel-bin/src/capi_c_example
19 changes: 2 additions & 17 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -483,26 +483,11 @@ drogon_cpp()
load("@ovms//third_party/espeak_ng:espeak_ng.bzl", "espeak_ng")
espeak_ng()

# Azure Storage SDK
# Azure SDK for C++ (azure-core, azure-storage-blobs, azure-storage-files-shares)
new_local_repository(
name = "azure",
build_file = "@//third_party/azure:BUILD",
path = "/azure/azure-storage-cpp",
)

# Azure Storage SDK dependency - cpprest
new_local_repository(
name = "cpprest",
build_file = "@//third_party/cpprest:BUILD",
path = "/azure/cpprestsdk",
)

# Boost (needed for Azure Storage SDK)

new_local_repository(
name = "boost",
path = "/usr/local/lib/",
build_file = "@//third_party/boost:BUILD"
path = "/azure-sdk-install",
)

# Google Cloud SDK
Expand Down
14 changes: 9 additions & 5 deletions create_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ set -e
env
mkdir -vp /ovms_release/bin
mkdir -vp /ovms_release/lib
mkdir -vp /ovms_release/lib/custom_nodes

# Do not link this tokenizer lib as it has old protobuf sentencepiece symbols the conflict with new protobuf from ovsm
if [ "$ov_use_binary" == "0" ] ; then cp -v /openvino_tokenizers/build/src/libopenvino_tokenizers.so /ovms_release/lib/ ; fi

find /ovms/bazel-out/k8-*/bin -iname '*.so*' ! -type d ! -name "libgtest.so" ! -name "*params" ! -name "*.hana.*" ! -name "py_generate_pipeline.cpython*" ! -name "lib_node_*" ! -path "*test_python_binding*" ! -name "*libpython*" -exec cp -v {} /ovms_release/lib/ \;
find /ovms/bazel-out/k8-*/bin -iname '*.so*' ! -type d ! -name "libgtest.so" ! -name "*params" ! -name "*.hana.*" ! -name "py_generate_pipeline.cpython*" ! -name "lib_node_*" ! -name "libazure-*" ! -name "pyovms.so" ! -path "*/_solib_k8/*" ! -path "*test_python_binding*" ! -name "*libpython*" -exec cp -vP {} /ovms_release/lib/ \;
# Copy pyovms.so directly as a file (not symlink) to avoid broken Bazel cache paths
find /ovms/bazel-out/k8-*/bin/src/python/binding -name 'pyovms.so' -type f -exec cp -v {} /ovms_release/lib/ \;

# Copy Azure SDK libs directly from the CMake install prefix so that the
# unversioned .so files are local relative symlinks (not absolute Bazel cache
# paths), avoiding duplicate regular-file copies of the same content.
find /azure-sdk-install/lib -maxdepth 1 -name 'libazure-*.so*' -exec cp -vP {} /ovms_release/lib/ \;


# Bundle espeak-ng data files when espeak was enabled in the Bazel build.
# rules_foreign_cc places the cmake install tree under copy_<rule>/espeak-ng/
Expand All @@ -52,10 +59,7 @@ if [ -n "$ESPEAK_REAL" ]; then
ln -s libespeak-ng.so.1 libespeak-ng.so
cd - >/dev/null
fi
if [ "$FUZZER_BUILD" == "0" ]; then mv /ovms_release/lib/libcustom_node* /ovms_release/lib/custom_nodes/; fi;
cd /ovms_release/lib/ ; rm -f libcurl.so*
cd /ovms_release/lib/ ; rm -f libazurestorage.so.* ; ln -s libazurestorage.so libazurestorage.so.7 ;ln -s libazurestorage.so libazurestorage.so.7.5
cd /ovms_release/lib/ ; rm -f libcpprest.so.2.10 ; ln -s libcpprest.so libcpprest.so.2.10

# Remove GPU plugin for CPU images?
# Remove OpenCL for CPU images?
Expand Down
Loading