Skip to content
This repository was archived by the owner on Sep 16, 2026. It is now read-only.
This repository was archived by the owner on Sep 16, 2026. It is now read-only.

External dependency nlohmann/json.hpp fails to build under Intel compiler icpc with warnings as error #9

Description

@mlxd
  • Expected behavior: The external library nlohmann/json.hpp should compile and link without any modifications required.

  • Actual behavior: Compiling with the classic intel compiler (icpc) causes several errors to be reported (see below).

  • Reproduces how often: Only when building with icpc (2021.2.0 20210228) on Niagara.

  • System information: Niagara HPC system, using the Jet benchmark for the TBCC.

Source code and backtraces

Please include any additional code snippets and backtraces related to the issue here.

Additional information

Any additional information, configuration or data that might be necessary to reproduce the issue.

[ 50%] Building CXX object CMakeFiles/tbcc.dir/tbcc_benchmark.cpp.o
/cvmfs/restricted.computecanada.ca/easybuild/software/2020/Core/intel/2021.2.0/compiler/2021.2.0/linux/bin/intel64/icpc   -I/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include -I/cvmfs/soft.computecanada.ca/easybuild/software/2020/Core/imkl/2021.2.0/mkl/2021.2.0/include -I/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/taskflow-src  -O3 -DNDEBUG   -Wall -Wextra -Werror -march=native -DENABLE_MKL -qopenmp -std=gnu++17 -o CMakeFiles/tbcc.dir/tbcc_benchmark.cpp.o -c /home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/tbcc_benchmark.cpp
/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/external/nlohmann/json.hpp(4697): error #1011: missing return statement at end of non-void function "nlohmann::detail::hash(const BasicJsonType &)"
  }
  ^

/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/external/nlohmann/json.hpp(16141): error #186: pointless comparison of unsigned integer with zero
          const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(x >= 0); // see issue #755
                                                                                            ^
          detected during:
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={__int64_t={signed long}}, uint64_t={__uint64_t={unsigned long}}, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>>, NumberType=uint8_t={__uint8_t={unsigned char}}, <unnamed>=0]" at line 15703
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, bool, bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={__int64_t={signed long}}, uint64_t={__uint64_t={unsigned long}}, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>>]" at line 18769
            instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::dump(int, char, bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType,
                      NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t={nlohmann::detail::error_handler_t}) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool, NumberIntegerType=int64_t={__int64_t={signed long}}, NumberUnsignedType=uint64_t={__uint64_t={unsigned long}}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer,
                      BinaryType=std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>]" at line 254 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/TensorNetworkIO.hpp"
            instantiation of "std::vector<S, std::allocator<S>> Jet::TensorNetworkSerializer<Tensor>::TensorDataFromJSON_<S>(const Jet::json &, size_t={unsigned long}) [with Tensor=Jet::Tensor<std::complex<float>>, S=std::complex<float>]" at line 153 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/TensorNetworkIO.hpp"
            instantiation of "Jet::TensorNetworkFile<Tensor> Jet::TensorNetworkSerializer<Tensor>::operator()(std::string) [with Tensor=Jet::Tensor<std::complex<float>>]" at line 34 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/tbcc_benchmark.cpp"

/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/external/nlohmann/json.hpp(16141): error #186: pointless comparison of unsigned integer with zero
          const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(x >= 0); // see issue #755
                                                                                            ^
          detected during:
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump_integer(NumberType) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={__int64_t={signed long}}, uint64_t={__uint64_t={unsigned long}}, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>>, NumberType=uint64_t={__uint64_t={unsigned long}}, <unnamed>=0]" at line 15775
            instantiation of "void nlohmann::detail::serializer<BasicJsonType>::dump(const BasicJsonType &, bool, bool, unsigned int, unsigned int) [with BasicJsonType=nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t={__int64_t={signed long}}, uint64_t={__uint64_t={unsigned long}}, double, std::allocator, nlohmann::adl_serializer, std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>>]" at line 18769
            instantiation of "nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::string_t nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::dump(int, char, bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType,
                      NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::error_handler_t={nlohmann::detail::error_handler_t}) const [with ObjectType=std::map, ArrayType=std::vector, StringType=std::string, BooleanType=bool, NumberIntegerType=int64_t={__int64_t={signed long}}, NumberUnsignedType=uint64_t={__uint64_t={unsigned long}}, NumberFloatType=double, AllocatorType=std::allocator, JSONSerializer=nlohmann::adl_serializer,
                      BinaryType=std::vector<uint8_t={__uint8_t={unsigned char}}, std::allocator<uint8_t={__uint8_t={unsigned char}}>>]" at line 254 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/TensorNetworkIO.hpp"
            instantiation of "std::vector<S, std::allocator<S>> Jet::TensorNetworkSerializer<Tensor>::TensorDataFromJSON_<S>(const Jet::json &, size_t={unsigned long}) [with Tensor=Jet::Tensor<std::complex<float>>, S=std::complex<float>]" at line 153 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/_deps/jet-src/include/jet/TensorNetworkIO.hpp"
            instantiation of "Jet::TensorNetworkFile<Tensor> Jet::TensorNetworkSerializer<Tensor>::operator()(std::string) [with Tensor=Jet::Tensor<std::complex<float>>]" at line 34 of "/home/s/sipejohn/mlxd/TMP/jet_benchmarks/benchmarks/Jet_TBCC/tbcc_benchmark.cpp"

The Jet benchmark Jet_TBCC was built and failed with the commands:

cmake . -DCMAKE_CXX_COMPILER=icpc -DENABLE_NATIVE=1 -DENABLE_OPENMP=1
make VERBOSE=1

and succeeded with

cmake . -DCMAKE_CXX_COMPILER=icpc -DENABLE_NATIVE=1 -DENABLE_OPENMP=1 -DENABLE_WARNINGS=0
make VERBOSE=1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions