Skip to content

Conversation

@mgorny
Copy link
Member

@mgorny mgorny commented Jul 20, 2025

Fix the symlink creation logic to use relative paths instead of absolute, in order to ensure that the installed symlinks actually refer to the installed .bc files rather than the ones from the build directory. This was broken in #146833. The change is a bit roundabout but it attempts to preserve the spirit of #146833, that is the ability to use multiple output directories (provided they all resides in ${LIBCLC_OUTPUT_LIBRARY_DIR} and preserve the same structure in the installed tree).

Fix the symlink creation logic to use relative paths instead
of absolute, in order to ensure that the installed symlinks actually
refer to the installed .bc files rather than the ones from the build
directory.  This was broken in llvm#146833.  The change is a bit roundabout
but it attempts to preserve the spirit of llvm#146833, that is the ability
to use multiple output directories (provided they all resides
in `${LIBCLC_OUTPUT_LIBRARY_DIR}` and preserve the same structure
in the installed tree).

Signed-off-by: Michał Górny <[email protected]>
@llvmbot llvmbot added the libclc libclc OpenCL library label Jul 20, 2025
Copy link
Collaborator

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

foreach( a IN LISTS ARG_ALIASES )
if(CMAKE_HOST_UNIX OR LLVM_USE_SYMLINKS)
cmake_path(RELATIVE_PATH libclc_builtins_lib
BASE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems libclc_builtins_lib is always located in LIBCLC_OUTPUT_LIBRARY_DIR, so here probably we only need to set LIBCLC_LINK_OR_COPY_SOURCE to be file basename part of libclc_builtins_lib.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but that's precisely what #146833 changed, apparently to account for the possibility of moving the files in the future.

Copy link
Contributor

@wenju-he wenju-he Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@frasercrmck to confirm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps best leave it as you've got it here, as it's more robust to changes. If (some) files are moved in the future, everything would likely still be relative to LIBCLC_OUTPUT_LIBRARY_DIR which is the thing that would most likely change. But I don't see the harm in having it as is.

@mgorny
Copy link
Member Author

mgorny commented Jul 21, 2025

Thanks!

@mgorny mgorny merged commit abe93d9 into llvm:main Jul 21, 2025
11 checks passed
@mgorny mgorny deleted the libclc-symlinks branch July 21, 2025 18:59
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
Fix the symlink creation logic to use relative paths instead of
absolute, in order to ensure that the installed symlinks actually refer
to the installed .bc files rather than the ones from the build
directory. This was broken in llvm#146833. The change is a bit roundabout
but it attempts to preserve the spirit of llvm#146833, that is the ability
to use multiple output directories (provided they all resides in
`${LIBCLC_OUTPUT_LIBRARY_DIR}` and preserve the same structure in the
installed tree).

Signed-off-by: Michał Górny <[email protected]>
@kraj
Copy link
Contributor

kraj commented Aug 4, 2025

We need this cherry-picked to release/21.x branch as well.

@mgorny
Copy link
Member Author

mgorny commented Aug 4, 2025

The original change should be revert on 21.x already.

@kraj
Copy link
Contributor

kraj commented Aug 4, 2025

The original change should be revert on 21.x already.

indeed, I needed to be on rc2 for getting all the reverts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libclc libclc OpenCL library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants