-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rapids_cpm_nvbench properly specify usage of external fmt library #376
rapids_cpm_nvbench properly specify usage of external fmt library #376
Conversation
When we are inside a conda env the linker will be set to ld.bfd which will try to resolve all undefined symbols at time. Since we could be using a shared library version of fmt we need it on the final link line of consumers. So patch nvbench to understand this requirement.
9df6eb3
to
c142539
Compare
I'm afraid I don't understand this change. Won't any linker require that symbols be resolved at link-time (and if linking dynamically, the requirement will be enforced again at runtime by the loader)? IIUC the change in this PR is propagating the fmt requirement from nvbench to its consumers, but I don't understand how the resulting change in terms of generated compile/link commands is related to the choice of linker. |
Good question. This PR is resolving an interacation between hidden symbols, undefined symbols and the conda linker ld.bfd. When compiling things like the libcudf benchmarks we run into the following scenario:
This results in the final executable having a link error like the following: /x86_64-conda-linux-gnu/bin/ld: uses_fmt: hidden symbol `_ZN3fmt2v96detail18throw_format_errorEPKc' in CMakeFiles/uses_fmt.dir/use_fmt.cpp.o is referenced by DSO Since we compiled nvbench against the shared library version of fmt, it has recorded that So when we go to link the final executable the linker notices that we have inconsistent definitions for this symbol. One library says it is PRIVATE and the other says it is PUBLIC and undefined. Since To fix this I have identified two solutions:
I went with option 2 as it has the smallest impact on other functions / libraries being used. So to implement 2 I made the |
Got it, that makes sense. What happens in the case where a TU links to both rmm (which links to the |
They don't end up conflicting since when fmt give the defines for both header and library mode it goes with library mode. |
/merge |
Description
When we are inside a conda env the linker will be set to ld.bfd which will try to resolve all undefined symbols at link time.
Since we could be using a shared library version of fmt we need it on the final link line of consumers. So patch nvbench to understand this requirement.
Checklist
cmake-format.json
is up to date with these changes.