Skip to content

toml11/nlohmann-json: avoid symbol clashes with different versions in upstream dependencies #5367

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

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented May 15, 2025

Fix #5355

This is a relatively simple workaround for the issue documented therein, especially as it does not require changes in openPMD and hence fixes the problem also for old versions.

Explanation: inline namespace creates a namespace that does not actually need to be used in including code. Instead, it only instructs the linker to emit qualified symbols, thus avoiding the problematic symbol clashes.

Aside from this, I am currently experimenting with automatically installing the internally shipped versions of toml11 / nlohmann-json along with openPMD upon make install in openPMD/openPMD-api#1757. The far goal would be to use the logic described there as a "protocol" for openPMD and PIConGPU to agree on common versions for internal header-only libraries.

TODO:

  • Document the scripts a bit.

@franzpoeschel
Copy link
Contributor Author

Just ran a test, the segfault that I saw is fixed by this.

@psychocoderHPC psychocoderHPC added bug a bug in the project's code affects latest release a bug that affects the latest stable release component: third party third party libraries that are shipped and/or linked labels May 16, 2025
@psychocoderHPC psychocoderHPC added this to the 0.9.0 / next stable milestone May 16, 2025
@franzpoeschel
Copy link
Contributor Author

I was just going to fix this for nlohmann-json, but noticed that it has already been fixed with version 3.11 nlohmann/json#3590. Internally, we still use version 3.9.1. I will remove my workaround and upgrade the single header instead.
I supplied a similar PR to toml11 which has been merged by now: ToruNiina/toml11#291
But it is not yet part of any release, so for the moment, I will leave that part as it is.

@franzpoeschel franzpoeschel force-pushed the fix-toml-json-version-mismatches branch from da25de2 to f0a3675 Compare May 27, 2025 12:52
@franzpoeschel franzpoeschel force-pushed the fix-toml-json-version-mismatches branch from f0a3675 to f711387 Compare May 27, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects latest release a bug that affects the latest stable release bug a bug in the project's code component: third party third party libraries that are shipped and/or linked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conflicting versions of toml11 and nlohmann_json when used as internally shipped dependencies at multiple points in the software stack
3 participants