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

fix: resolve openssl issue #16

Merged
merged 1 commit into from
May 23, 2024
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
1 change: 1 addition & 0 deletions .github/scripts/e2e-test-server-linux-and-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ PORT=$((RANDOM % range + min))
# Install numpy for Python
export PYTHONHOME=$(pwd)/engines/cortex.python/python/
export LD_LIBRARY_PATH="$PYTHONHOME:$LD_LIBRARY_PATH"
export export DYLD_FALLBACK_LIBRARY_PATH="$PYTHONHOME:$DYLD_FALLBACK_LIBRARY_PATH"
echo "Set Python HOME to $PYTHONHOME"
./engines/cortex.python/python/bin/python3 -m ensurepip
./engines/cortex.python/python/bin/python3 -m pip install --upgrade pip
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/quality-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
strategy:
matrix:
include:
- os: "linux"
name: "amd64"
runs-on: "ubuntu-18-04"
# - os: "linux"
# name: "amd64"
# runs-on: "ubuntu-latest"
# runs-on: "ubuntu-18-04"
- os: "linux"
name: "amd64"
runs-on: "ubuntu-latest"
- os: "mac"
name: "arm64"
runs-on: "mac-silicon"
Expand All @@ -36,11 +36,11 @@ jobs:
id: checkout
uses: actions/checkout@v3

- name: Install OpenSSL on Ubuntu
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y openssl libssl-dev
# - name: Install OpenSSL on Ubuntu
# if: matrix.os == 'linux'
# run: |
# sudo apt-get update
# sudo apt-get install -y openssl libssl-dev

- name: Install make on Windows
if: runner.os == 'windows'
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ endif
build-example-server:
ifeq ($(OS),Windows_NT)
@powershell -Command "mkdir -p .\examples\server\build\engines\cortex.python; cd .\examples\server\build; cmake .. $(CMAKE_EXTRA_FLAGS); cmake --build . --config Release; cp -r ..\..\..\build\python .\Release\engines\cortex.python\python"
else
mkdir -p examples/server/build/engines/cortex.python
cd examples/server/build && cmake .. && cmake --build . --config Release -j12
cp -r build/python examples/server/build/engines/cortex.python
else
@mkdir -p examples/server/build/engines/cortex.python; \
cp -rf build_deps/_install/lib/engines-3 build/python/; \
cp -rf build_deps/_install/lib/libcrypto.* build/python/; \
cp -rf build_deps/_install/lib/libssl.* build/python/; \
cp -rf build_deps/_install/lib/ossl-modules build/python/; \
cp -r build/python examples/server/build/engines/cortex.python; \
ls examples/server/build/engines/cortex.python/python;
@cd examples/server/build; \
cmake .. && cmake --build . --config Release -j12
endif

package:
Expand All @@ -51,6 +57,7 @@ ifeq ($(OS),Windows_NT)
@powershell -Command "mkdir -p .\examples\server\build\Release\engines\cortex.python; cd examples\server\build\Release; cp ..\..\..\..\build\Release\engine.dll engines\cortex.python; ..\..\..\..\.github\scripts\e2e-test-server-windows.bat server.exe ..\..\..\..\$(PYTHON_FILE_EXECUTION_PATH);"
else
@mkdir -p examples/server/build/engines/cortex.python && \
rm -rf build_deps && \
cd examples/server/build && \
cp ../../../build/libengine.$(shell uname | tr '[:upper:]' '[:lower:]' | sed 's/darwin/dylib/;s/linux/so/') engines/cortex.python/ && \
chmod +x ../../../.github/scripts/e2e-test-server-linux-and-mac.sh && ../../../.github/scripts/e2e-test-server-linux-and-mac.sh ./server ../../../$(PYTHON_FILE_EXECUTION_PATH)
Expand Down
15 changes: 13 additions & 2 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ if(APPLE)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Download and install OpenSSL
ExternalProject_Add(
OpenSSL
URL https://www.openssl.org/source/openssl-3.3.0.tar.gz
PREFIX ${THIRD_PARTY_INSTALL_PATH}
CONFIGURE_COMMAND ./Configure --prefix=<INSTALL_DIR> --libdir=lib
BUILD_COMMAND make -j8
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)

# Download and install zlib
ExternalProject_Add(
zlib
Expand Down Expand Up @@ -139,7 +150,7 @@ if (UNIX) # APPLE and LINUX
else()
set(PYTHON_INSTALL_CONFIG_HOST "")
set(PYTHON_INSTALL_CONFIG_BUILD "")
set(PYTHON_INSTALL_CONFIG_SSL "")
set(PYTHON_INSTALL_CONFIG_SSL "--with-openssl=${THIRD_PARTY_INSTALL_PATH} --with-openssl-rpath=auto")
endif()

# Download and install Python3 from source
Expand All @@ -157,7 +168,7 @@ if (UNIX) # APPLE and LINUX
if(APPLE)
add_dependencies(Python3 XZUtils OpenSSL)
else() # Linux
add_dependencies(Python3 zlib libffi)
add_dependencies(Python3 zlib libffi OpenSSL)
endif()

else() # WINDOWS
Expand Down
Loading