diff --git a/docker/release/cudaq.ext.Dockerfile b/docker/release/cudaq.ext.Dockerfile index 9faf881ccb..fb4803fcea 100644 --- a/docker/release/cudaq.ext.Dockerfile +++ b/docker/release/cudaq.ext.Dockerfile @@ -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. diff --git a/runtime/common/CMakeLists.txt b/runtime/common/CMakeLists.txt index 853394e55c..40cb6feae1 100644 --- a/runtime/common/CMakeLists.txt +++ b/runtime/common/CMakeLists.txt @@ -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, diff --git a/scripts/install_prerequisites.sh b/scripts/install_prerequisites.sh index 5444aae13d..ba02aa1a71 100644 --- a/scripts/install_prerequisites.sh +++ b/scripts/install_prerequisites.sh @@ -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 # @@ -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 \