From e2048b2d3d11b4ff51b0ed74633630e67c89aa97 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Wed, 21 Aug 2024 14:35:13 +0200 Subject: [PATCH 01/28] Add build scripts for XRT --- X/xrt/build_tarballs.jl | 78 ++++++++++++++++++++++++++++++++++ X/xrt/patches/huge_shift.patch | 13 ++++++ 2 files changed, 91 insertions(+) create mode 100644 X/xrt/build_tarballs.jl create mode 100644 X/xrt/patches/huge_shift.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl new file mode 100644 index 00000000000..87b16f99818 --- /dev/null +++ b/X/xrt/build_tarballs.jl @@ -0,0 +1,78 @@ +using BinaryBuilder, Pkg + +name = "xrt" +version = v"2.17" +sources = [ + GitSource("https://github.com/Xilinx/XRT.git", "a75e9843c875bac0f52d34a1763e39e16fb3c9a7"), + GitSource("https://github.com/Tencent/rapidjson.git", "ab1842a2dae061284c0a62dca1cc6d5e7e37e346"), + DirectorySource("$(pwd())/patches") +] + +script = raw""" +# Copy license +mkdir -p ${WORKSPACE}/destdir/share/licenses/xrt +cp ${WORKSPACE}/srcdir/XRT/LICENSE ${WORKSPACE}/destdir/share/licenses/xrt + +# Install rapidjson +cd ${WORKSPACE}/srcdir/rapidjson +cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX=${WORKSPACE}/srcdir/rapidjson/install \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DRAPIDJSON_BUILD_DOC=No \ + -DRAPIDJSON_BUILD_EXAMPLES=No \ + -DRAPIDJSON_BUILD_TESTS=No \ + -DRAPIDJSON_BUILD_CXX17=Yes +cmake --build build --parallel ${nproc} +cmake --install build + +cd ${WORKSPACE}/srcdir/XRT +# Apply patch with missing define +git apply ../huge_shift.patch + +# Statically link to boost +export XRT_BOOST_INSTALL=${WORKSPACE}/destdir + +cd src +cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DCMAKE_PREFIX_PATH=${WORKSPACE}/srcdir/rapidjson/install \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release +cmake --build build --parallel ${nproc} +cmake --install build + +# Copy folder from xrt to folder to root dest folder +cd ${WORKSPACE}/destdir/ +cp -r ./xrt/* ./ +rm -rf xrt +""" + +platforms = supported_platforms() +platforms = expand_cxxstring_abis(platforms) +filter!(p -> arch(p) == "x86_64" && libc(p) == "glibc", platforms) + +products = [ + LibraryProduct("libxrt_coreutil", :libxrt_coreutil), + LibraryProduct("libxilinxopencl", :libxilinxopencl), +] + + +dependencies = [ + Dependency("Libuuid_jll"), + BuildDependency("boost_jll"), + Dependency("OpenSSL_jll"), + Dependency("libdrm_jll"), + Dependency("Ncurses_jll"), + Dependency("LibYAML_jll"), + BuildDependency("OpenCL_Headers_jll"), + Dependency("protobuf_c_jll"), + BuildDependency("ELFIO_jll"), + Dependency("ocl_icd_jll"), + Dependency("LibCURL_jll"), + Dependency("systemtap_jll"), + Dependency("systemd_jll"), + Dependency("Libffi_jll") +] + +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"9") \ No newline at end of file diff --git a/X/xrt/patches/huge_shift.patch b/X/xrt/patches/huge_shift.patch new file mode 100644 index 00000000000..9952b82db06 --- /dev/null +++ b/X/xrt/patches/huge_shift.patch @@ -0,0 +1,13 @@ +diff --git a/src/runtime_src/core/pcie/linux/shim.cpp b/src/runtime_src/core/pcie/linux/shim.cpp +index cba0f69a9..18cb9e03a 100644 +--- a/src/runtime_src/core/pcie/linux/shim.cpp ++++ b/src/runtime_src/core/pcie/linux/shim.cpp +@@ -64,6 +64,8 @@ + #define SHIM_UNUSED __attribute__((unused)) + #endif + ++#define MAP_HUGE_SHIFT 26 ++ + #define GB(x) ((size_t) (x) << 30) + #define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0])) + From 2a15a7269b466263739a17c4d034840499ed6afe Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:01:15 +0200 Subject: [PATCH 02/28] Refactoring and use of atomic_patch --- X/xrt/build_tarballs.jl | 10 ++++------ X/xrt/{ => bundled}/patches/huge_shift.patch | 0 2 files changed, 4 insertions(+), 6 deletions(-) rename X/xrt/{ => bundled}/patches/huge_shift.patch (100%) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 87b16f99818..e5dd14a32e2 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -5,14 +5,10 @@ version = v"2.17" sources = [ GitSource("https://github.com/Xilinx/XRT.git", "a75e9843c875bac0f52d34a1763e39e16fb3c9a7"), GitSource("https://github.com/Tencent/rapidjson.git", "ab1842a2dae061284c0a62dca1cc6d5e7e37e346"), - DirectorySource("$(pwd())/patches") + DirectorySource("./bundled") ] script = raw""" -# Copy license -mkdir -p ${WORKSPACE}/destdir/share/licenses/xrt -cp ${WORKSPACE}/srcdir/XRT/LICENSE ${WORKSPACE}/destdir/share/licenses/xrt - # Install rapidjson cd ${WORKSPACE}/srcdir/rapidjson cmake -S . -B build \ @@ -27,8 +23,10 @@ cmake --build build --parallel ${nproc} cmake --install build cd ${WORKSPACE}/srcdir/XRT +install_license LICENSE + # Apply patch with missing define -git apply ../huge_shift.patch +atomic_patch -p1 ../patches/huge_shift.patch # Statically link to boost export XRT_BOOST_INSTALL=${WORKSPACE}/destdir diff --git a/X/xrt/patches/huge_shift.patch b/X/xrt/bundled/patches/huge_shift.patch similarity index 100% rename from X/xrt/patches/huge_shift.patch rename to X/xrt/bundled/patches/huge_shift.patch From a5a8b7df160ae96bfbe2d766c4116682a54a6984 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:05:15 +0200 Subject: [PATCH 03/28] Adding comments --- X/xrt/build_tarballs.jl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index e5dd14a32e2..e345cca4feb 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -1,13 +1,18 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message using BinaryBuilder, Pkg name = "xrt" version = v"2.17" + +# Collection of sources required to complete build sources = [ GitSource("https://github.com/Xilinx/XRT.git", "a75e9843c875bac0f52d34a1763e39e16fb3c9a7"), GitSource("https://github.com/Tencent/rapidjson.git", "ab1842a2dae061284c0a62dca1cc6d5e7e37e346"), DirectorySource("./bundled") ] +# Bash recipe for building across all platforms script = raw""" # Install rapidjson cd ${WORKSPACE}/srcdir/rapidjson @@ -46,16 +51,19 @@ cp -r ./xrt/* ./ rm -rf xrt """ +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line platforms = supported_platforms() platforms = expand_cxxstring_abis(platforms) filter!(p -> arch(p) == "x86_64" && libc(p) == "glibc", platforms) +# The products that we will ensure are always built products = [ LibraryProduct("libxrt_coreutil", :libxrt_coreutil), LibraryProduct("libxilinxopencl", :libxilinxopencl), ] - +# Dependencies that must be installed before this package can be built dependencies = [ Dependency("Libuuid_jll"), BuildDependency("boost_jll"), @@ -73,4 +81,6 @@ dependencies = [ Dependency("Libffi_jll") ] -build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"9") \ No newline at end of file +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; + julia_compat="1.6", preferred_gcc_version=v"9") \ No newline at end of file From 130ad3ed1d3058d243a1fdd3e64a5b74c84a8887 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:08:20 +0200 Subject: [PATCH 04/28] Clean up using line --- X/xrt/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index e345cca4feb..769ea3b975b 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -1,6 +1,6 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message -using BinaryBuilder, Pkg +using BinaryBuilder name = "xrt" version = v"2.17" From 8031dd097fc6c3027b1418d0aca73f7b7d4d0edc Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:10:06 +0200 Subject: [PATCH 05/28] Update patch for the use with atomic_patch --- X/xrt/bundled/patches/huge_shift.patch | 2 -- 1 file changed, 2 deletions(-) diff --git a/X/xrt/bundled/patches/huge_shift.patch b/X/xrt/bundled/patches/huge_shift.patch index 9952b82db06..f64fbf2604a 100644 --- a/X/xrt/bundled/patches/huge_shift.patch +++ b/X/xrt/bundled/patches/huge_shift.patch @@ -1,5 +1,3 @@ -diff --git a/src/runtime_src/core/pcie/linux/shim.cpp b/src/runtime_src/core/pcie/linux/shim.cpp -index cba0f69a9..18cb9e03a 100644 --- a/src/runtime_src/core/pcie/linux/shim.cpp +++ b/src/runtime_src/core/pcie/linux/shim.cpp @@ -64,6 +64,8 @@ From 9cb47fa5e13aca2c3c26780c019c2405146a33da Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:20:11 +0200 Subject: [PATCH 06/28] Rearrange linux patch --- X/xrt/build_tarballs.jl | 2 +- X/xrt/bundled/patches/{ => linux}/huge_shift.patch | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename X/xrt/bundled/patches/{ => linux}/huge_shift.patch (100%) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 769ea3b975b..9223681e3ec 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -31,7 +31,7 @@ cd ${WORKSPACE}/srcdir/XRT install_license LICENSE # Apply patch with missing define -atomic_patch -p1 ../patches/huge_shift.patch +atomic_patch -p1 ../patches/linux/huge_shift.patch # Statically link to boost export XRT_BOOST_INSTALL=${WORKSPACE}/destdir diff --git a/X/xrt/bundled/patches/huge_shift.patch b/X/xrt/bundled/patches/linux/huge_shift.patch similarity index 100% rename from X/xrt/bundled/patches/huge_shift.patch rename to X/xrt/bundled/patches/linux/huge_shift.patch From 13736714d36ffe983afff778a417fa5a9d7c1e60 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:20:25 +0200 Subject: [PATCH 07/28] Add windows patches --- .../patches/windows/add_xclbinutil_libs.patch | 11 +++++++++++ X/xrt/bundled/patches/windows/no_static_boost.patch | 13 +++++++++++++ .../windows/remove duplicate_type_defs.patch | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch create mode 100644 X/xrt/bundled/patches/windows/no_static_boost.patch create mode 100644 X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch diff --git a/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch b/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch new file mode 100644 index 00000000000..f1cacf634f8 --- /dev/null +++ b/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch @@ -0,0 +1,11 @@ +--- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt ++++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt +@@ -82,6 +82,8 @@ add_executable(${XCLBINUTIL_NAME} ${XCLBINUTIL_SRCS}) + # Signing xclbin images currently is not support on windows + if(NOT WIN32) + target_link_libraries(${XCLBINUTIL_NAME} PRIVATE crypto) ++else() ++ target_link_libraries(${XCLBINUTIL_NAME} PRIVATE wsock32 ws2_32) + endif() + + # Add compile definitions diff --git a/X/xrt/bundled/patches/windows/no_static_boost.patch b/X/xrt/bundled/patches/windows/no_static_boost.patch new file mode 100644 index 00000000000..ac536b97456 --- /dev/null +++ b/X/xrt/bundled/patches/windows/no_static_boost.patch @@ -0,0 +1,13 @@ +diff --git a/src/CMake/nativeWin.cmake b/src/CMake/nativeWin.cmake +index 571b1cf66..646dd092b 100644 +--- a/src/CMake/nativeWin.cmake ++++ b/src/CMake/nativeWin.cmake +@@ -29,7 +29,7 @@ endif(GIT_FOUND) + + INCLUDE (FindBoost) + set(Boost_USE_MULTITHREADED ON) +-set(Boost_USE_STATIC_LIBS ON) ++set(Boost_USE_STATIC_LIBS OFF) + find_package(Boost + REQUIRED COMPONENTS system filesystem program_options) + diff --git a/X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch b/X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch new file mode 100644 index 00000000000..612d9e2c5f7 --- /dev/null +++ b/X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch @@ -0,0 +1,13 @@ +--- a/src/runtime_src/core/include/windows/types.h ++++ b/src/runtime_src/core/include/windows/types.h +@@ -19,7 +19,7 @@ + + #include + +-typedef int64_t ssize_t; +-typedef int pid_t; ++// typedef int64_t ssize_t; ++// typedef int pid_t; + + #endif + \ No newline at end of file From 455ef1477672f496b5054e4302fa5e5e85ccae6e Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 11:54:17 +0200 Subject: [PATCH 08/28] Patch RapidJSON dependency --- X/xrt/build_tarballs.jl | 2 ++ .../patches/fix_xclbinutil_cmake.patch | 19 +++++++++++++++++++ .../patches/windows/add_xclbinutil_libs.patch | 11 ----------- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 X/xrt/bundled/patches/fix_xclbinutil_cmake.patch delete mode 100644 X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 9223681e3ec..183054b1d18 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -32,6 +32,8 @@ install_license LICENSE # Apply patch with missing define atomic_patch -p1 ../patches/linux/huge_shift.patch +# Explicitly add RapidJSON include paths +atomic_patch -p1 ../patches/fix_xclbinutil_cmake.patch # Statically link to boost export XRT_BOOST_INSTALL=${WORKSPACE}/destdir diff --git a/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch b/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch new file mode 100644 index 00000000000..8685d44a4d1 --- /dev/null +++ b/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch @@ -0,0 +1,19 @@ +diff --git a/src/runtime_src/tools/xclbinutil/CMakeLists.txt b/src/runtime_src/tools/xclbinutil/CMakeLists.txt +index 4c8a89232..58a211012 100644 +--- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt ++++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt +@@ -79,9 +79,14 @@ set(XCLBINUTIL_SRCS ${XCLBINUTIL_MAIN_FILE} ${XCLBINUTIL_FILES_SRCS}) + + add_executable(${XCLBINUTIL_NAME} ${XCLBINUTIL_SRCS}) + ++message(STATUS "RapidJSON include dir:" ${RapidJSON_INCLUDE_DIRS}) ++target_include_directories(${XCLBINUTIL_NAME} PRIVATE ${RapidJSON_INCLUDE_DIRS}/..) ++ + # Signing xclbin images currently is not support on windows + if(NOT WIN32) + target_link_libraries(${XCLBINUTIL_NAME} PRIVATE crypto) ++else() ++ target_link_libraries(${XCLBINUTIL_NAME} PRIVATE wsock32 ws2_32) + endif() + + # Add compile definitions diff --git a/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch b/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch deleted file mode 100644 index f1cacf634f8..00000000000 --- a/X/xrt/bundled/patches/windows/add_xclbinutil_libs.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt -+++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt -@@ -82,6 +82,8 @@ add_executable(${XCLBINUTIL_NAME} ${XCLBINUTIL_SRCS}) - # Signing xclbin images currently is not support on windows - if(NOT WIN32) - target_link_libraries(${XCLBINUTIL_NAME} PRIVATE crypto) -+else() -+ target_link_libraries(${XCLBINUTIL_NAME} PRIVATE wsock32 ws2_32) - endif() - - # Add compile definitions From 45556cc87d5c67907b772bfad0ef844767e034f0 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 16:59:09 +0200 Subject: [PATCH 09/28] Apply patches for mingw support --- X/xrt/build_tarballs.jl | 41 +++++++++---- .../patches/windows/config_reader.patch | 11 ++++ .../patches/windows/disable_trace.patch | 59 +++++++++++++++++++ ...patch => remove_duplicate_type_defs.patch} | 0 4 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 X/xrt/bundled/patches/windows/config_reader.patch create mode 100644 X/xrt/bundled/patches/windows/disable_trace.patch rename X/xrt/bundled/patches/windows/{remove duplicate_type_defs.patch => remove_duplicate_type_defs.patch} (100%) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 183054b1d18..2a67a0e00cc 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -35,6 +35,18 @@ atomic_patch -p1 ../patches/linux/huge_shift.patch # Explicitly add RapidJSON include paths atomic_patch -p1 ../patches/fix_xclbinutil_cmake.patch +# mingw patches +atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch +atomic_patch -p1 ../patches/windows/disable_trace.patch +atomic_patch -p1 ../patches/windows/config_reader.patch + +atomic_patch -p1 ../patches/windows/no_static_boost.patch + + +if [[ "${target}" == *-w64-* ]]; then + export ADDITIONAL_CMAKE_CXX_FLAGS=-fpermissive -D_WINDOWS +fi + # Statically link to boost export XRT_BOOST_INSTALL=${WORKSPACE}/destdir @@ -43,6 +55,7 @@ cmake -S . -B build \ -DCMAKE_INSTALL_PREFIX=${prefix} \ -DCMAKE_PREFIX_PATH=${WORKSPACE}/srcdir/rapidjson/install \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_CXX_FLAGS="${ADDITIONAL_CMAKE_CXX_FLAGS}" \ -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel ${nproc} cmake --install build @@ -57,7 +70,8 @@ rm -rf xrt # platforms are passed in on the command line platforms = supported_platforms() platforms = expand_cxxstring_abis(platforms) -filter!(p -> arch(p) == "x86_64" && libc(p) == "glibc", platforms) +filter!(p -> arch(p) == "x86_64", platforms) +filter!(p -> Sys.iswindows(p) || (Sys.islinux(p) && libc(p) == "glibc"), platforms) # The products that we will ensure are always built products = [ @@ -67,20 +81,21 @@ products = [ # Dependencies that must be installed before this package can be built dependencies = [ - Dependency("Libuuid_jll"), BuildDependency("boost_jll"), - Dependency("OpenSSL_jll"), - Dependency("libdrm_jll"), - Dependency("Ncurses_jll"), - Dependency("LibYAML_jll"), - BuildDependency("OpenCL_Headers_jll"), - Dependency("protobuf_c_jll"), BuildDependency("ELFIO_jll"), - Dependency("ocl_icd_jll"), - Dependency("LibCURL_jll"), - Dependency("systemtap_jll"), - Dependency("systemd_jll"), - Dependency("Libffi_jll") + BuildDependency("OpenCL_Headers_jll"), + Dependency("Libffi_jll"), + Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("libdrm_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("LibYAML_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("Ncurses_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("ocl_icd_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("OpenSSL_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("protobuf_c_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("systemd_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("systemtap_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("OpenCL_jll", platforms=filter(Sys.iswindows, platforms)), ] # Build the tarballs, and possibly a `build.jl` as well. diff --git a/X/xrt/bundled/patches/windows/config_reader.patch b/X/xrt/bundled/patches/windows/config_reader.patch new file mode 100644 index 00000000000..e8646ca31fc --- /dev/null +++ b/X/xrt/bundled/patches/windows/config_reader.patch @@ -0,0 +1,11 @@ +--- a/src/runtime_src/core/common/config_reader.cpp ++++ b/src/runtime_src/core/common/config_reader.cpp +@@ -85,7 +85,7 @@ is_true(const std::string& str) + static std::string + get_self_path() + { +-#ifdef __GNUC__ ++#ifdef __linux__ + char buf[PATH_MAX] = {0}; + auto len = ::readlink("/proc/self/exe", buf, PATH_MAX); + return std::string(buf, (len>0) ? len : 0); diff --git a/X/xrt/bundled/patches/windows/disable_trace.patch b/X/xrt/bundled/patches/windows/disable_trace.patch new file mode 100644 index 00000000000..7d4d72a54f9 --- /dev/null +++ b/X/xrt/bundled/patches/windows/disable_trace.patch @@ -0,0 +1,59 @@ +--- a/src/runtime_src/core/common/detail/windows/trace.h ++++ b/src/runtime_src/core/common/detail/windows/trace.h +@@ -23,11 +23,11 @@ + #include "core/common/trace.h" + #include + #include +-#include ++// #include + + // Forward declare the logging provider object. The provider + // is defined in a single compilation unit (core/common/trace.cpp). +-TRACELOGGING_DECLARE_PROVIDER(g_logging_provider); ++// TRACELOGGING_DECLARE_PROVIDER(g_logging_provider); + + namespace xrt_core::trace::detail { + +@@ -35,30 +35,30 @@ template + inline void + add_event(ProbeType&& p) + { +- TraceLoggingWrite(g_logging_provider, +- "XRTTraceEvent", // must be a string literal +- TraceLoggingValue(std::forward(p), "Event")); ++ // TraceLoggingWrite(g_logging_provider, ++ // "XRTTraceEvent", // must be a string literal ++ // TraceLoggingValue(std::forward(p), "Event")); + } + + template + inline void + add_event(ProbeType&& p, A1&& a1) + { +- TraceLoggingWrite(g_logging_provider, +- "XRTTraceEvent", // must be a string literal +- TraceLoggingValue(std::forward(p), "Event"), +- TraceLoggingValue(std::forward(a1), "arg1")); ++ // TraceLoggingWrite(g_logging_provider, ++ // "XRTTraceEvent", // must be a string literal ++ // TraceLoggingValue(std::forward(p), "Event"), ++ // TraceLoggingValue(std::forward(a1), "arg1")); + } + + template + inline void + add_event(ProbeType&& p, A1&& a1, A2&& a2) + { +- TraceLoggingWrite(g_logging_provider, +- "XRTTraceEvent", // must be a string literal +- TraceLoggingValue(std::forward(p), "Event"), +- TraceLoggingValue(std::forward(a1), "arg1"), +- TraceLoggingValue(std::forward(a1), "arg2")); ++ // TraceLoggingWrite(g_logging_provider, ++ // "XRTTraceEvent", // must be a string literal ++ // TraceLoggingValue(std::forward(p), "Event"), ++ // TraceLoggingValue(std::forward(a1), "arg1"), ++ // TraceLoggingValue(std::forward(a1), "arg2")); + } + + template diff --git a/X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch b/X/xrt/bundled/patches/windows/remove_duplicate_type_defs.patch similarity index 100% rename from X/xrt/bundled/patches/windows/remove duplicate_type_defs.patch rename to X/xrt/bundled/patches/windows/remove_duplicate_type_defs.patch From 28f668dd046786a7a6a3c75e6ad5e1917086fa5f Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 17:26:45 +0200 Subject: [PATCH 10/28] Fix cxx flags --- X/xrt/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 2a67a0e00cc..431d7c55029 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -44,7 +44,7 @@ atomic_patch -p1 ../patches/windows/no_static_boost.patch if [[ "${target}" == *-w64-* ]]; then - export ADDITIONAL_CMAKE_CXX_FLAGS=-fpermissive -D_WINDOWS + export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi # Statically link to boost From 367d1731dfed7918eb52700b44ac4bc3595b39d6 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 17:38:17 +0200 Subject: [PATCH 11/28] Fix include upper case --- X/xrt/build_tarballs.jl | 1 + X/xrt/bundled/patches/windows/unistd.patch | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/unistd.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 431d7c55029..571ab12e53e 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -39,6 +39,7 @@ atomic_patch -p1 ../patches/fix_xclbinutil_cmake.patch atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch atomic_patch -p1 ../patches/windows/disable_trace.patch atomic_patch -p1 ../patches/windows/config_reader.patch +atomic_patch -p1 ../patches/windows/unistd.patch atomic_patch -p1 ../patches/windows/no_static_boost.patch diff --git a/X/xrt/bundled/patches/windows/unistd.patch b/X/xrt/bundled/patches/windows/unistd.patch new file mode 100644 index 00000000000..e920a810323 --- /dev/null +++ b/X/xrt/bundled/patches/windows/unistd.patch @@ -0,0 +1,11 @@ +--- a/src/runtime_src/core/common/unistd.h ++++ b/src/runtime_src/core/common/unistd.h +@@ -20,7 +20,7 @@ + #ifndef _WIN32 + #include + #else +-#include ++#include + #endif + + namespace xrt_core { From 1133539a32700c514f292e205c953d267085a8e4 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 17:55:49 +0200 Subject: [PATCH 12/28] Use ocl_icd bindings for windows --- X/xrt/build_tarballs.jl | 4 +-- .../patches/windows/ocl_bindings.patch | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 X/xrt/bundled/patches/windows/ocl_bindings.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 571ab12e53e..a63092a530a 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -40,6 +40,7 @@ atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch atomic_patch -p1 ../patches/windows/disable_trace.patch atomic_patch -p1 ../patches/windows/config_reader.patch atomic_patch -p1 ../patches/windows/unistd.patch +atomic_patch -p1 ../patches/windows/ocl_bindings.patch atomic_patch -p1 ../patches/windows/no_static_boost.patch @@ -85,18 +86,17 @@ dependencies = [ BuildDependency("boost_jll"), BuildDependency("ELFIO_jll"), BuildDependency("OpenCL_Headers_jll"), + Dependency("ocl_icd_jll"), Dependency("Libffi_jll"), Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms)), Dependency("libdrm_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), Dependency("LibYAML_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Ncurses_jll", platforms=filter(Sys.islinux, platforms)), - Dependency("ocl_icd_jll", platforms=filter(Sys.islinux, platforms)), Dependency("OpenSSL_jll", platforms=filter(Sys.islinux, platforms)), Dependency("protobuf_c_jll", platforms=filter(Sys.islinux, platforms)), Dependency("systemd_jll", platforms=filter(Sys.islinux, platforms)), Dependency("systemtap_jll", platforms=filter(Sys.islinux, platforms)), - Dependency("OpenCL_jll", platforms=filter(Sys.iswindows, platforms)), ] # Build the tarballs, and possibly a `build.jl` as well. diff --git a/X/xrt/bundled/patches/windows/ocl_bindings.patch b/X/xrt/bundled/patches/windows/ocl_bindings.patch new file mode 100644 index 00000000000..bb6454c6f5b --- /dev/null +++ b/X/xrt/bundled/patches/windows/ocl_bindings.patch @@ -0,0 +1,27 @@ +--- a/src/runtime_src/xocl/api/icd/ocl_icd_bindings.h ++++ b/src/runtime_src/xocl/api/icd/ocl_icd_bindings.h +@@ -17,16 +17,16 @@ + #define xocl_api_icd_ocl_icd_bindings_h_ + + #ifndef CL_TARGET_OPENCL_VERSION +-# define CL_TARGET_OPENCL_VERSION 200 ++#define CL_TARGET_OPENCL_VERSION 200 + #endif + +-#ifdef _WIN32 +-# define NOMINMAX +-# include "windows/icd_dispatch.h" +-using _cl_icd_dispatch = KHRicdVendorDispatchRec; +-#else +-# include +-#endif ++// #ifdef _WIN32 ++// # define NOMINMAX ++// # include "windows/icd_dispatch.h" ++// using _cl_icd_dispatch = KHRicdVendorDispatchRec; ++// #else ++#include ++// #endif + extern const _cl_icd_dispatch cl_icd_dispatch; + + #endif From 0009c8fe28e45518b261ea1723cf95b45aea0231 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 17:59:13 +0200 Subject: [PATCH 13/28] Add compat for libcurl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com> --- X/xrt/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index a63092a530a..2e0c157bf8b 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -88,7 +88,7 @@ dependencies = [ BuildDependency("OpenCL_Headers_jll"), Dependency("ocl_icd_jll"), Dependency("Libffi_jll"), - Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms); compat="7.73, 8"), Dependency("libdrm_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), Dependency("LibYAML_jll", platforms=filter(Sys.islinux, platforms)), From ddb3a0698b0e6df2fc37b6cada578b249833408f Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 18:00:05 +0200 Subject: [PATCH 14/28] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com> --- X/xrt/build_tarballs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 2e0c157bf8b..2d82e7937dd 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -93,7 +93,7 @@ dependencies = [ Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), Dependency("LibYAML_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Ncurses_jll", platforms=filter(Sys.islinux, platforms)), - Dependency("OpenSSL_jll", platforms=filter(Sys.islinux, platforms)), + Dependency("OpenSSL_jll", platforms=filter(Sys.islinux, platforms); compat="3.0.8"), Dependency("protobuf_c_jll", platforms=filter(Sys.islinux, platforms)), Dependency("systemd_jll", platforms=filter(Sys.islinux, platforms)), Dependency("systemtap_jll", platforms=filter(Sys.islinux, platforms)), @@ -101,4 +101,4 @@ dependencies = [ # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version=v"9") \ No newline at end of file + julia_compat="1.6", preferred_gcc_version=v"9") From 62d98d64f4692518b7cc3ac485e0b71484229981 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 23 Aug 2024 18:31:57 +0200 Subject: [PATCH 15/28] Further patching for windows version --- X/xrt/build_tarballs.jl | 1 + .../patches/windows/aligned_malloc.patch | 23 +++++++++++ .../patches/windows/disable_trace.patch | 41 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/aligned_malloc.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 2d82e7937dd..3a1411dfe60 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -41,6 +41,7 @@ atomic_patch -p1 ../patches/windows/disable_trace.patch atomic_patch -p1 ../patches/windows/config_reader.patch atomic_patch -p1 ../patches/windows/unistd.patch atomic_patch -p1 ../patches/windows/ocl_bindings.patch +atomic_patch -p1 ../patches/windows/aligned_malloc.patch atomic_patch -p1 ../patches/windows/no_static_boost.patch diff --git a/X/xrt/bundled/patches/windows/aligned_malloc.patch b/X/xrt/bundled/patches/windows/aligned_malloc.patch new file mode 100644 index 00000000000..6a7c28a78b1 --- /dev/null +++ b/X/xrt/bundled/patches/windows/aligned_malloc.patch @@ -0,0 +1,23 @@ +diff --git a/src/runtime_src/core/common/memalign.h b/src/runtime_src/core/common/memalign.h +index 98caadc4a..f0710ea0a 100644 +--- a/src/runtime_src/core/common/memalign.h ++++ b/src/runtime_src/core/common/memalign.h +@@ -21,6 +21,18 @@ + #include + #include + ++// Add memalgin definitions here since ++// they are not present because of a bug: ++// https://sourceforge.net/p/mingw-w64/bugs/192/ ++extern void * _aligned_malloc( ++ size_t size, ++ size_t alignment ++); ++ ++extern void _aligned_free ( ++ void *memblock ++); ++ + namespace xrt_core { + + inline int diff --git a/X/xrt/bundled/patches/windows/disable_trace.patch b/X/xrt/bundled/patches/windows/disable_trace.patch index 7d4d72a54f9..d767dcf5a8e 100644 --- a/X/xrt/bundled/patches/windows/disable_trace.patch +++ b/X/xrt/bundled/patches/windows/disable_trace.patch @@ -57,3 +57,44 @@ } template + +--- a/src/runtime_src/core/common/detail/windows/trace_init.h ++++ b/src/runtime_src/core/common/detail/windows/trace_init.h +@@ -27,14 +27,14 @@ + // ... + + #include +-#include ++// #include + + // [System.Diagnostics.Tracing.EventSource]::new("XRT").Guid + // e3e140bd-8a94-50be-2264-48e444a715db +-TRACELOGGING_DEFINE_PROVIDER( +- g_logging_provider, +- "XRT", +- (0xe3e140bd, 0x8a94, 0x50be, 0x22, 0x64, 0x48, 0xe4, 0x44, 0xa7, 0x15, 0xdb)); ++// TRACELOGGING_DEFINE_PROVIDER( ++// g_logging_provider, ++// "XRT", ++// (0xe3e140bd, 0x8a94, 0x50be, 0x22, 0x64, 0x48, 0xe4, 0x44, 0xa7, 0x15, 0xdb)); + + namespace xrt_core::trace::detail { + +@@ -43,7 +43,7 @@ namespace xrt_core::trace::detail { + inline void + init_trace_logging() + { +- TraceLoggingRegister(g_logging_provider); ++ // TraceLoggingRegister(g_logging_provider); + } + + // Deinitialize trace logging. This function is called exactly once +@@ -51,7 +51,7 @@ init_trace_logging() + inline void + deinit_trace_logging() + { +- TraceLoggingUnregister(g_logging_provider); ++ // TraceLoggingUnregister(g_logging_provider); + } + + } // namespace xrt_core::trace::detail From 847ca3e443a15e9419abab742932435f6b079a68 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Mon, 26 Aug 2024 14:33:47 +0200 Subject: [PATCH 16/28] Use rapidjson package --- X/xrt/build_tarballs.jl | 19 +++---------------- .../patches/fix_xclbinutil_cmake.patch | 19 ------------------- .../patches/windows/aligned_malloc.patch | 2 -- .../windows/fix_xclbinutil_cmake.patch | 11 +++++++++++ .../patches/windows/no_static_boost.patch | 2 -- 5 files changed, 14 insertions(+), 39 deletions(-) delete mode 100644 X/xrt/bundled/patches/fix_xclbinutil_cmake.patch create mode 100644 X/xrt/bundled/patches/windows/fix_xclbinutil_cmake.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 3a1411dfe60..62ecfd6e18b 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -8,34 +8,20 @@ version = v"2.17" # Collection of sources required to complete build sources = [ GitSource("https://github.com/Xilinx/XRT.git", "a75e9843c875bac0f52d34a1763e39e16fb3c9a7"), - GitSource("https://github.com/Tencent/rapidjson.git", "ab1842a2dae061284c0a62dca1cc6d5e7e37e346"), DirectorySource("./bundled") ] # Bash recipe for building across all platforms script = raw""" -# Install rapidjson -cd ${WORKSPACE}/srcdir/rapidjson -cmake -S . -B build \ - -DCMAKE_INSTALL_PREFIX=${WORKSPACE}/srcdir/rapidjson/install \ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_BUILD_TYPE=Release \ - -DRAPIDJSON_BUILD_DOC=No \ - -DRAPIDJSON_BUILD_EXAMPLES=No \ - -DRAPIDJSON_BUILD_TESTS=No \ - -DRAPIDJSON_BUILD_CXX17=Yes -cmake --build build --parallel ${nproc} -cmake --install build cd ${WORKSPACE}/srcdir/XRT install_license LICENSE # Apply patch with missing define atomic_patch -p1 ../patches/linux/huge_shift.patch -# Explicitly add RapidJSON include paths -atomic_patch -p1 ../patches/fix_xclbinutil_cmake.patch # mingw patches +atomic_patch -p1 ../patches/windows/fix_xclbinutil_cmake.patch atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch atomic_patch -p1 ../patches/windows/disable_trace.patch atomic_patch -p1 ../patches/windows/config_reader.patch @@ -88,7 +74,8 @@ dependencies = [ BuildDependency("ELFIO_jll"), BuildDependency("OpenCL_Headers_jll"), Dependency("ocl_icd_jll"), - Dependency("Libffi_jll"), + Dependency("rapidjson_jll"), + # Dependency("Libffi_jll"), Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms); compat="7.73, 8"), Dependency("libdrm_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), diff --git a/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch b/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch deleted file mode 100644 index 8685d44a4d1..00000000000 --- a/X/xrt/bundled/patches/fix_xclbinutil_cmake.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/src/runtime_src/tools/xclbinutil/CMakeLists.txt b/src/runtime_src/tools/xclbinutil/CMakeLists.txt -index 4c8a89232..58a211012 100644 ---- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt -+++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt -@@ -79,9 +79,14 @@ set(XCLBINUTIL_SRCS ${XCLBINUTIL_MAIN_FILE} ${XCLBINUTIL_FILES_SRCS}) - - add_executable(${XCLBINUTIL_NAME} ${XCLBINUTIL_SRCS}) - -+message(STATUS "RapidJSON include dir:" ${RapidJSON_INCLUDE_DIRS}) -+target_include_directories(${XCLBINUTIL_NAME} PRIVATE ${RapidJSON_INCLUDE_DIRS}/..) -+ - # Signing xclbin images currently is not support on windows - if(NOT WIN32) - target_link_libraries(${XCLBINUTIL_NAME} PRIVATE crypto) -+else() -+ target_link_libraries(${XCLBINUTIL_NAME} PRIVATE wsock32 ws2_32) - endif() - - # Add compile definitions diff --git a/X/xrt/bundled/patches/windows/aligned_malloc.patch b/X/xrt/bundled/patches/windows/aligned_malloc.patch index 6a7c28a78b1..a1d64992814 100644 --- a/X/xrt/bundled/patches/windows/aligned_malloc.patch +++ b/X/xrt/bundled/patches/windows/aligned_malloc.patch @@ -1,5 +1,3 @@ -diff --git a/src/runtime_src/core/common/memalign.h b/src/runtime_src/core/common/memalign.h -index 98caadc4a..f0710ea0a 100644 --- a/src/runtime_src/core/common/memalign.h +++ b/src/runtime_src/core/common/memalign.h @@ -21,6 +21,18 @@ diff --git a/X/xrt/bundled/patches/windows/fix_xclbinutil_cmake.patch b/X/xrt/bundled/patches/windows/fix_xclbinutil_cmake.patch new file mode 100644 index 00000000000..ace0aca9e88 --- /dev/null +++ b/X/xrt/bundled/patches/windows/fix_xclbinutil_cmake.patch @@ -0,0 +1,11 @@ +--- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt ++++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt +@@ -83,7 +83,9 @@ + # Signing xclbin images currently is not support on windows + if(NOT WIN32) + target_link_libraries(${XCLBINUTIL_NAME} PRIVATE crypto) ++else() ++ target_link_libraries(${XCLBINUTIL_NAME} PRIVATE wsock32 ws2_32) + endif() + + # Add compile definitions diff --git a/X/xrt/bundled/patches/windows/no_static_boost.patch b/X/xrt/bundled/patches/windows/no_static_boost.patch index ac536b97456..b303c54e947 100644 --- a/X/xrt/bundled/patches/windows/no_static_boost.patch +++ b/X/xrt/bundled/patches/windows/no_static_boost.patch @@ -1,5 +1,3 @@ -diff --git a/src/CMake/nativeWin.cmake b/src/CMake/nativeWin.cmake -index 571b1cf66..646dd092b 100644 --- a/src/CMake/nativeWin.cmake +++ b/src/CMake/nativeWin.cmake @@ -29,7 +29,7 @@ endif(GIT_FOUND) From 298ee1c569eee53911c00d77b2215662e7729eb4 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Mon, 26 Aug 2024 18:32:27 +0200 Subject: [PATCH 17/28] Sort patches by os --- X/xrt/build_tarballs.jl | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 62ecfd6e18b..348b538c8cb 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -13,26 +13,24 @@ sources = [ # Bash recipe for building across all platforms script = raw""" - cd ${WORKSPACE}/srcdir/XRT install_license LICENSE -# Apply patch with missing define -atomic_patch -p1 ../patches/linux/huge_shift.patch - -# mingw patches -atomic_patch -p1 ../patches/windows/fix_xclbinutil_cmake.patch -atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch -atomic_patch -p1 ../patches/windows/disable_trace.patch -atomic_patch -p1 ../patches/windows/config_reader.patch -atomic_patch -p1 ../patches/windows/unistd.patch -atomic_patch -p1 ../patches/windows/ocl_bindings.patch -atomic_patch -p1 ../patches/windows/aligned_malloc.patch - -atomic_patch -p1 ../patches/windows/no_static_boost.patch - +if [[ "${target}" == *-linux-* ]]; then + # Apply patch with missing define + atomic_patch -p1 ../patches/linux/huge_shift.patch +fi if [[ "${target}" == *-w64-* ]]; then + # mingw patches + atomic_patch -p1 ../patches/windows/fix_xclbinutil_cmake.patch + atomic_patch -p1 ../patches/windows/remove_duplicate_type_defs.patch + atomic_patch -p1 ../patches/windows/disable_trace.patch + atomic_patch -p1 ../patches/windows/config_reader.patch + atomic_patch -p1 ../patches/windows/unistd.patch + atomic_patch -p1 ../patches/windows/ocl_bindings.patch + atomic_patch -p1 ../patches/windows/aligned_malloc.patch + atomic_patch -p1 ../patches/windows/no_static_boost.patch export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi @@ -42,7 +40,6 @@ export XRT_BOOST_INSTALL=${WORKSPACE}/destdir cd src cmake -S . -B build \ -DCMAKE_INSTALL_PREFIX=${prefix} \ - -DCMAKE_PREFIX_PATH=${WORKSPACE}/srcdir/rapidjson/install \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_CXX_FLAGS="${ADDITIONAL_CMAKE_CXX_FLAGS}" \ -DCMAKE_BUILD_TYPE=Release From c11fc890cc1d294fbefd2e2285ac2ba36b1b0422 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 17:26:13 +0200 Subject: [PATCH 18/28] Patch library configs --- X/xrt/build_tarballs.jl | 1 + X/xrt/bundled/patches/windows/config.patch | 52 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/config.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 348b538c8cb..a218cc65699 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -31,6 +31,7 @@ if [[ "${target}" == *-w64-* ]]; then atomic_patch -p1 ../patches/windows/ocl_bindings.patch atomic_patch -p1 ../patches/windows/aligned_malloc.patch atomic_patch -p1 ../patches/windows/no_static_boost.patch + atomic_patch -p1 ../patches/windows/config.patch export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi diff --git a/X/xrt/bundled/patches/windows/config.patch b/X/xrt/bundled/patches/windows/config.patch new file mode 100644 index 00000000000..e22676a3e9a --- /dev/null +++ b/X/xrt/bundled/patches/windows/config.patch @@ -0,0 +1,52 @@ +--- a/src/runtime_src/core/common/config.h ++++ b/src/runtime_src/core/common/config.h +@@ -21,13 +21,13 @@ + //------------------Enable dynamic linking on windows-------------------------// + + #ifdef _WIN32 +-# ifdef XRT_CORE_COMMON_SOURCE +-# define XRT_CORE_COMMON_EXPORT __declspec(dllexport) +-# else +-# define XRT_CORE_COMMON_EXPORT __declspec(dllimport) +-# endif ++#ifdef XRT_CORE_COMMON_SOURCE ++#define XRT_CORE_COMMON_EXPORT __declspec(dllexport) ++#else ++#define XRT_CORE_COMMON_EXPORT __declspec(dllimport) ++#endif + #endif +-#ifdef __GNUC__ ++#ifndef _WIN32 + # ifdef XRT_CORE_COMMON_SOURCE + # define XRT_CORE_COMMON_EXPORT __attribute__ ((visibility("default"))) + # else +@@ -36,15 +36,15 @@ + #endif + + #ifndef XRT_CORE_COMMON_EXPORT +-# define XRT_CORE_COMMON_EXPORT ++#define XRT_CORE_COMMON_EXPORT + #endif + +-#ifdef __GNUC__ ++#ifndef _WIN32 + # define XRT_CORE_UNUSED __attribute__((unused)) + #endif + + #ifdef _WIN32 +-# define XRT_CORE_UNUSED ++#define XRT_CORE_UNUSED + #endif + + #endif +--- a/src/runtime_src/xocl/config.h ++++ b/src/runtime_src/xocl/config.h +@@ -29,7 +29,7 @@ + # endif + #endif + +-#ifdef __GNUC__ ++#ifndef _WIN32 + # ifdef XRT_XOCL_SOURCE + # define XRT_XOCL_EXPORT __attribute__ ((visibility("default"))) + # else From 215d584fb470c613036f014ba2e9bee91a59659f Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 17:47:06 +0200 Subject: [PATCH 19/28] Fix xdp link --- X/xrt/bundled/patches/windows/config.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/X/xrt/bundled/patches/windows/config.patch b/X/xrt/bundled/patches/windows/config.patch index e22676a3e9a..9fde03d6022 100644 --- a/X/xrt/bundled/patches/windows/config.patch +++ b/X/xrt/bundled/patches/windows/config.patch @@ -39,6 +39,26 @@ #endif #endif +--- a/src/runtime_src/xdp/config.h ++++ b/src/runtime_src/xdp/config.h +@@ -28,7 +28,7 @@ + #define XDP_CORE_EXPORT __declspec(dllimport) + #endif + #endif +-#ifdef __GNUC__ ++#ifndef _WIN32 + #ifdef XDP_CORE_SOURCE + #define XDP_CORE_EXPORT __attribute__ ((visibility("default"))) + #else +@@ -47,7 +47,7 @@ + #define XDP_PLUGIN_EXPORT __declspec(dllimport) + #endif + #endif +-#ifdef __GNUC__ ++#ifndef _WIN32 + #ifdef XDP_PLUGIN_SOURCE + #define XDP_PLUGIN_EXPORT __attribute__ ((visibility("default"))) + #else --- a/src/runtime_src/xocl/config.h +++ b/src/runtime_src/xocl/config.h @@ -29,7 +29,7 @@ From f18354e67a08aa636bebd8333f20abaa5e1dc844 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 18:15:44 +0200 Subject: [PATCH 20/28] Further library import and export fixes for mingw --- X/xrt/bundled/patches/windows/config.patch | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/X/xrt/bundled/patches/windows/config.patch b/X/xrt/bundled/patches/windows/config.patch index 9fde03d6022..440a2960850 100644 --- a/X/xrt/bundled/patches/windows/config.patch +++ b/X/xrt/bundled/patches/windows/config.patch @@ -39,6 +39,28 @@ #endif #endif +--- a/src/runtime_src/core/include/xrt/detail/config.h ++++ b/src/runtime_src/core/include/xrt/detail/config.h +@@ -12,7 +12,7 @@ + # define XRT_API_EXPORT __declspec(dllimport) + # endif + #endif +-#ifdef __GNUC__ ++#ifdef __linux__ + # ifdef XRT_API_SOURCE + # define XRT_API_EXPORT __attribute__ ((visibility("default"))) + # else +--- a/src/runtime_src/core/pcie/noop/config.h ++++ b/src/runtime_src/core/pcie/noop/config.h +@@ -27,7 +27,7 @@ + # define XRT_CORE_PCIE_NOOP_EXPORT __declspec(dllimport) + # endif + #endif +-#ifdef __GNUC__ ++#ifdef __linux__ + # ifdef XRT_CORE_PCIE_NOOP_SOURCE + # define XRT_CORE_PCIE_NOOP_EXPORT __attribute__ ((visibility("default"))) + # else --- a/src/runtime_src/xdp/config.h +++ b/src/runtime_src/xdp/config.h @@ -28,7 +28,7 @@ @@ -70,3 +92,23 @@ # ifdef XRT_XOCL_SOURCE # define XRT_XOCL_EXPORT __attribute__ ((visibility("default"))) # else +--- a/src/runtime_src/xrt/config.h ++++ b/src/runtime_src/xrt/config.h +@@ -26,7 +26,7 @@ + # define XRT_EXPORT __declspec(dllimport) + # endif + #endif +-#ifdef __GNUC__ ++#ifdef __linux__ + # ifdef XRT_SOURCE + # define XRT_EXPORT __attribute__ ((visibility("default"))) + # else +@@ -38,7 +38,7 @@ + # define XRT_EXPORT + #endif + +-#ifdef __GNUC__ ++#ifdef __linux__ + # define XRT_UNUSED __attribute__((unused)) + #endif + From 440b1599997bf07717f3e6c841f1d17a873d9ead Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 18:42:01 +0200 Subject: [PATCH 21/28] Add missing library --- X/xrt/build_tarballs.jl | 1 + X/xrt/bundled/patches/windows/xbutil.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/xbutil.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index a218cc65699..8ea1e92d074 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -32,6 +32,7 @@ if [[ "${target}" == *-w64-* ]]; then atomic_patch -p1 ../patches/windows/aligned_malloc.patch atomic_patch -p1 ../patches/windows/no_static_boost.patch atomic_patch -p1 ../patches/windows/config.patch + atomic_patch -p1 ../patches/windows/xbutil.patch export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi diff --git a/X/xrt/bundled/patches/windows/xbutil.patch b/X/xrt/bundled/patches/windows/xbutil.patch new file mode 100644 index 00000000000..b089595c147 --- /dev/null +++ b/X/xrt/bundled/patches/windows/xbutil.patch @@ -0,0 +1,13 @@ +diff --git a/src/runtime_src/core/tools/xbutil2/CMakeLists.txt b/src/runtime_src/core/tools/xbutil2/CMakeLists.txt +index 0e7f34439..965e2aa18 100644 +--- a/src/runtime_src/core/tools/xbutil2/CMakeLists.txt ++++ b/src/runtime_src/core/tools/xbutil2/CMakeLists.txt +@@ -101,6 +101,8 @@ target_link_libraries(${XBUTIL2_NAME} + + if (NOT WIN32) + target_link_libraries(${XBUTIL2_NAME} PRIVATE pthread uuid dl) ++else() ++ target_link_libraries(${XBUTIL2_NAME} PRIVATE ws2_32) + endif() + + # Package xrt sub commands json file for embedded builds From 3cf86f4fee93d4636eb5c296adf1f2d3a0a6584f Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 19:03:08 +0200 Subject: [PATCH 22/28] also patch alveo core --- X/xrt/bundled/patches/windows/config.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/X/xrt/bundled/patches/windows/config.patch b/X/xrt/bundled/patches/windows/config.patch index 440a2960850..a0d7fc4a9a7 100644 --- a/X/xrt/bundled/patches/windows/config.patch +++ b/X/xrt/bundled/patches/windows/config.patch @@ -61,6 +61,17 @@ # ifdef XRT_CORE_PCIE_NOOP_SOURCE # define XRT_CORE_PCIE_NOOP_EXPORT __attribute__ ((visibility("default"))) # else +--- a/src/runtime_src/core/pcie/windows/alveo/config.h ++++ b/src/runtime_src/core/pcie/windows/alveo/config.h +@@ -14,7 +14,7 @@ + # define XRT_CORE_PCIE_WINDOWS_EXPORT __declspec(dllimport) + # endif + #endif +-#ifdef __GNUC__ ++#ifdef __linux__ + # ifdef XRT_CORE_PCIE_WINDOWS_SOURCE + # define XRT_CORE_PCIE_WINDOWS_EXPORT __attribute__ ((visibility("default"))) + # else --- a/src/runtime_src/xdp/config.h +++ b/src/runtime_src/xdp/config.h @@ -28,7 +28,7 @@ From f2941530851468b9e404660553cb7fff8b8fa1ad Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 21:46:36 +0200 Subject: [PATCH 23/28] Fix XDP exports and xrt_core dependencies --- X/xrt/build_tarballs.jl | 2 + .../bundled/patches/windows/xdp-exports.patch | 62 +++++++++++++++++++ .../patches/windows/xrt-core-lib.patch | 10 +++ 3 files changed, 74 insertions(+) create mode 100644 X/xrt/bundled/patches/windows/xdp-exports.patch create mode 100644 X/xrt/bundled/patches/windows/xrt-core-lib.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 8ea1e92d074..32524a25639 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -33,6 +33,8 @@ if [[ "${target}" == *-w64-* ]]; then atomic_patch -p1 ../patches/windows/no_static_boost.patch atomic_patch -p1 ../patches/windows/config.patch atomic_patch -p1 ../patches/windows/xbutil.patch + atomic_patch -p1 ../patches/windows/xdp-exports.patch + atomic_patch -p1 ../patches/windows/xrt-core-lib.patch export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi diff --git a/X/xrt/bundled/patches/windows/xdp-exports.patch b/X/xrt/bundled/patches/windows/xdp-exports.patch new file mode 100644 index 00000000000..60971a4c43b --- /dev/null +++ b/X/xrt/bundled/patches/windows/xdp-exports.patch @@ -0,0 +1,62 @@ +--- a/src/runtime_src/xdp/profile/database/events/device_events.h ++++ b/src/runtime_src/xdp/profile/database/events/device_events.h +@@ -72,7 +72,7 @@ namespace xdp { + uint64_t devId, uint32_t monId, int32_t cuIdx); + XDP_CORE_EXPORT ~KernelEvent(); + +- XDP_CORE_EXPORT virtual int32_t getCUId() { return cuId; } ++ virtual int32_t getCUId() { return cuId; } + XDP_CORE_EXPORT virtual void dump(std::ofstream& fout, uint32_t bucket) ; + }; + +--- a/src/runtime_src/xdp/profile/database/events/native_events.h ++++ b/src/runtime_src/xdp/profile/database/events/native_events.h +@@ -28,7 +28,7 @@ namespace xdp { + XDP_CORE_EXPORT NativeAPICall(uint64_t s_id, double ts, uint64_t name); + XDP_CORE_EXPORT ~NativeAPICall() = default; + +- XDP_CORE_EXPORT virtual bool isNativeHostEvent() { return true; } ++ virtual bool isNativeHostEvent() { return true; } + + XDP_CORE_EXPORT virtual void dump(std::ofstream& fout, uint32_t bucket); + }; +@@ -41,7 +41,7 @@ namespace xdp { + XDP_CORE_EXPORT NativeSyncRead(uint64_t s_id, double ts, uint64_t name); + XDP_CORE_EXPORT ~NativeSyncRead() = default; + +- XDP_CORE_EXPORT virtual bool isNativeRead() override { return true; } ++ virtual bool isNativeRead() override { return true; } + + // For printing out the event in a different bucket as a different + // type of event, without having to store additional events in the database +@@ -56,7 +56,7 @@ namespace xdp { + XDP_CORE_EXPORT NativeSyncWrite(uint64_t s_id, double ts, uint64_t name); + XDP_CORE_EXPORT ~NativeSyncWrite() = default; + +- XDP_CORE_EXPORT virtual bool isNativeWrite() override { return true; } ++ virtual bool isNativeWrite() override { return true; } + + // For printing out the event in a different bucket as a different + // type of event, without having to store additional events in the databaes +--- a/src/runtime_src/xdp/profile/database/events/vtf_event.h ++++ b/src/runtime_src/xdp/profile/database/events/vtf_event.h +@@ -135,7 +135,7 @@ namespace xdp { + + virtual uint64_t getDevice() { return 0 ; } // CHECK + XDP_CORE_EXPORT virtual void dump(std::ofstream& fout, uint32_t bucket) ; +- XDP_CORE_EXPORT virtual void dumpSync(std::ofstream& /*fout*/, uint32_t /*bucket*/) {}; ++ virtual void dumpSync(std::ofstream& /*fout*/, uint32_t /*bucket*/) {}; + } ; + + // Used so the database can sort based on timestamp order +--- a/src/runtime_src/xdp/profile/database/static_info/device_info.h ++++ b/src/runtime_src/xdp/profile/database/static_info/device_info.h +@@ -92,7 +92,7 @@ namespace xdp { + inline bool isNoDMA() const { return isNoDMADevice ; } + double getMaxClockRatePLMHz(); + +- XDP_CORE_EXPORT void setAIEGeneration(uint8_t hw_gen) { aieGeneration = hw_gen; } ++ void setAIEGeneration(uint8_t hw_gen) { aieGeneration = hw_gen; } + inline uint8_t getAIEGeneration() const { return aieGeneration ; } + + // ****** Functions for information on the currently loaded xclbin ******* diff --git a/X/xrt/bundled/patches/windows/xrt-core-lib.patch b/X/xrt/bundled/patches/windows/xrt-core-lib.patch new file mode 100644 index 00000000000..15cbdd5a27a --- /dev/null +++ b/X/xrt/bundled/patches/windows/xrt-core-lib.patch @@ -0,0 +1,10 @@ +--- a/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt ++++ b/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt +@@ -34,6 +34,7 @@ add_library(xrt_core_static STATIC + target_link_libraries(xrt_core + PRIVATE + xrt_coreutil ++ setupapi + ) + + # For DLL platforms the DLL part of a shared library is treated as a From 52bc7a3662464f2c704cac17dc1f4803d4ce1a5e Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 21:48:35 +0200 Subject: [PATCH 24/28] Remove dependency to libffi --- X/xrt/build_tarballs.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 32524a25639..6000618fbbe 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -76,7 +76,6 @@ dependencies = [ BuildDependency("OpenCL_Headers_jll"), Dependency("ocl_icd_jll"), Dependency("rapidjson_jll"), - # Dependency("Libffi_jll"), Dependency("LibCURL_jll", platforms=filter(Sys.islinux, platforms); compat="7.73, 8"), Dependency("libdrm_jll", platforms=filter(Sys.islinux, platforms)), Dependency("Libuuid_jll", platforms=filter(Sys.islinux, platforms)), From c9f7579120538dc90499787c97205ebdf45b08ae Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 22:12:42 +0200 Subject: [PATCH 25/28] Copy over relevant libraries --- X/xrt/build_tarballs.jl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 6000618fbbe..8a95655da6f 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -43,17 +43,18 @@ export XRT_BOOST_INSTALL=${WORKSPACE}/destdir cd src cmake -S . -B build \ - -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DCMAKE_INSTALL_PREFIX=$PWD/build/xilinx \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_CXX_FLAGS="${ADDITIONAL_CMAKE_CXX_FLAGS}" \ -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel ${nproc} cmake --install build -# Copy folder from xrt to folder to root dest folder -cd ${WORKSPACE}/destdir/ -cp -r ./xrt/* ./ -rm -rf xrt +# XRT installs several components in non-stadard paths +# Copy only relevant libraries and headers to destdir +cp -r $PWD/build/xilinx/xrt/lib ${prefix}/lib +cp -r $PWD/build/xilinx/xrt/include ${prefix}/include +cp -r $PWD/build/xilinx/xrt/share ${prefix}/share """ # These are the platforms we will build for by default, unless further @@ -67,6 +68,9 @@ filter!(p -> Sys.iswindows(p) || (Sys.islinux(p) && libc(p) == "glibc"), platfor products = [ LibraryProduct("libxrt_coreutil", :libxrt_coreutil), LibraryProduct("libxilinxopencl", :libxilinxopencl), + LibraryProduct("libxrt_core", :libxrt_core), + LibraryProduct("libxdp_core", :libxdp_coreutil), + LibraryProduct("libxrt++", :libxrtxx), ] # Dependencies that must be installed before this package can be built From 51959f9f6456cf282ebacdd83033791c00f3160a Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 22:47:44 +0200 Subject: [PATCH 26/28] Fix symbol for xdp_core library --- X/xrt/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index 8a95655da6f..da7fd32bb67 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -69,7 +69,7 @@ products = [ LibraryProduct("libxrt_coreutil", :libxrt_coreutil), LibraryProduct("libxilinxopencl", :libxilinxopencl), LibraryProduct("libxrt_core", :libxrt_core), - LibraryProduct("libxdp_core", :libxdp_coreutil), + LibraryProduct("libxdp_core", :libxdp_core), LibraryProduct("libxrt++", :libxrtxx), ] From a1d4a84cdd96f31b74c8a5238788a60703de2f22 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Fri, 30 Aug 2024 23:00:38 +0200 Subject: [PATCH 27/28] Fix XRT install path --- X/xrt/build_tarballs.jl | 10 +++---- X/xrt/bundled/patches/fix-install-dir.patch | 29 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 X/xrt/bundled/patches/fix-install-dir.patch diff --git a/X/xrt/build_tarballs.jl b/X/xrt/build_tarballs.jl index da7fd32bb67..3c8fd83d8ee 100644 --- a/X/xrt/build_tarballs.jl +++ b/X/xrt/build_tarballs.jl @@ -38,23 +38,19 @@ if [[ "${target}" == *-w64-* ]]; then export ADDITIONAL_CMAKE_CXX_FLAGS="-fpermissive -D_WINDOWS" fi +atomic_patch -p1 ../patches/fix-install-dir.patch + # Statically link to boost export XRT_BOOST_INSTALL=${WORKSPACE}/destdir cd src cmake -S . -B build \ - -DCMAKE_INSTALL_PREFIX=$PWD/build/xilinx \ + -DCMAKE_INSTALL_PREFIX=${prefix} \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_CXX_FLAGS="${ADDITIONAL_CMAKE_CXX_FLAGS}" \ -DCMAKE_BUILD_TYPE=Release cmake --build build --parallel ${nproc} cmake --install build - -# XRT installs several components in non-stadard paths -# Copy only relevant libraries and headers to destdir -cp -r $PWD/build/xilinx/xrt/lib ${prefix}/lib -cp -r $PWD/build/xilinx/xrt/include ${prefix}/include -cp -r $PWD/build/xilinx/xrt/share ${prefix}/share """ # These are the platforms we will build for by default, unless further diff --git a/X/xrt/bundled/patches/fix-install-dir.patch b/X/xrt/bundled/patches/fix-install-dir.patch new file mode 100644 index 00000000000..7d5f5107da1 --- /dev/null +++ b/X/xrt/bundled/patches/fix-install-dir.patch @@ -0,0 +1,29 @@ +--- a/src/CMake/nativeLnx.cmake ++++ b/src/CMake/nativeLnx.cmake +@@ -138,9 +138,9 @@ if (XRT_ENABLE_HIP) + endif() + + # --- XRT Variables --- +-set (XRT_INSTALL_DIR "xrt") ++set (XRT_INSTALL_DIR ".") + set (XRT_INSTALL_BIN_DIR "${XRT_INSTALL_DIR}/bin") +-set (XRT_INSTALL_UNWRAPPED_DIR "${XRT_INSTALL_BIN_DIR}/unwrapped") ++set (XRT_INSTALL_UNWRAPPED_DIR "${XRT_INSTALL_BIN_DIR}/bin/unwrapped") + set (XRT_INSTALL_INCLUDE_DIR "${XRT_INSTALL_DIR}/include") + set (XRT_INSTALL_LIB_DIR "${XRT_INSTALL_DIR}/lib${LIB_SUFFIX}") + set (XRT_INSTALL_PYTHON_DIR "${XRT_INSTALL_DIR}/python") +--- a/src/CMake/nativeWin.cmake ++++ b/src/CMake/nativeWin.cmake +@@ -70,9 +70,9 @@ endif() + INCLUDE (FindGTest) + + # --- XRT Variables --- +-set (XRT_INSTALL_DIR "xrt") +-set (XRT_INSTALL_BIN_DIR "${XRT_INSTALL_DIR}") +-set (XRT_INSTALL_UNWRAPPED_DIR "${XRT_INSTALL_BIN_DIR}/unwrapped") ++set (XRT_INSTALL_DIR ".") ++set (XRT_INSTALL_BIN_DIR "${XRT_INSTALL_DIR}/bin") ++set (XRT_INSTALL_UNWRAPPED_DIR "${XRT_INSTALL_BIN_DIR}/bin/unwrapped") + set (XRT_INSTALL_INCLUDE_DIR "${XRT_INSTALL_DIR}/include") + set (XRT_INSTALL_LIB_DIR "${XRT_INSTALL_DIR}/lib") + set (XRT_INSTALL_PYTHON_DIR "${XRT_INSTALL_DIR}/python") From ae6757332f6124f29c463f6ec92f12f8f9e4e554 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Sat, 31 Aug 2024 00:00:38 +0200 Subject: [PATCH 28/28] Prevent overwrite of install prefix --- X/xrt/bundled/patches/fix-install-dir.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/X/xrt/bundled/patches/fix-install-dir.patch b/X/xrt/bundled/patches/fix-install-dir.patch index 7d5f5107da1..27e7a463e99 100644 --- a/X/xrt/bundled/patches/fix-install-dir.patch +++ b/X/xrt/bundled/patches/fix-install-dir.patch @@ -14,6 +14,15 @@ set (XRT_INSTALL_PYTHON_DIR "${XRT_INSTALL_DIR}/python") --- a/src/CMake/nativeWin.cmake +++ b/src/CMake/nativeWin.cmake +@@ -10,7 +10,7 @@ + # XRT_VERSION_PATCH + + # install under c:/xrt +-set (CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/xilinx") ++#set (CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/xilinx") + + # pdb install dir + set (CMAKE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/symbols") @@ -70,9 +70,9 @@ endif() INCLUDE (FindGTest)