From 232afaae7dfe04d5592df4c256cfb55ede0550d2 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Thu, 23 Oct 2025 17:45:52 +0200 Subject: [PATCH 1/7] [CI] Build zstd for release build container We enabled using zstd for release builds, but it requires zstd static library. zstd and libzstd-devel packages don't contain libzstd.a, therefore building from source. --- devops/containers/release_build.Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devops/containers/release_build.Dockerfile b/devops/containers/release_build.Dockerfile index 3d59cb7aeea36..8b5e7587ea56f 100644 --- a/devops/containers/release_build.Dockerfile +++ b/devops/containers/release_build.Dockerfile @@ -20,6 +20,13 @@ RUN dnf -y install https://repo.radeon.com/amdgpu-install/6.4.1/rhel/8.10/amdgpu dnf -y install rocm && \ dnf clean all && rm -rf /var/cache/dnf +# Build zstd static library from sources +RUN git clone https://github.com/facebook/zstd.git /tmp/zstd && \ + cd /tmp/zstd && \ + make && \ + make install && \ + rm -rf /tmp/zstd + COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh USER sycl From 94be7b8e4b8522385144a14e55a797223747c660 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Thu, 23 Oct 2025 18:36:18 +0200 Subject: [PATCH 2/7] build with -fPIE --- devops/containers/release_build.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devops/containers/release_build.Dockerfile b/devops/containers/release_build.Dockerfile index 8b5e7587ea56f..c94d555c80e97 100644 --- a/devops/containers/release_build.Dockerfile +++ b/devops/containers/release_build.Dockerfile @@ -23,7 +23,7 @@ RUN dnf -y install https://repo.radeon.com/amdgpu-install/6.4.1/rhel/8.10/amdgpu # Build zstd static library from sources RUN git clone https://github.com/facebook/zstd.git /tmp/zstd && \ cd /tmp/zstd && \ - make && \ + CFLAGS="-fPIE" make && \ make install && \ rm -rf /tmp/zstd From 285ed2b3da7b783ea27ac0cc8386307317f33702 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Thu, 23 Oct 2025 19:47:16 +0200 Subject: [PATCH 3/7] do not use cd trivy is angry --- devops/containers/release_build.Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/devops/containers/release_build.Dockerfile b/devops/containers/release_build.Dockerfile index c94d555c80e97..4cd6e026b2d68 100644 --- a/devops/containers/release_build.Dockerfile +++ b/devops/containers/release_build.Dockerfile @@ -22,9 +22,8 @@ RUN dnf -y install https://repo.radeon.com/amdgpu-install/6.4.1/rhel/8.10/amdgpu # Build zstd static library from sources RUN git clone https://github.com/facebook/zstd.git /tmp/zstd && \ - cd /tmp/zstd && \ - CFLAGS="-fPIE" make && \ - make install && \ + make -C /tmp/zstd && \ + make -C /tmp/zstd install && \ rm -rf /tmp/zstd COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh From ff1a9b5da11dcd6ebfa56dcfb80f1c64b2adf332 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 24 Oct 2025 12:15:45 +0200 Subject: [PATCH 4/7] use script instead --- .github/workflows/sycl-containers.yaml | 8 +++++ devops/containers/release_build.Dockerfile | 6 ++-- devops/containers/ubuntu2404_base.Dockerfile | 4 +-- devops/containers/ubuntu2404_build.Dockerfile | 4 +-- ...build_zstd_1_5_6_ub24.sh => build_zstd.sh} | 32 ++++++++++++------- 5 files changed, 35 insertions(+), 19 deletions(-) rename devops/scripts/{build_zstd_1_5_6_ub24.sh => build_zstd.sh} (73%) diff --git a/.github/workflows/sycl-containers.yaml b/.github/workflows/sycl-containers.yaml index 75598f22901b9..2b189d9c0df33 100644 --- a/.github/workflows/sycl-containers.yaml +++ b/.github/workflows/sycl-containers.yaml @@ -14,6 +14,10 @@ on: - 'devops/scripts/install_drivers.sh' - 'devops/scripts/install_build_tools.sh' - '.github/workflows/sycl-containers.yaml' + # These containers are created by another workflows. + paths-ignore: + - 'devops/containers/release_build.Dockerfile' + - 'devops/containers/release_tests_binaries.Dockerfile' pull_request: paths: - 'devops/actions/build_container/**' @@ -22,6 +26,10 @@ on: - 'devops/scripts/install_drivers.sh' - 'devops/scripts/install_build_tools.sh' - '.github/workflows/sycl-containers.yaml' + # These containers are created by another workflows. + paths-ignore: + - 'devops/containers/release_build.Dockerfile' + - 'devops/containers/release_tests_binaries.Dockerfile' permissions: read-all diff --git a/devops/containers/release_build.Dockerfile b/devops/containers/release_build.Dockerfile index 4cd6e026b2d68..bb678d5781b50 100644 --- a/devops/containers/release_build.Dockerfile +++ b/devops/containers/release_build.Dockerfile @@ -21,10 +21,8 @@ RUN dnf -y install https://repo.radeon.com/amdgpu-install/6.4.1/rhel/8.10/amdgpu dnf clean all && rm -rf /var/cache/dnf # Build zstd static library from sources -RUN git clone https://github.com/facebook/zstd.git /tmp/zstd && \ - make -C /tmp/zstd && \ - make -C /tmp/zstd install && \ - rm -rf /tmp/zstd +COPY scripts/build_zstd.sh /build_zstd.sh +RUN /build_zstd.sh COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh diff --git a/devops/containers/ubuntu2404_base.Dockerfile b/devops/containers/ubuntu2404_base.Dockerfile index 6890a42dcc95a..8223cd03a0aa5 100644 --- a/devops/containers/ubuntu2404_base.Dockerfile +++ b/devops/containers/ubuntu2404_base.Dockerfile @@ -17,8 +17,8 @@ RUN /install.sh # This causes linking errors when building SYCL runtime. # Bug: https://github.com/intel/llvm/issues/15935 # Workaround: build zstd from sources with -fPIC flag. -COPY scripts/build_zstd_1_5_6_ub24.sh /build_zstd_1_5_6_ub24.sh -RUN /build_zstd_1_5_6_ub24.sh +COPY scripts/build_zstd.sh /build_zstd.sh +RUN /build_zstd.sh COPY scripts/create-sycl-user.sh /user-setup.sh RUN /user-setup.sh diff --git a/devops/containers/ubuntu2404_build.Dockerfile b/devops/containers/ubuntu2404_build.Dockerfile index c659eabbced51..15ecf1ec4434f 100644 --- a/devops/containers/ubuntu2404_build.Dockerfile +++ b/devops/containers/ubuntu2404_build.Dockerfile @@ -12,8 +12,8 @@ RUN /install.sh # This causes linking errors when building SYCL runtime. # Bug: https://github.com/intel/llvm/issues/15935 # Workaround: build zstd from sources with -fPIC flag. -COPY scripts/build_zstd_1_5_6_ub24.sh /build_zstd_1_5_6_ub24.sh -RUN /build_zstd_1_5_6_ub24.sh +COPY scripts/build_zstd.sh /build_zstd.sh +RUN /build_zstd.sh SHELL ["/bin/bash", "-ec"] diff --git a/devops/scripts/build_zstd_1_5_6_ub24.sh b/devops/scripts/build_zstd.sh similarity index 73% rename from devops/scripts/build_zstd_1_5_6_ub24.sh rename to devops/scripts/build_zstd.sh index 68a947dfb43a0..90b221d15169c 100755 --- a/devops/scripts/build_zstd_1_5_6_ub24.sh +++ b/devops/scripts/build_zstd.sh @@ -1,14 +1,22 @@ #!/bin/bash -# Script to build and install zstd 1.5.6 on Ubuntu 24, with -fPIC flag. +# Script to build and install zstd on Ubuntu 24, with -fPIC flag. # The default installation of zstd on Ubuntu 24 does not have -fPIC flag # enabled, which is required for building DPC++ in shared libraries mode. -# Function to check if the OS is Ubuntu 24 +# OR on Rocky Linux 8.10 (used for nightly release builds). There is no static +# library (libzstd.a) in available packages, therefore it is necessary to build +# it from source. + +# Function to check OS check_os() { + local expected_name="$1" + local expected_version="$2" . /etc/os-release - if [[ "$NAME" != "Ubuntu" || "$VERSION_ID" != "24.04" ]]; then - echo "Warning: This script has only been tested with Ubuntu 24." + if [[ "$NAME" == "$expected_name" && "$VERSION_ID" == "$expected_version" ]]; then + return 0 + else + return 1 fi } @@ -59,19 +67,21 @@ EOF } # Check the OS -check_os +if ! check_os "Ubuntu" "24.04" && ! check_os "Rocky Linux" "8.10"; then + echo "Warning: This script has only been tested with Ubuntu 24.04 and Rocky Linux 8.10." +fi # Set USE_SUDO to true or false based on your preference USE_SUDO=true -# Install necessary build tools -install_packages - -# Uninstall libzstd-dev package if installed -uninstall_libzstd_dev +# Install necessary build tools & uninstall libzstd-dev package if installed +if check_os "Ubuntu" "24.04"; then + install_packages + uninstall_libzstd_dev +fi # Define the version and URL for zstd -ZSTD_VERSION="1.5.6" +ZSTD_VERSION="1.5.7" ZSTD_URL="https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" # Create a directory for the source code From dc3532c7ea714fd00146f01f792576413697bf82 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Fri, 24 Oct 2025 14:19:12 +0200 Subject: [PATCH 5/7] drop paths-ignore --- .github/workflows/sycl-containers.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/sycl-containers.yaml b/.github/workflows/sycl-containers.yaml index 2b189d9c0df33..75598f22901b9 100644 --- a/.github/workflows/sycl-containers.yaml +++ b/.github/workflows/sycl-containers.yaml @@ -14,10 +14,6 @@ on: - 'devops/scripts/install_drivers.sh' - 'devops/scripts/install_build_tools.sh' - '.github/workflows/sycl-containers.yaml' - # These containers are created by another workflows. - paths-ignore: - - 'devops/containers/release_build.Dockerfile' - - 'devops/containers/release_tests_binaries.Dockerfile' pull_request: paths: - 'devops/actions/build_container/**' @@ -26,10 +22,6 @@ on: - 'devops/scripts/install_drivers.sh' - 'devops/scripts/install_build_tools.sh' - '.github/workflows/sycl-containers.yaml' - # These containers are created by another workflows. - paths-ignore: - - 'devops/containers/release_build.Dockerfile' - - 'devops/containers/release_tests_binaries.Dockerfile' permissions: read-all From e0eaca7dad30583c489b177ec5ec981d0b28568f Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Mon, 27 Oct 2025 13:25:41 +0100 Subject: [PATCH 6/7] update GetStartedGuide --- sycl/doc/GetStartedGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index 06642c08e07b8..85d3db3256a1e 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -351,7 +351,7 @@ You can install zstd using the package manager of your distribution. For example ```sh sudo apt-get install libzstd-dev ``` -Note that the libzstd-dev package provided on Ubuntu 24.04 has a bug ([link](https://bugs.launchpad.net/ubuntu/+source/libzstd/+bug/2086543)) and the zstd static library is not built with the `-fPIC` flag. Linking to this library will result in a build failure. For example: [Issue#15935](https://github.com/intel/llvm/issues/15935). As an alternative, zstd can be built from source either manually or by using the [build_zstd_1_5_6_ub24.sh](https://github.com/intel/llvm/blob/sycl/devops/scripts/build_zstd_1_5_6_ub24.sh) script. +Note that the libzstd-dev package provided on Ubuntu 24.04 has a bug ([link](https://bugs.launchpad.net/ubuntu/+source/libzstd/+bug/2086543)) and the zstd static library is not built with the `-fPIC` flag. Linking to this library will result in a build failure. For example: [Issue#15935](https://github.com/intel/llvm/issues/15935). As an alternative, zstd can be built from source either manually or by using the [build_zstd.sh](https://github.com/intel/llvm/blob/sycl/devops/scripts/build_zstd.sh) script (it works on Rocky Linux 8.10 / RHEL 8.10 as well). **Windows** From e6807ff0a904e2dce7718e5bbd7b2eaa7af4f72a Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Tue, 28 Oct 2025 15:46:46 +0100 Subject: [PATCH 7/7] fix jenkins --- devops/scripts/build_zstd_1_5_6_ub24.sh | 112 ++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 devops/scripts/build_zstd_1_5_6_ub24.sh diff --git a/devops/scripts/build_zstd_1_5_6_ub24.sh b/devops/scripts/build_zstd_1_5_6_ub24.sh new file mode 100755 index 0000000000000..d2d4dd73f84f6 --- /dev/null +++ b/devops/scripts/build_zstd_1_5_6_ub24.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# The actual version of this script is build_zstd.sh. +# This one is needed for jenkins precommit to pass, since jenkins still uses the +# old name. Will be removed when Jenkins is updated. + +# Script to build and install zstd 1.5.6 on Ubuntu 24, with -fPIC flag. +# The default installation of zstd on Ubuntu 24 does not have -fPIC flag +# enabled, which is required for building DPC++ in shared libraries mode. + +# Function to check if the OS is Ubuntu 24 +check_os() { + . /etc/os-release + if [[ "$NAME" != "Ubuntu" || "$VERSION_ID" != "24.04" ]]; then + echo "Warning: This script has only been tested with Ubuntu 24." + fi +} + +# Function to install packages with or without sudo +install_packages() { + if [ "$USE_SUDO" = true ]; then + sudo apt-get update + sudo apt-get install -y build-essential wget + else + apt-get update + apt-get install -y build-essential wget + fi +} + +# Function to uninstall libzstd-dev if installed +uninstall_libzstd_dev() { + if dpkg -l | grep -q libzstd-dev; then + if [ "$USE_SUDO" = true ]; then + sudo apt-get remove -y libzstd-dev + else + apt-get remove -y libzstd-dev + fi + fi +} + +# Function to build a shared library by linking zstd static lib. +# This is used to verify that zstd is built correctly, with -fPIC flag. +build_test_program() { + cat < test_zstd.c + #include + int main() { + ZSTD_CCtx* cctx = ZSTD_createCCtx(); + ZSTD_freeCCtx(cctx); + return 0; + } +EOF + + # Try to use zstd's static library with -fPIC + gcc test_zstd.c -lzstd -fPIC -shared + if [ $? -ne 0 ]; then + echo "zstd installation verification failed." + else + echo "zstd installation verification passed." + fi + + # There won't be a.out file if verification failed. + rm test_zstd.c a.out || true +} + +# Check the OS +check_os + +# Set USE_SUDO to true or false based on your preference +USE_SUDO=true + +# Install necessary build tools +install_packages + +# Uninstall libzstd-dev package if installed +uninstall_libzstd_dev + +# Define the version and URL for zstd +ZSTD_VERSION="1.5.6" +ZSTD_URL="https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" + +# Create a directory for the source code +mkdir -p zstd_build +cd zstd_build + +# Download and extract zstd source code +wget $ZSTD_URL +tar -xzf zstd-$ZSTD_VERSION.tar.gz +cd zstd-$ZSTD_VERSION + +# Build zstd with -fPIC flag. +CFLAGS="-fPIC" CXXFLAGS="-fPIC" make +if [ $? -ne 0 ]; then + echo "Error: make failed." + exit 1 +fi + +# Install zstd. +if [ "$USE_SUDO" = true ]; then + sudo make install +else + make install +fi +if [ $? -ne 0 ]; then + echo "Error: make install failed." + exit 1 +fi + +# Verify zstd installation. +build_test_program + +# Clean up +rm -rf zstd_build