[wip] pass -rpath-link via CMakeToolchain#18068
Closed
jcar87 wants to merge 1 commit intoconan-io:develop2from
Closed
[wip] pass -rpath-link via CMakeToolchain#18068jcar87 wants to merge 1 commit intoconan-io:develop2from
jcar87 wants to merge 1 commit intoconan-io:develop2from
Conversation
memsharded
reviewed
Apr 3, 2025
| return {"arch_flag": arch_flag} | ||
|
|
||
| class RpathLinkFlagsBlock(Block): | ||
| # TODO: should do this only on Linux, or toggled by an opt-in conf |
Member
There was a problem hiding this comment.
Probably what we want to do is to enable this directly in the conan_cmakedeps_paths.cmake generated by the CMakeConfigDeps. That file is loaded by the CMakeToolchain, but not only for this, so it can be also used by other solutions as cmake-conan, because otherwise whatever we put in the toolchain is not available for cmake-conan and the CLion-plugin.
So the opt-in would be to use CMakeConfigDeps? It is getting more ready and mature, it is known to solve a lot of problems, so probably it is good to start moving it forward a bit more?
51a8eb7 to
9cbdf6c
Compare
9cbdf6c to
1d9287b
Compare
franramirez688
added a commit
to franramirez688/conan
that referenced
this pull request
Nov 24, 2025
jcar87
pushed a commit
to jcar87/conan
that referenced
this pull request
Nov 24, 2025
jcar87
pushed a commit
to jcar87/conan
that referenced
this pull request
Dec 9, 2025
jcar87
pushed a commit
to jcar87/conan
that referenced
this pull request
Jan 8, 2026
jcar87
pushed a commit
to jcar87/conan
that referenced
this pull request
Feb 24, 2026
Member
|
Superseded by #19574 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMake itself tries to pass
-rpath(and-rpath-link) to the linker (via the compiler). However we know this is not sufficient in some scenarios:-rpath-linkglobally for the entire build. This would solve problems such as this [fast-dds] Fix crosscompilation issues conan-center-index#25195 - which are recurrent in Conan Center, not that even with the new CMakeDeps, there are corner cases--sysroot, CMake only passes-rpath(even correctly, pointing to the directories in the Conan cache) - but in the presence of a sysroot the linker will re-root them in a way that it won't find them inside the sysroot (and fail)Either:
A)
or
B)
A) does not work when we are crossbuilding and we have a sysroot (because the linker reroots them)
B) does not work when crossbuilding (so the recipe may build fine when doing a native build due to this workaround, but wont fully support crossbuilding when using shared libraries), but even when not crossbuilding, it wont work if using a sysroot, or using a toolchain for a separate distro (think
pocowhere os=Linux and arch=x86_64). It also introduces risks of runtime clashes when the libraries for the host are picked up by executables that run at build time.Passing
-rpath-linkvia the toolchain would remove the need for workarounds and mitigate all of the cases above, including the corner cases where Conan + (new) CMakeDeps + CMake cannot correctly derive that-rpath-linkis needed.WIP: still needs tests and probably a flag to control behaviour