failure to install with intel 2024
I know, not an officially supported compiler.
[ 5%] Building CXX object example/CMakeFiles/clcpp_response-headers.dir/clcpp_response.cpp.o
cd /work2/00434/eijkhout/mpunits/build-2.4.0-stampede3-intel24.2/example && /scratch/projects/compilers/intel24.2/oneapi/compiler/2024.2/bin/icpx -DFMT_SHARED -DMP_UNITS_API_CONTRACTS=2 -DMP_UNITS_API_NO_CRTP=0 -DMP_UNITS_API_STD_FORMAT=0 -DMP_UNITS_API_STRING_VIEW_RET=0 -DMP_UNITS_HOSTED=1 -I/work2/00434/eijkhout/mpunits/mpunits-2.4.0/src/core/include -I/work2/00434/eijkhout/mpunits/mpunits-2.4.0/src/systems/include -isystem /work2/00434/eijkhout/fmtlib/installation-fmtlib-11.0.2-stampede3-intel24.2/include -isystem /work2/00434/eijkhout/gsllite/installation-gsllite-0.42.0-stampede3-intel24.2/include -O2 -g -DNDEBUG -std=gnu++20 -MD -MT example/CMakeFiles/clcpp_response-headers.dir/clcpp_response.cpp.o -MF CMakeFiles/clcpp_response-headers.dir/clcpp_response.cpp.o.d -o CMakeFiles/clcpp_response-headers.dir/clcpp_response.cpp.o -c /work2/00434/eijkhout/mpunits/mpunits-2.4.0/example/clcpp_response.cpp
/work2/00434/eijkhout/mpunits/mpunits-2.4.0/example/clcpp_response.cpp:126:41: error: call to consteval function 'fmt::basic_format_string<char, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &>::basic_format_string<char[43], 0>' is not a constant expression
126 | std::cout << MP_UNITS_STD_FMT::format("{::N[.30]}\n + {::N[.30]}\n = {::N[.30]}\n\n", L1A, L2A, LrA);
| ^
Is Intel wrong here?
Ok, after a little browsing I found the option of using std::format but I get:
-- MP_UNITS_API_STD_FORMAT: ON
-- MP_UNITS_API_STRING_VIEW_RET: OFF
-- MP_UNITS_API_NO_CRTP: OFF
-- MP_UNITS_API_FREESTANDING: OFF
-- MP_UNITS_API_CONTRACTS: GSL-LITE
CMake Error at src/CMakeLists.txt:107 (message):
`std::format` enabled but not supported
which is wrong: my compiler definitely supports std::format.
Hi @VictorEijkhout! There must be some issue with the C++ Standard Library you use with GCC. Most probably __cpp_lib_format is not set:
https://github.com/mpusz/mp-units/blob/e0ce43c5efe9a9a5587a7d48878646b9131ff3a4/src/CMakeLists.txt#L51C29-L51C46
and this is why CMake complains.
Libc++ also has this issue, and that is why we have this workaround:
https://github.com/mpusz/mp-units/blob/e0ce43c5efe9a9a5587a7d48878646b9131ff3a4/src/CMakeLists.txt#L54-L65
You may need something similar for your environment. Please let us know if that helps, and if possible, please contribute a patch for ICC.
Ok, with that as a template the configuration succeeded But the compilation strands on the same problem I started with:
/work2/00434/eijkhout/mpunits/mpunits-2.4.0/example/clcpp_response.cpp:126:41: error: call to consteval function 'std::basic_format_string<char, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &, const mp_units::quantity<mp_units::si::femto_<mp_units::si::metre>{{{{}, {}}}}, float> &>::basic_format_string<char[43]>' is not a constant expression
126 | std::cout << MP_UNITS_STD_FMT::format("{::N[.30]}\n + {::N[.30]}\n = {::N[.30]}\n\n", L1A, L2A, LrA);
but now with std::format instead of fmt::format.
Could you please paste the entire error message with the information on why the compiler claims it is not a constant expression?
It seems that ICC can't use std::string used by fmt::format in a consteval function. Maybe it is caused by the lack of proper support for ICC in the libc++ you are using. Did you try libstdc++?
Anyway, as I stated in another post, consumers do not have to compile any of our tests or examples. You can just grab the src directory. It should work fine for you if you do not use text formatting.
- I've run into issues with
std::stringbefore, that it's translated tostd::basic_string. - My system
libstdc++is pretty old, so I'd get missingLIBGCXXsymbols. - I'm not a consumer: I install libraries on a supercomputer cluster. "Just" grabbing the source directory is not a viable installation strategy. Is there no cmake switch to bypass the tests?
Is there no cmake switch to bypass the tests?
Please check the answer in our documentation.
This is a header-only library. Installing the library does not require any compilation. Just do the cmake configure step in src subdirectory followed by:
cmake --install . --config Release