From 8aba0625744466f5accd0f65fe05d363ebee49cd Mon Sep 17 00:00:00 2001 From: Pavel Shramov Date: Sun, 14 Sep 2025 15:19:06 +0300 Subject: [PATCH 1/3] Add minimal version info header to help compiler cache xrt/detail/abi.h includes autogenerated version.h that contains timestamp but use only major/minor version macros. Using smaller header enables use of compiler caches (like ccache). Signed-off-by: Pavel Shramov --- src/CMake/config/version-slim.h.in | 13 +++++++++++++ src/CMake/version.cmake | 7 ++++++- src/runtime_src/core/include/xrt/detail/abi.h | 15 ++++++--------- 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 src/CMake/config/version-slim.h.in diff --git a/src/CMake/config/version-slim.h.in b/src/CMake/config/version-slim.h.in new file mode 100644 index 00000000000..b451da7915f --- /dev/null +++ b/src/CMake/config/version-slim.h.in @@ -0,0 +1,13 @@ +#ifndef _XRT_VERSION_SLIM_H_ +#define _XRT_VERSION_SLIM_H_ + +/* + * This header contains minimal version info needed for xrt/detail/abi.h header + */ + +#define XRT_SLIM_VERSION(major, minor) ((major << 16) + (minor)) +#define XRT_SLIM_VERSION_CODE XRT_SLIM_VERSION(@XRT_VERSION_MAJOR@, @XRT_VERSION_MINOR@) +#define XRT_SLIM_MAJOR(code) ((code >> 16)) +#define XRT_SLIM_MINOR(code) (code - ((code >> 16) << 16)) + +#endif diff --git a/src/CMake/version.cmake b/src/CMake/version.cmake index abde4dfe693..c6bb880347b 100644 --- a/src/CMake/version.cmake +++ b/src/CMake/version.cmake @@ -88,13 +88,18 @@ configure_file( ${PROJECT_BINARY_DIR}/gen/version.h ) +configure_file( + ${XRT_SOURCE_DIR}/CMake/config/version-slim.h.in + ${PROJECT_BINARY_DIR}/gen/xrt/detail/version-slim.h +) + configure_file( ${XRT_SOURCE_DIR}/CMake/config/version.json.in ${PROJECT_BINARY_DIR}/gen/version.json ) # xrt component install -install(FILES ${PROJECT_BINARY_DIR}/gen/version.h +install(FILES ${PROJECT_BINARY_DIR}/gen/version.h ${PROJECT_BINARY_DIR}/gen/xrt/detail/version-slim.h DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail COMPONENT ${XRT_BASE_DEV_COMPONENT}) diff --git a/src/runtime_src/core/include/xrt/detail/abi.h b/src/runtime_src/core/include/xrt/detail/abi.h index 7324593b04f..8d736962fea 100644 --- a/src/runtime_src/core/include/xrt/detail/abi.h +++ b/src/runtime_src/core/include/xrt/detail/abi.h @@ -4,12 +4,9 @@ #ifndef XRT_DETAIL_ABI_H #define XRT_DETAIL_ABI_H -// Generated version.h file is installed into include/xrt/detail/version.h -// but at build time it is picked up from compile include search path -#if defined(XRT_BUILD) && !defined(DISABLE_ABI_CHECK) -# include "version.h" -#elif !defined(XRT_BUILD) -# include "xrt/detail/version.h" +// Use slim version header without datetime fields +#ifndef DISABLE_ABI_CHECK +# include "xrt/detail/version-slim.h" #endif #ifdef __cplusplus @@ -27,9 +24,9 @@ namespace xrt { namespace detail { // version of XRT and new version. struct abi { #ifndef DISABLE_ABI_CHECK - const unsigned int major {XRT_MAJOR(XRT_VERSION_CODE)}; - const unsigned int minor {XRT_MINOR(XRT_VERSION_CODE)}; - const unsigned int code {XRT_VERSION_CODE}; + const unsigned int major {XRT_SLIM_MAJOR(XRT_SLIM_VERSION_CODE)}; + const unsigned int minor {XRT_SLIM_MINOR(XRT_SLIM_VERSION_CODE)}; + const unsigned int code {XRT_SLIM_VERSION_CODE}; #else const unsigned int major {0}; const unsigned int minor {0}; From 99f85e35bb04ed6709290b394aa604105a0cf2a9 Mon Sep 17 00:00:00 2001 From: Pavel Shramov Date: Sun, 14 Sep 2025 11:08:12 +0300 Subject: [PATCH 2/3] wip: Temporary alter xrt.install file Signed-off-by: Pavel Shramov --- build/debian/xrt.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/xrt.install b/build/debian/xrt.install index 3d0522be312..9aa81835d58 100644 --- a/build/debian/xrt.install +++ b/build/debian/xrt.install @@ -1,3 +1,3 @@ etc/OpenCL/ opt/xilinx/ -usr/lib/pkgconfig/ +#usr/lib/*/pkgconfig/ From 2b800323b720cc1000f86e6be1a3b759a87cd18b Mon Sep 17 00:00:00 2001 From: Pavel Shramov Date: Sun, 14 Sep 2025 10:11:41 +0300 Subject: [PATCH 3/3] wip: Debian validate workflow Install dependencies described in debian/control file, build package and run basic tests with installed result Signed-off-by: Pavel Shramov --- .github/workflows/debian-validate.yml | 52 +++++++++++++++++++++++++++ build/debian/print-build-deps.pl | 16 +++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/debian-validate.yml create mode 100755 build/debian/print-build-deps.pl diff --git a/.github/workflows/debian-validate.yml b/.github/workflows/debian-validate.yml new file mode 100644 index 00000000000..ccc46491f7e --- /dev/null +++ b/.github/workflows/debian-validate.yml @@ -0,0 +1,52 @@ +name: Validate Debian build + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + os: [ubuntu-24.04] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - uses: actions/cache@v4 + with: + path: | + /home/runner/.ccache + /home/runner/.cache/ccache + key: debian-validate:${{ matrix.os }}:${{ github.sha }} + restore-keys: 'debian-validate:${{ matrix.os }}:' + - name: disable man-db trigger # See https://github.com/actions/runner-images/issues/10977 + run: | + echo "set man-db/auto-update false" | sudo debconf-communicate + sudo dpkg-reconfigure man-db + - name: install deps + run: | + ln -s build/debian debian + sudo apt update + sudo apt remove --yes libpython3*-dev # By default github images have python3-dev packages installed, drop them + sudo apt install --yes build-essential ccache + sudo apt satisfy --yes --no-install-recommends "`perl ./debian/print-build-deps.pl`" + - name: build + env: + CMAKE_CXX_COMPILER_LAUNCHER: ccache + CMAKE_C_COMPILER_LAUNCHER: ccache + run: dpkg-buildpackage --no-sign -b -j4 + - name: test + continue-on-error: true + run: | + set -x + test ! -f /opt/xilinix/xrt/bin/xclbinutil + if pkg-config --exists xrt; then echo "XRT pkg-config file installed: `pkg-config --modversion xrt`"; false; else true; fi + sudo dpkg -i ../xrt_*.deb + test -f /opt/xilinx/xrt/bin/xclbinutil + pkg-config --exists xrt + mkdir build-test + cd build-test + c++ -ohello `pkg-config --cflags --libs xrt` -Wall ../tests/xrt/00_hello/main.cpp + +# vim: sts=2 sw=2 et diff --git a/build/debian/print-build-deps.pl b/build/debian/print-build-deps.pl new file mode 100755 index 00000000000..fa7e668ebad --- /dev/null +++ b/build/debian/print-build-deps.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Dpkg::Control::Info; +use Dpkg::Deps; + +my $fields = Dpkg::Control::Info->new()->get_source(); +my %options = (reduce_restrictions => 1); + +print(deps_concat( + deps_parse($fields->{'Build-Depends'}, %options), + deps_parse($fields->{'Build-Depends-Arch'} || '', %options) || undef, + deps_parse($fields->{'Build-Depends-Indep'} || '', %options) || undef, +))