development/toponaming branch fails to build on Debian 11

Report observations made with the new Toponaming branch.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

development/toponaming branch fails to build on Debian 11

Post by user1234 »

Hello!

@realthunder: today i saw that there are some new commits in the development/toponaming branch. So i tried to build it, but it fails (also made a new clean build).

Code: Select all

.....
[ 44%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasherPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h: In member function ‘bool App::StringID::isFromSameHasher(const StringHasherRef&) const’:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: error: ambiguous overload for ‘operator==’ (operand types are ‘App::StringHasher* const’ and ‘const StringHasherRef’ {aka ‘const Base::Reference<App::StringHasher>’})
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~ ^~ ~~~~~~
      |                      |          |
      |                      |          const StringHasherRef {aka const Base::Reference<App::StringHasher>}
      |                      App::StringHasher* const
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:33,
                 from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasherPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/Base/Handle.h:137:10: note: candidate: ‘bool Base::Reference<T>::operator==(const Base::Reference<T>&) const [with T = App::StringHasher]’ (reversed)
  137 |     bool operator==(const Reference<T>& p) const {
      |          ^~~~~~~~
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasherPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: note: candidate: ‘operator==(App::StringHasher*, App::StringHasher*)’ (built-in)
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~~^~~~~~~~~
make[2]: *** [src/App/CMakeFiles/FreeCADApp.dir/build.make:293: src/App/CMakeFiles/FreeCADApp.dir/StringHasherPyImp.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 44%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshEditor.cpp.o
[ 44%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshAlgos.cpp.o
[ 44%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshVSLink.cpp.o
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringIDPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h: In member function ‘bool App::StringID::isFromSameHasher(const StringHasherRef&) const’:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: error: ambiguous overload for ‘operator==’ (operand types are ‘App::StringHasher* const’ and ‘const StringHasherRef’ {aka ‘const Base::Reference<App::StringHasher>’})
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~ ^~ ~~~~~~
      |                      |          |
      |                      |          const StringHasherRef {aka const Base::Reference<App::StringHasher>}
      |                      App::StringHasher* const
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:33,
                 from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringIDPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/Base/Handle.h:137:10: note: candidate: ‘bool Base::Reference<T>::operator==(const Base::Reference<T>&) const [with T = App::StringHasher]’ (reversed)
  137 |     bool operator==(const Reference<T>& p) const {
      |          ^~~~~~~~
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringIDPyImp.cpp:25:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: note: candidate: ‘operator==(App::StringHasher*, App::StringHasher*)’ (built-in)
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~~^~~~~~~~~
make[2]: *** [src/App/CMakeFiles/FreeCADApp.dir/build.make:306: src/App/CMakeFiles/FreeCADApp.dir/StringIDPyImp.cpp.o] Error 1
[ 44%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MesherHelper.cpp.o
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Octree.cpp.o
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_OctreeNode.cpp.o
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Pattern.cpp.o
[ 45%] Linking CXX shared library ../../../../Mod/Path/area.so
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_ProxyMesh.cpp.o
[ 45%] Built target area
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_TryCatch.cpp.o
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_subMesh.cpp.o
[ 45%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/Utils_ExceptHandlers.cpp.o
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.cpp:45:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h: In member function ‘bool App::StringID::isFromSameHasher(const StringHasherRef&) const’:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: error: ambiguous overload for ‘operator==’ (operand types are ‘App::StringHasher* const’ and ‘const StringHasherRef’ {aka ‘const Base::Reference<App::StringHasher>’})
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~ ^~ ~~~~~~
      |                      |          |
      |                      |          const StringHasherRef {aka const Base::Reference<App::StringHasher>}
      |                      App::StringHasher* const
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:33,
                 from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.cpp:45:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/Base/Handle.h:137:10: note: candidate: ‘bool Base::Reference<T>::operator==(const Base::Reference<T>&) const [with T = App::StringHasher]’ (reversed)
  137 |     bool operator==(const Reference<T>& p) const {
      |          ^~~~~~~~
In file included from /home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.cpp:45:
/home/user/Programs/FreeCADdevelopmenttoponaming/sourcecode/src/App/StringHasher.h:93:30: note: candidate: ‘operator==(App::StringHasher*, App::StringHasher*)’ (built-in)
   93 |         return this->_hasher == hasher;
      |                ~~~~~~~~~~~~~~^~~~~~~~~
make[2]: *** [src/App/CMakeFiles/FreeCADApp.dir/build.make:280: src/App/CMakeFiles/FreeCADApp.dir/StringHasher.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2617: src/App/CMakeFiles/FreeCADApp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 45%] Building C object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/libmesh.c.o
[ 45%] Linking CXX shared library ../../../lib/libSMESH.so
[ 45%] Built target SMESH
make: *** [Makefile:149: all] Error 2

real	1m27.920s
user	15m40.213s
sys	1m26.376s
System: Debian 11
OCCT: 7.6.3
Compiler: GCC10 (set in cmake to C++20)

If something other info is missing, please let me know.

Greetings
user1234
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: development/toponaming branch fails to build on Debian 11

Post by user1234 »

Forgot to mention:
-DBUILD_FLAT_MESH = 1

Greetings
user1234
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: development/toponaming branch fails to build on Debian 11

Post by realthunder »

Can you please manually apply the patch here, and try again.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: development/toponaming branch fails to build on Debian 11

Post by user1234 »

realthunder wrote: Sun Sep 04, 2022 6:37 am Can you please manually apply the patch here, and try again.
Thanks! Compiles fine! Testing must wait. Just asking, is there something i should look specific when testing?

Greetings
user1234
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: development/toponaming branch fails to build on Debian 11

Post by wmayer »

Compiler: GCC10 (set in cmake to C++20)
Tested with clang++ 11 and C++17 (I don't have C++20 available here) and this compiles fine.

Not sure if the issue you have is because of the different compilers or the different C++ standard. But the use of the comparison in isFromSameHasher is indeed odd because it uses a raw pointer of StringHasher and compares it with a StringHasherRef.

I guess the gcc compiler tries these two options:
  • Convert the StringHasher* into a StringHasherRef (by using the constructor) to do the comparison or
  • Convert the StringHasherRef into a StringHasher* (because there is a suitable operator defined in Base::Reference) to do the comparison.
and thus raises the ambiguity error.

IMO it's the actually the implementation of isFromSameHasher to blame and this should be fixed instead of modifying Base::Reference.

Does it work to change it to

Code: Select all

    bool isFromSameHasher(const StringHasherRef & hasher) const
    {
        return this->_hasher == static_cast<StringHasher*>(hasher);
    }
?

Additionally, it should be avoided that a StringHasher* can be implicitly converted into a StringHasherRef and therefore the constructor of Base::Reference should be declared as explicit. When doing so then an overloaded version of reset(T*) is needed.
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: development/toponaming branch fails to build on Debian 11

Post by user1234 »

wmayer wrote: Sun Sep 04, 2022 5:22 pm Tested with clang++ 11 and C++17 (I don't have C++20 available here) and this compiles fine.
This is the reason why i noted the compiler, since the gitlab CI compile check is OK and i did no see anything odd in the log from it.


wmayer wrote: Sun Sep 04, 2022 5:22 pm Does it work to change it to

Code: Select all

    bool isFromSameHasher(const StringHasherRef & hasher) const
    {
        return this->_hasher == static_cast<StringHasher*>(hasher);
    }
?
Can only test it in a few days.


Greetings
user1234
Post Reply