Skip to content

Add minimal version info header to help compiler cache#9231

Closed
shramov wants to merge 1 commit intoXilinx:masterfrom
shramov:wip-ccache
Closed

Add minimal version info header to help compiler cache#9231
shramov wants to merge 1 commit intoXilinx:masterfrom
shramov:wip-ccache

Conversation

@shramov
Copy link
Contributor

@shramov shramov commented Sep 14, 2025

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).

Problem solved by the commit

Make it possible to use ccache (or other compiler cache) at buildhosts

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

How problem was solved, alternative solutions (if any) and why they were rejected

Slim version header is added that contains only necessary info. Old version.h is left unchanged but it is possible to include slim one there to reduce code duplication

Why this solution is better then -DXRT_CCACHE?

XRT_CCACHE uses global define -DDISABLE_ABI_CHECK so technicaly compilation result is different and some errors can not be detected (redefinition of variables/macros from version.h for example).

This patch fixes root cause why -DDISABLE_ABI_CHECK was introduced and same code base with same flags can be compiled with or without ccache.

Risks (if any) associated the changes in the commit

Code that uses version macros without including version.h will break

What has been tested and how, request additional testing if necessary

Documentation impact (if any)

@gbuildx
Copy link
Collaborator

gbuildx commented Sep 14, 2025

shramov - is not a collaborator
Can XRT admins please validate PR

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 <shramov@mexmat.net>
@gbuildx
Copy link
Collaborator

gbuildx commented Sep 14, 2025

shramov - is not a collaborator
Can XRT admins please validate PR

@gbuildx
Copy link
Collaborator

gbuildx commented Sep 14, 2025

Can one of the admins verify this patch?

stsoe added a commit to stsoe/XRT that referenced this pull request Sep 16, 2025
…ache

Refactor the autogenerated version.h into two separately configured
headers, one that doesn't use timestamp (version-slim.h) and one that
does (version.h).

The XRT exported header files depend on ABI check that uses the XRT
version only.  These headers can include version-slim.h and not be
affected by a changing timestamp everytime CMake is reconfigured.
This in turn simplifies the logic for building with ccache.

The two separate headers are generated under the build tree in a
directory with same relatively location as where the corresponding
headers will be installed.

Thank you @shramov for Xilinx#9231, which seeded this PR.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
stsoe added a commit to stsoe/XRT that referenced this pull request Sep 16, 2025
…ache

Refactor the autogenerated version.h into two separately configured
headers, one that doesn't use timestamp (version-slim.h) and one that
does (version.h).

The XRT exported header files depend on ABI check that uses the XRT
version only.  These headers can include version-slim.h and not be
affected by a changing timestamp everytime CMake is reconfigured.
This in turn simplifies the logic for building with ccache.

The two separate headers are generated under the build tree in a
directory with same relatively location as where the corresponding
headers will be installed.

Thank you @shramov for Xilinx#9231, which seeded this PR.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@stsoe
Copy link
Collaborator

stsoe commented Sep 16, 2025

Hi @shramov . Thank you very much for these changes. I have built on your changes in f #9238.

@stsoe stsoe closed this in #9238 Sep 17, 2025
stsoe added a commit that referenced this pull request Sep 17, 2025
…9238)

* Amend #9231: Add minimal version info header to help compiler cache

Refactor the autogenerated version.h into two separately configured
headers, one that doesn't use timestamp (version-slim.h) and one that
does (version.h).

The XRT exported header files depend on ABI check that uses the XRT
version only.  These headers can include version-slim.h and not be
affected by a changing timestamp everytime CMake is reconfigured.
This in turn simplifies the logic for building with ccache.

The two separate headers are generated under the build tree in a
directory with same relatively location as where the corresponding
headers will be installed.

Thank you @shramov for #9231, which seeded this PR.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>

* Fix review comment

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>

* Fix driver build error

Make sure version-slim.h is installed in proper location for DKMS.

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>

---------

Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
@shramov shramov deleted the wip-ccache branch September 28, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants