Build error with "nlohmann/json.hpp: No such file or directory" in spack (unit tests build, with --test=root option)
Check duplicate issues.
- [X] Checked for duplicates
Description
Hi, I use Spack to evaluate Fujitsu compilers for Fugaku and FX1000. When I tried to install this application on spack with the "--test=root" option(unit tests), I got the following error:
/fefs/spack2/tmp/spack-stage/spack-stage-root-6.30.02-ifueiwdgknhz2zyg3olctrljdchct3mv/spack-src/tree/dataframe/test/dataframe_datasetspec.cxx:15:10: fatal error: nlohmann/json.hpp: No such file or directory
15 | #include <nlohmann/json.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [tree/dataframe/test/CMakeFiles/dataframe_datasetspec.dir/build.make:79: tree/dataframe/test/CMakeFiles/dataframe_datasetspec.dir/dataframe_datasetspec.cxx.o] Error 1
make[2]: Leaving directory '/fefs/spack2/tmp/spack-stage/spack-stage-root-6.30.02-ifueiwdgknhz2zyg3olctrljdchct3mv/spack-build-ifueiwd'
make[1]: *** [CMakeFiles/Makefile2:51492: tree/dataframe/test/CMakeFiles/dataframe_datasetspec.dir/all] Error 2
make[1]: Leaving directory '/fefs/spack2/tmp/spack-stage/spack-stage-root-6.30.02-ifueiwdgknhz2zyg3olctrljdchct3mv/spack-build-ifueiwd'
make: *** [Makefile:169: all] Error 2
Attached build log. spack-build-out_root.txt
Reproducer
$ spack install --test=root [email protected]%[email protected]
ROOT version
Installation method
Spack package manager
Operating system
Linux(RHEL 8.8,aarch64)
Additional context
There is another problem when using Spack. Please check the issue of spack. Installation issue: [email protected] fails to build with --test=root option #42720
Please try with master branch, or with 6.30.04, this seems a duplicate of: https://github.com/root-project/root/issues/14188 which was recently fixed.
Or add https://github.com/root-project/root/pull/14192/files.patch as a patch.
Hi @ferdymercury,
It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.
Sincerely, :robot:
@ferdymercury @vvolkl
Thank you for your responses! I followed the advice and built with version 6.30.04 and the master branch.
Unfortunately, the results were the same. Attached are the build logs. spack-build-out_root-6.30.04.txt spack-build-out_root-master.txt
Check the cmake configuration and modify tree/dataframe/test/CMakeLists.txt as follows:
--- a/tree/dataframe/test/CMakeLists.txt
+++ b/tree/dataframe/test/CMakeLists.txt
@@ -45,6 +45,7 @@
endif()
ROOT_ADD_GTEST(dataframe_datasetspec dataframe_datasetspec.cxx LIBRARIES ROOTDataFrame)
+target_include_directories(dataframe_datasetspec BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/builtins/)
ROOT_ADD_GTEST(dataframe_display dataframe_display.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_ranges dataframe_ranges.cxx LIBRARIES ROOTDataFrame)
ROOT_ADD_GTEST(dataframe_leaves dataframe_leaves.cxx LIBRARIES ROOTDataFrame)
BEFORE and PRIVATE refer to other descriptions but do not understand their meaning.
@linev might know. Maybe it's not until 6.30.06 that it was fixed. Please compare the CMakeLists of master vs yours and try editing it by hand.
As I can see from the full log, '-Dbuiltin_nlohmannjson:BOOL=OFF' is set there.
Means external nlohmann/json.hpp will be used when building ROOT.
In such case all tests also have to use external includes. I will try to provide fix.
Please try https://github.com/root-project/root/pull/14784
@linev @vvolkl
Thank you.
Please try https://github.com/root-project/root/pull/14784 I built with this patch and was able to complete successfully.