dice icon indicating copy to clipboard operation
dice copied to clipboard

Compile error with gcc8 on Linux: error: static assertion failed: comparison object must be invocable with two arguments of key type ...

Open kunecky opened this issue 4 years ago • 2 comments

When I compile dice with gcc8, this error appears:

[ 4%] Performing build step for 'hypercine' Scanning dependencies of target hypercine [ 50%] Building CXX object CMakeFiles/hypercine.dir/src/hypercine.cpp.o [100%] Linking CXX static library libhypercine.a [100%] Built target hypercine [ 4%] Performing install step for 'hypercine' [100%] Built target hypercine Install the project... -- Install configuration: "RELEASE" -- Installing: /data/1/eskamoter/dice/install/lib/libhypercine.a [ 5%] Completed 'hypercine' [ 5%] Built target hypercine Scanning dependencies of target diceioutils [ 6%] Building CXX object src/ioutils/CMakeFiles/diceioutils.dir/DICe_ImageIO.cpp.o [ 6%] Building CXX object src/ioutils/CMakeFiles/diceioutils.dir/__/rawi/DICe_Rawi.cpp.o [ 7%] Linking CXX static library ../../lib/libdiceioutils.a [ 7%] Built target diceioutils Scanning dependencies of target dicecore [ 7%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe.cpp.o [ 8%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe_Image.cpp.o [ 8%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe_ImageUtils.cpp.o [ 9%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe_Subset.cpp.o [ 9%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe_Shape.cpp.o [ 10%] Building CXX object src/CMakeFiles/dicecore.dir/base/DICe_FieldEnums.cpp.o In file included from /opt/rh/devtoolset-8/root/usr/include/c++/8/map:60, from /data/1/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_ConfigDefs.hpp:95, from /data/1/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPNode.hpp:52, from /data/1/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPDecl.hpp:51, from /data/1/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCP.hpp:58, from /data/1/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:44: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::basic_string, std::pair<const std::basic_string, DICe::field_enums::Field_Type>, std::_Select1st<std::pair<const std::basic_string, DICe::field_enums::Field_Type> >, std::basic_string, std::allocator<std::pair<const std::basic_string, DICe::field_enums::Field_Type> > >’: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::basic_string, DICe::field_enums::Field_Type, std::basic_string >’ /data/1/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:273:60: required from here /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::basic_string, std::pair<const std::basic_string, DICe::field_enums::Field_Name>, std::_Select1st<std::pair<const std::basic_string, DICe::field_enums::Field_Name> >, std::basic_string, std::allocator<std::pair<const std::basic_string, DICe::field_enums::Field_Name> > >’: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::basic_string, DICe::field_enums::Field_Name, std::basic_string >’ /data/1/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:315:61: required from here /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::basic_string, std::pair<const std::basic_string, DICe::field_enums::Entity_Rank>, std::_Select1st<std::pair<const std::basic_string, DICe::field_enums::Entity_Rank> >, std::basic_string, std::allocator<std::pair<const std::basic_string, DICe::field_enums::Entity_Rank> > >’: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::basic_string, DICe::field_enums::Entity_Rank, std::basic_string >’ /data/1/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:332:61: required from here /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type make[2]: *** [src/CMakeFiles/dicecore.dir/build.make:148: src/CMakeFiles/dicecore.dir/base/DICe_FieldEnums.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:559: src/CMakeFiles/dicecore.dir/all] Error 2 make: *** [Makefile:150: all] Error 2

When I switch back to gcc7.4 it works perfectly. Tested on Debian 10 and Centos7.7.

kunecky avatar Mar 12 '21 15:03 kunecky

Thanks for pointing this out. I rebuilt DICe using gcc 8.4.0 and it compiled without errors. I was using the following flags: -D CMAKE_CXX_FLAGS:STRING="-lgfortran -Wall -Werror -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-literal-suffix" I'm not sure why it wouldn't compile for you on Debian (unless it was because of different flags). I'm using RHEL7.

dicengine avatar Mar 12 '21 15:03 dicengine

Thank You for the advice, however, really it does not work. Here is what I get: [ 20%] Building CXX object src/CMakeFiles/dicecore.dir/mesh/DICe_Mesh.cpp.o [ 20%] Building CXX object src/CMakeFiles/dicecore.dir/global/DICe_Global.cpp.o [ 21%] Building CXX object src/CMakeFiles/dicecore.dir/global/DICe_GlobalUtils.cpp.o [ 21%] Building CXX object src/CMakeFiles/dicecore.dir/global/DICe_Preconditioner.cpp.o [ 22%] Building CXX object src/CMakeFiles/dicecore.dir/global/DICe_BCManager.cpp.o [ 22%] Building C object src/CMakeFiles/dicecore.dir/global/triangle/triangle.c.o [ 23%] Building CXX object src/CMakeFiles/dicecore.dir/global/triangle/DICe_TriangleUtils.cpp.o [ 23%] Building CXX object src/CMakeFiles/dicecore.dir/mesh/io/DICe_MeshIO.cpp.o [ 24%] Building CXX object src/CMakeFiles/dicecore.dir/opencv/DICe_Feature.cpp.o [ 25%] Building CXX object src/CMakeFiles/dicecore.dir/mesh/io/DICe_MeshIOUtils.cpp.o [ 25%] Building CXX object src/CMakeFiles/dicecore.dir/opencv/DICe_Calibration.cpp.o [ 26%] Building CXX object src/CMakeFiles/dicecore.dir/opencv/DICe_OpenCVServerUtils.cpp.o In file included from /usr/include/c++/8/map:60, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_ConfigDefs.hpp:95, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPNode.hpp:52, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPDecl.hpp:51, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCP.hpp:58, from /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:44: /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Type>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Type> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Type> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::field_enums::Field_Type, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:273:60: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Name>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Name> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Field_Name> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::field_enums::Field_Name, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:315:61: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::field_enums::Entity_Rank>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Entity_Rank> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::field_enums::Entity_Rank> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::field_enums::Entity_Rank, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/base/DICe_FieldEnums.cpp:332:61: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type In file included from /usr/include/c++/8/map:60, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_ConfigDefs.hpp:95, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPNode.hpp:52, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCPDecl.hpp:51, from /home/eskamoter/dice/Trilinos-trilinos-release-12-10-1/build/install/include/Teuchos_RCP.hpp:58, from /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/mesh/DICe_MeshEnums.cpp:44: /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::mesh::Physics_Term>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::mesh::Physics_Term> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::mesh::Physics_Term> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::mesh::Physics_Term, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/mesh/DICe_MeshEnums.cpp:157:49: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::mesh::Component>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::mesh::Component> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::mesh::Component> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::mesh::Component, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/mesh/DICe_MeshEnums.cpp:174:46: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type /usr/include/c++/8/bits/stl_tree.h: In instantiation of ‘class std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, DICe::mesh::Base_Element_Type>, std::_Select1st<std::pair<const std::__cxx11::basic_string, DICe::mesh::Base_Element_Type> >, std::__cxx11::basic_string, std::allocator<std::pair<const std::__cxx11::basic_string, DICe::mesh::Base_Element_Type> > >’: /usr/include/c++/8/bits/stl_map.h:151:17: required from ‘class std::map<std::__cxx11::basic_string, DICe::mesh::Base_Element_Type, std::__cxx11::basic_string >’ /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/mesh/DICe_MeshEnums.cpp:215:54: required from here /usr/include/c++/8/bits/stl_tree.h:452:21: error: static assertion failed: comparison object must be invocable with two arguments of key type make[2]: *** [src/CMakeFiles/dicecore.dir/build.make:128: src/CMakeFiles/dicecore.dir/base/DICe_FieldEnums.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: *** [src/CMakeFiles/dicecore.dir/build.make:336: src/CMakeFiles/dicecore.dir/mesh/DICe_MeshEnums.cpp.o] Error 1 /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/global/triangle/DICe_TriangleUtils.cpp: In function ‘Teuchos::RCPDICe::mesh::Mesh DICe::generate_tri_mesh(DICe::mesh::Base_Element_Type, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, Teuchos::ArrayRCP, const scalar_t&, const string&, bool, bool)’: /home/eskamoter/dice/dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5/src/global/triangle/DICe_TriangleUtils.cpp:539:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 1024 equals destination size [-Werror=stringop-truncation] strncpy(args, arg_ss.str().c_str(), 1024); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[2]: *** [src/CMakeFiles/dicecore.dir/build.make:427: src/CMakeFiles/dicecore.dir/global/triangle/DICe_TriangleUtils.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:137: src/CMakeFiles/dicecore.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

So it is problem of Debian 10, the only version that works for it is gcc 7.4 and dice-fd7777fefdb34bd7ce99db3a082ba3a1e8e27ef5. regards Jiri K.

kunecky avatar Mar 15 '21 15:03 kunecky