UG4 / ugcore

The core functionality of UG4. Includes sources, build-scripts, and utility scripts.
https://github.com/UG4/ugcore
Other
36 stars 23 forks source link

Can't compile ug4 (398e3d3) #34

Closed stephanmg closed 3 years ago

stephanmg commented 3 years ago

Dear all,

commit 398e3d3dbf8af1cc6a36fb5ac5ea1cc9c2b01975 cannot be compiled (At least on my computer and/or on Travis without C++11 compiler support): I presume this is associated with the commit above, perhaps @anaegel could I kindly ask you to look into this?

Issue no. 1: (With C++11 compiler):

[ 84%] Building CXX object ugcore/CMakeFiles/ug4.dir/ugbase/bridge/disc_bridges/user_data_bridge.cpp.o
/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list
            argument types are: (ug::bridge::Registry, std::string)
        RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair
        ^
/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced
  void RegisterUserDataTypeA(Registry& reg, string grp)
       ^
          detected during:
            instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension<dim>(ug::bridge::Registry &, std::string) [with dim=1]" at line 55 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h"
            instantiation of "void ug::bridge::RegisterDimensionDependent<Functionality>(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list
            argument types are: (ug::bridge::Registry, std::string)
        RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair
        ^
/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced
  void RegisterUserDataTypeA(Registry& reg, string grp)
       ^
          detected during:
            instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension<dim>(ug::bridge::Registry &, std::string) [with dim=2]" at line 58 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h"
            instantiation of "void ug::bridge::RegisterDimensionDependent<Functionality>(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list
            argument types are: (ug::bridge::Registry, std::string)
        RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair
        ^
/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced
  void RegisterUserDataTypeA(Registry& reg, string grp)
       ^
          detected during:
            instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension<dim>(ug::bridge::Registry &, std::string) [with dim=3]" at line 61 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h"
            instantiation of "void ug::bridge::RegisterDimensionDependent<Functionality>(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

compilation aborted for /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp (code 2)
make[2]: *** [ugcore/CMakeFiles/ug4.dir/ugbase/bridge/disc_bridges/user_data_bridge.cpp.o] Error 2
make[2]: *** Waiting for unfinished jobs....

Issue no. 2 (Without C++11 compiler):

/home/travis/build/stephanmg/ugcore/travis_root/ug4/ugcore/cmake/../../ugcore/ugbase/lib_disc/spatial_disc/user_data/const_user_data.h:310:97: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11

anaegel commented 3 years ago

Lieber Stephan,

danke! Offenbar habe ich da nicht genug getestet. Welchen Compiler nutzt Du?

Viele Grüße Arne

Am 16.09.2020 um 11:22 schrieb Stephan Grein notifications@github.com:

[ 84%] Building CXX object ugcore/CMakeFiles/ug4.dir/ugbase/bridge/disc_bridges/user_data_bridge.cpp.o /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list argument types are: (ug::bridge::Registry, std::string) RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair ^ /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced void RegisterUserDataTypeA(Registry& reg, string grp) ^ detected during: instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension(ug::bridge::Registry &, std::string) [with dim=1]" at line 55 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h" instantiation of "void ug::bridge::RegisterDimensionDependent(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list argument types are: (ug::bridge::Registry, std::string) RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair ^ /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced void RegisterUserDataTypeA(Registry& reg, string grp) ^ detected during: instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension(ug::bridge::Registry &, std::string) [with dim=2]" at line 58 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h" instantiation of "void ug::bridge::RegisterDimensionDependent(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

/home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(243): error: no instance of function template "ug::bridge::RegisterUserDataTypeA" matches the argument list argument types are: (ug::bridge::Registry, std::string) RegisterUserDataTypeA<MathVector<2>, dim, pair_traits>(reg, grp); // Pair ^ /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp(93): note: this candidate was rejected because at least one template argument could not be deduced void RegisterUserDataTypeA(Registry& reg, string grp) ^ detected during: instantiation of "void ug::bridge::UserDataBridge::Functionality::Dimension(ug::bridge::Registry &, std::string) [with dim=3]" at line 61 of "/home/sgrein/Code/ug4/ugcore/cmake/../../ugcore/ugbase/bridge/util.h" instantiation of "void ug::bridge::RegisterDimensionDependent(ug::bridge::Registry &, std::string) [with Functionality=ug::bridge::UserDataBridge::Functionality]" at line 563

compilation aborted for /home/sgrein/Code/ug4/ugcore/ugbase/bridge/disc_bridges/user_data_bridge.cpp (code 2) make[2]: [ugcore/CMakeFiles/ug4.dir/ugbase/bridge/disc_bridges/user_data_bridge.cpp.o] Error 2 make[2]: Waiting for unfinished jobs....

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/UG4/ugcore/issues/34", "url": "https://github.com/UG4/ugcore/issues/34", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

stephanmg commented 3 years ago

Issue no. 1: Compiler icc (ICC) 18.0.1 20171018 (CentOS Linux release 7.6.1810 (Core))

Issue no. 2: GCC 5.4.0 on Linux (Ubuntu 16.04: Xenial)

mlampe commented 3 years ago

Both of these compilers can do C++11, but they default to C++98, while recent version of GCC and Clang default to C++14 or even C++17.

Do we want to officially allow the usage of C++11 features (like in the last commit) in ug4? If yes, cmake should be made to automatically add something like -std=c++11 to the compiler flags.

stephanmg commented 3 years ago

Both of these compilers can do C++11, but they default to C++98, while recent version of GCC and Clang default to C++14 or even C++17.

Do we want to officially allow the usage of C++11 features (like in the last commit) in ug4? If yes, cmake should be made to automatically add something like -std=c++11 to the compiler flags.

I think in the past we were obliged to use non-C++11 features. I do remember vaguely the reasoning to allow older systems to work with ug4 OOTB. But I might be wrong here. Anyway:

If I remember correctly, GCC 4.8.1 (May, 2013) was the first feature complete implementation of the C++11 ISO standard (https://www.iso.org/standard/50372.html) and Clang > 3.3 (FWIW: XCode 5) implements all C++11 features as well (June, 2013).

I'm not sure if sort of antiquated compilers (pre 2013) are still of much use in production or should be supported, but YMMV. In principle it would be great to see C++11 features be allowed in ug4 (Think: lambda expressions).

anaegel commented 3 years ago

I think moving to C++11 is a good idea.

However, it looks like this still does not cure issue no. 1. (icc (ICC) 18.0.1 20171018 (CentOS Linux release 7.6.1810 (Core))). @stephanmg: I would like to suggest a fix here (iss-ugcore-34). Unfortunately, I have no icc available. Could you please check and merge?

stephanmg commented 3 years ago

I think moving to C++11 is a good idea.

However, it looks like this still does not cure issue no. 1. (icc (ICC) 18.0.1 20171018 (CentOS Linux release 7.6.1810 (Core))). @stephanmg: I would like to suggest a fix here (iss-ugcore-34). Unfortunately, I have no icc available. Could you please check and merge?

Thanks for providing this fix. I've merged your proposed code and are awaiting the compilation.

stephanmg commented 3 years ago

After merging the fix, ug4 compiles with my ICC.

Btw.: Adding CXX11=ON in build matrix (81fc210729339fbad83ee7b21ba0f579411a6d8f) is not yet enough, we need to explicitly set it via cmake I believe. One could check automatically for C++11 ready compiler with cmake and add it, I think this is was @mlampe suggested.

~In case you want to follow this route, maybe the following PR #37 is of interest.~

stephanmg commented 3 years ago

Btw: I'm not sure if this is possible: I have an older local cluster which does not have CMake > 3, so if we would not need the 3 branch necessarily to enable C++11 it would be great.

I am not sure if people are still using Precise (At least one can test on Travis against this release) since it is EOL, but this ships also not with CMake > 3.

mlampe commented 3 years ago

The required cmake version is still 2.6.something. This includes switching on C++11 for well-known compilers. If you don't see problems with current master, I think this can be closed.