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

[#235] creating deps dir and updating build process #236

Merged
merged 1 commit into from
Oct 16, 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
7 changes: 0 additions & 7 deletions hyperon_das_atomdb_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,8 @@ find_package(nanobind CONFIG REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src /usr/local/include)

add_library(libmbedcrypto STATIC IMPORTED)
if(EXISTS "/usr/lib/x86_64-linux-gnu/libmbedcrypto.a")
# localion on Ubuntu 22.04 - installed package libmbedtls-dev
set_target_properties(
libmbedcrypto PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libmbedcrypto.a)
else()
# localion on AlmaLinux 8 - compiled and installed from source
set_target_properties(
libmbedcrypto PROPERTIES IMPORTED_LOCATION /usr/local/lib64/libmbedcrypto.a)
endif()

# Collect header and source files
file(GLOB_RECURSE headers
Expand Down
Binary file added hyperon_das_atomdb_cpp/deps/mbedtls-3.6.2.tar.bz2
Binary file not shown.
28 changes: 15 additions & 13 deletions hyperon_das_atomdb_cpp/docker/Dockerfile.wheel
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# See https://github.com/pypa/manylinux for more information
FROM quay.io/pypa/manylinux_2_28_x86_64

# Install mbedtls-2.28 from source
# (there is no pre-built package available in the AlmaLinux repos)
WORKDIR /tmp
RUN git clone https://github.com/Mbed-TLS/mbedtls.git \
&& cd mbedtls \
&& git checkout mbedtls-2.28 \
ENV MBEDTLS_VERSION=3.6.2
ENV PYTHON_PATH=/opt/python/cp310-cp310
ENV PYTHON_EXECUTABLE=${PYTHON_PATH}/bin/python3.10

COPY ./deps /tmp/deps

# Install `mbedtls` from source
# (there was no pre-built package available in the AlmaLinux repos)
RUN cd /tmp \
&& tar jxf ./deps/mbedtls-${MBEDTLS_VERSION}.tar.bz2 \
&& cd mbedtls-${MBEDTLS_VERSION} \
&& mkdir build \
&& cd build \
&& export CFLAGS="$CFLAGS -fPIC" \
&& export CFLAGS="$CFLAGS -fPIC -Ofast" \
&& cmake .. \
&& make -j$(nproc) \
&& make install \
&& rm -rf /tmp/mbedtls
&& rm -rf /tmp/mbedtls-${MBEDTLS_VERSION}

COPY requirements.txt /tmp/requirements.txt

ENV PYTHON_PATH=/opt/python/cp310-cp310
ENV PYTHON_EXECUTABLE=${PYTHON_PATH}/bin/python3.10
RUN ${PYTHON_EXECUTABLE} -m pip install -r /tmp/deps/requirements.txt

RUN ${PYTHON_EXECUTABLE} -m pip install -r /tmp/requirements.txt
RUN rm -rf /tmp/deps

WORKDIR /hyperon_das_atomdb_cpp

Expand Down
6 changes: 3 additions & 3 deletions hyperon_das_atomdb_cpp/src/utils/expression_hasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ class ExpressionHasher {
new mbedtls_md5_context(), &mbedtls_md5_free);
mbedtls_md5_init(ctx.get());
uchar md5_buffer[MD5_BUFFER_SIZE];
if (mbedtls_md5_starts_ret(ctx.get()) != 0 or
mbedtls_md5_update_ret(ctx.get(), (const uchar*) input.c_str(), input.length()) != 0 or
mbedtls_md5_finish_ret(ctx.get(), md5_buffer) != 0) {
if (mbedtls_md5_starts(ctx.get()) != 0 or
mbedtls_md5_update(ctx.get(), (const uchar*) input.c_str(), input.length()) != 0 or
mbedtls_md5_finish(ctx.get(), md5_buffer) != 0) {
throw runtime_error("Failed to compute MD5 hash");
}
char hash[2 * MD5_BUFFER_SIZE + 1];
Expand Down