Skip to content

Commit

Permalink
build_info.txt and cacert.pem (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
bettinaheim authored Feb 13, 2024
1 parent bcafaa5 commit 869615c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docker/release/cudaq.ext.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ RUN if [ -d "$CUDA_QUANTUM_PATH/assets/documentation" ]; then \
mv "$CUDA_QUANTUM_PATH/assets/documentation"/* "$CUDA_QUANTUM_PATH/docs"; \
rmdir "$CUDA_QUANTUM_PATH/assets/documentation"; \
fi && \
for folder in `find "$CUDA_QUANTUM_PATH/assets"/*$(uname -m)/* -maxdepth 0 -type d`; \
for folder in `find "$CUDA_QUANTUM_PATH/assets/$(uname -m)"/* -maxdepth 0 -type d`; \
do bash "$CUDA_QUANTUM_PATH/bin/migrate_assets.sh" -s "$folder" && rm -rf "$folder"; done \
&& bash "$CUDA_QUANTUM_PATH/bin/migrate_assets.sh" -s "$CUDA_QUANTUM_PATH/assets" \
&& bash "$CUDA_QUANTUM_PATH/bin/migrate_assets.sh" -s "$CUDA_QUANTUM_PATH/assets/$(uname -m)" \
&& rm -rf "$CUDA_QUANTUM_PATH/assets" "$CUDA_QUANTUM_PATH/bin/migrate_assets.sh"

# Install additional runtime dependencies.
Expand Down
3 changes: 3 additions & 0 deletions runtime/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ install(EXPORT cudaq-common-targets
FILE CUDAQCommonTargets.cmake
NAMESPACE cudaq::
DESTINATION lib/cmake/cudaq)
if(EXISTS "$ENV{CURL_INSTALL_PREFIX}/cacert.pem")
install(FILES "$ENV{CURL_INSTALL_PREFIX}/cacert.pem" DESTINATION .)
endif()

## ----- Runtime MLIR Library -----
## We need support in the runtime for compiler-level things,
Expand Down
30 changes: 27 additions & 3 deletions scripts/install_prerequisites.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# ============================================================================ #
# Copyright (c) 2022 - 2023 NVIDIA Corporation & Affiliates. #
# Copyright (c) 2022 - 2024 NVIDIA Corporation & Affiliates. #
# All rights reserved. #
# #
# This source code and the accompanying materials are made available under #
Expand Down Expand Up @@ -188,14 +188,38 @@ if [ ! -f "$CURL_INSTALL_PREFIX/lib/libcurl.a" ]; then
temp_install_if_command_unknown wget wget
temp_install_if_command_unknown make make

# The arguments --with-ca-path and --with-ca-bundle can be used to configure the default
# locations where Curl will look for certificates. Note that the paths where certificates
# are stored by default varies across operating systems, and to build a Curl library that
# can run out of the box on various operating systems pretty much necessitates including
# and distributing a certificate bundle, or downloading such a bundle dynamically at
# at runtime if needed. The Mozilla certificate bundle can be
# downloaded from https://curl.se/ca/cacert.pem. For more information, see
# - https://curl.se/docs/sslcerts.html
# - https://curl.se/docs/caextract.html
wget https://curl.se/ca/cacert.pem
wget https://curl.se/ca/cacert.pem.sha256
if [ "$(sha256sum cacert.pem)" != "$(cat cacert.pem.sha256)" ]; then
echo -e "\e[01;31mWarning: Incorrect sha256sum of cacert.pem. The file cacert.pem has been removed. The file can be downloaded manually from https://curl.se/docs/sslcerts.html.\e[0m" >&2
rm cacert.pem cacert.pem.sha256
else
mkdir -p "$CURL_INSTALL_PREFIX" && mv cacert.pem "$CURL_INSTALL_PREFIX"
fi

# Unfortunately, it looks like the default paths need to be absolute and known at compile time.
# Note that while the environment variable CURL_CA_BUNDLE allows to easily override the default
# path when invoking the Curl executable, this variable is *not* respected by default by the
# built library itself; instead, the user of libcurl is responsible for picking up the
# environment variables and passing them to curl via CURLOPT_CAINFO and CURLOPT_PROXY_CAINFO.
# We opt to build Curl without any default paths, and instead have the CUDA Quantum runtime
# determine and pass a suitable path.
wget https://github.com/curl/curl/releases/download/curl-8_5_0/curl-8.5.0.tar.gz
tar -xzvf curl-8.5.0.tar.gz && cd curl-8.5.0
wget https://curl.haxx.se/ca/cacert.pem
CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="-L$OPENSSL_INSTALL_PREFIX/lib64 $LDFLAGS" \
./configure --prefix="$CURL_INSTALL_PREFIX" \
--enable-shared=no --enable-static=yes \
--with-openssl="$OPENSSL_INSTALL_PREFIX" --with-zlib="$ZLIB_INSTALL_PREFIX" \
--with-ca-bundle=cacert.pem \
--without-ca-bundle --without-ca-path \
--without-zstd --without-brotli \
--disable-ftp --disable-tftp --disable-smtp --disable-ldap --disable-ldaps \
--disable-smb --disable-gopher --disable-telnet --disable-rtsp \
Expand Down

0 comments on commit 869615c

Please sign in to comment.