-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
CMake version config file is architecture-dependent #1697
Comments
Would you mind opening a PR? |
Sure, I can do that. Would you prefer bumping the CMake version requirement to 3.14 so that the ARCH_INDEPENDENT flag can be used, or using the template that I adapted for Debian? |
Definitely not bumping the required CMake version. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi, I'm still alive, and will write a PR, but was on vacation for most of August. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi stale bot, I made a PR to fix this issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Fixed by merging #1746 |
As nlohmann_json is a header-only library, its pkg-config and cmake config files should be installed to `share/` (GNUInstallDirs' DATADIR), as `share/` is the canonical directory where architecture-independent files should be stored, while `lib/` is for architecture-dependent stuff (see the [FHS][]). Apart from being technically correct, installing to `share/` can help with cross-compiling, for example in Debian-based environments. If you're interested, I'd suggest reading this [thread][]. Related to nlohmann#1697 [FHS]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrshareArchitectureindependentData [thread]: marzer/tomlplusplus#165 (comment)
As nlohmann_json is a header-only library, its pkg-config and cmake config files should be installed to `share/` (GNUInstallDirs' DATADIR), as `share/` is the canonical directory where architecture-independent files should be stored, while `lib/` is for architecture-dependent stuff (see the [FHS][]). Apart from being technically correct, installing to `share/` can help with cross-compiling, for example in Debian-based environments. If you're interested, I'd suggest reading this [thread][]. Related to #1697 [FHS]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrshareArchitectureindependentData [thread]: marzer/tomlplusplus#165 (comment)
CMake's
write_basic_package_version_file
by default creates a file that checks that the word size is the same as the word size used when the file was created. That means that if the file was created on a 64-bit machine, then CMake will refuse to use it on a 32-bit machine (or vice versa). This is a problem for the Debian package, since the package is architecture-independent, and so it is only built once on one architecture, and that package used when building other packages on other architectures. See, for example, https://buildd.debian.org/status/fetch.php?pkg=nheko&arch=i386&ver=0.6.4-1&stamp=1564680125&file=log in which it tries to build a package on a 32-bit architecture, using the JSON library package built on a 64-bit architecture.In CMake 3.14, they added a
ARCH_INDEPENDENT
flag towrite_basic_package_version_file
to drop this check. However, if you use that, it would require bumping the minimum version of CMake to 3.14. This also doesn't help us in Debian, since we still have CMake 3.13. For Debian, I've worked around this for now by creating my own template fornlohmann_jsonConfigVersion.cmake
:The text was updated successfully, but these errors were encountered: