0

I've downloaded the assimp source code from git using git clone https://github.com/assimp/assimp.git. I then used cmake, but I had to add the flag -DASSIMP_WARNINGS_AS_ERRORS=OFF in order to sidestep some earlier compilation issues where I was getting errors about functions in stb_i.h being defined but not used. When I type sudo make I get the following compilation errors

/home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.cpp:226:13: error: specialization of ‘template<class _Tp> struct std::hash’ in different namespace [-fpermissive]
 struct std::hash<Vertex> {
             ^
In file included from /usr/include/c++/5/bits/basic_string.h:5471:0,
                 from /usr/include/c++/5/string:52,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iterator:64,
                 from /home/kshaugnnessy/Downloads/engine/assimp/contrib/utf8cpp/source/utf8/core.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/contrib/utf8cpp/source/utf8/checked.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/../contrib/utf8cpp/source/utf8.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/types.h:79,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/Importer.hpp:60,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/GenericProperty.h:52,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/Common/BaseProcess.h:46,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.h:48,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.cpp:48:
/usr/include/c++/5/bits/functional_hash.h:58:12: error:   from definition of ‘template<class _Tp> struct std::hash’ [-fpermissive]
     struct hash;
            ^
/home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.cpp:235:13: error: specialization of ‘template<class _Tp> struct std::equal_to’ in different namespace [-fpermissive]
 struct std::equal_to<Vertex> {
             ^
In file included from /usr/include/c++/5/string:48:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iterator:64,
                 from /home/kshaugnnessy/Downloads/engine/assimp/contrib/utf8cpp/source/utf8/core.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/contrib/utf8cpp/source/utf8/checked.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/../contrib/utf8cpp/source/utf8.h:31,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/types.h:79,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/Importer.hpp:60,
                 from /home/kshaugnnessy/Downloads/engine/assimp/include/assimp/GenericProperty.h:52,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/Common/BaseProcess.h:46,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.h:48,
                 from /home/kshaugnnessy/Downloads/engine/assimp/code/PostProcessing/JoinVerticesProcess.cpp:48:
/usr/include/c++/5/bits/stl_function.h:332:12: error:   from definition of ‘template<class _Tp> struct std::equal_to’ [-fpermissive]
     struct equal_to;
            ^
code/CMakeFiles/assimp.dir/build.make:747: recipe for target 'code/CMakeFiles/assimp.dir/PostProcessing/JoinVerticesProcess.cpp.o' failed
make[2]: *** [code/CMakeFiles/assimp.dir/PostProcessing/JoinVerticesProcess.cpp.o] Error 1
CMakeFiles/Makefile2:203: recipe for target 'code/CMakeFiles/assimp.dir/all' failed
make[1]: *** [code/CMakeFiles/assimp.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

What can I do to make this work?

Thank you.

  • You may need to pull [one of the official releases](https://github.com/assimp/assimp/tags) to get reliable behavior, rather than trying to build whatever is in the master branch at this moment. – Drew Dormann Jul 20 '23 at 19:01
  • 1
    I just compiled the latest on master and it compiled clean. The error looks like some changes has been made to the source code. Did you change anything? – Ted Lyngmo Jul 20 '23 at 19:11
  • 1
    Which gcc version do you use? Seems like a bug described in [that answer](https://stackoverflow.com/a/25594741/3440745), which have been fixed in gcc 7. – Tsyvarev Jul 20 '23 at 21:20

1 Answers1

0

Related to this post possible g++ bug this seems to be an compiler bug. The surrounding block is not in the std-namespace and this seems to cause the compiler warning.

KimKulling
  • 2,654
  • 1
  • 15
  • 26