Closed SnapperTT closed 3 years ago
A second solution to the first problem:
Turn instances of:
int dummy;
Into
int dummy; fakeAssignUninitialised(dummy);
With fakeAssignUninitialised
defined as:
void fakeAssignUninitialised(int&a){}
Hi, thanks for reporting these issues.
The first one has a fix from google test: https://github.com/google/googletest/pull/3024
For the second one, seems that std::thread::id
operators are removed from c++20: https://en.cppreference.com/w/cpp/thread/thread/id. Are you compiling with c++20? What's your compiler version? The solution is to use a std::thread::id
hash in this case I think.
Guillaume
Cheers, the google fix is better than mine
I'm compiling with gcc 11.1.0, using -std=c++11
. I have also tried -std=c++17
.
(Aside: If I'm not mistaken the <
operator should be automagically generated from the <=>
operater in c++20, no?)
Output of make VERBOSE=1
:
[ 45%] Linking CXX executable sample_multithread
cd /home/twigger/turf2/extlib/ozzAnimation/build/samples/multithread && /usr/bin/cmake -E cmake_link_script CMakeFiles/sample_multithread.dir/link.txt --verbose=1
/usr/bin/g++ -std=c++11 -rdynamic CMakeFiles/sample_multithread.dir/sample_multithread.cc.o -o sample_multithread ../framework/libsample_framework.a -lpthread ../framework/glfw/libglfw.a /usr/lib/libGL.so /usr/lib/libGLU.so /usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libX11.so /usr/lib/libXext.so ../../src/geometry/runtime/libozz_geometry.a ../../src/animation/offline/libozz_animation_offline.a ../../src/animation/runtime/libozz_animation.a ../../src/base/libozz_base.a ../../src/options/libozz_options.a
/usr/bin/ld: CMakeFiles/sample_multithread.dir/sample_multithread.cc.o: in function `bool __gnu_cxx::__ops::_Iter_less_iter::operator()<__gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >, __gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > > >(__gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >, __gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >) const':
sample_multithread.cc:(.text._ZNK9__gnu_cxx5__ops15_Iter_less_iterclINS_17__normal_iteratorIPNSt6thread2idESt6vectorIS5_N3ozz12StdAllocatorIS5_EEEEESC_EEbT_T0_[_ZNK9__gnu_cxx5__ops15_Iter_less_iterclINS_17__normal_iteratorIPNSt6thread2idESt6vectorIS5_N3ozz12StdAllocatorIS5_EEEEESC_EEbT_T0_]+0x37): undefined reference to `std::operator<(std::thread::id, std::thread::id)'
/usr/bin/ld: CMakeFiles/sample_multithread.dir/sample_multithread.cc.o: in function `bool __gnu_cxx::__ops::_Val_less_iter::operator()<std::thread::id, __gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > > >(std::thread::id&, __gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >) const':
sample_multithread.cc:(.text._ZNK9__gnu_cxx5__ops14_Val_less_iterclINSt6thread2idENS_17__normal_iteratorIPS4_St6vectorIS4_N3ozz12StdAllocatorIS4_EEEEEEEbRT_T0_[_ZNK9__gnu_cxx5__ops14_Val_less_iterclINSt6thread2idENS_17__normal_iteratorIPS4_St6vectorIS4_N3ozz12StdAllocatorIS4_EEEEEEEbRT_T0_]+0x2b): undefined reference to `std::operator<(std::thread::id, std::thread::id)'
/usr/bin/ld: CMakeFiles/sample_multithread.dir/sample_multithread.cc.o: in function `bool __gnu_cxx::__ops::_Iter_less_val::operator()<__gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >, std::thread::id>(__gnu_cxx::__normal_iterator<std::thread::id*, std::vector<std::thread::id, ozz::StdAllocator<std::thread::id> > >, std::thread::id&) const':
sample_multithread.cc:(.text._ZNK9__gnu_cxx5__ops14_Iter_less_valclINS_17__normal_iteratorIPNSt6thread2idESt6vectorIS5_N3ozz12StdAllocatorIS5_EEEEES5_EEbT_RT0_[_ZNK9__gnu_cxx5__ops14_Iter_less_valclINS_17__normal_iteratorIPNSt6thread2idESt6vectorIS5_N3ozz12StdAllocatorIS5_EEEEES5_EEbT_RT0_]+0x2b): undefined reference to `std::operator<(std::thread::id, std::thread::id)'
collect2: error: ld returned 1 exit status
make[2]: *** [samples/multithread/CMakeFiles/sample_multithread.dir/build.make:125: samples/multithread/sample_multithread] Error 1
Indeed <=> shall do the job. Maybe a mismatch in gcc stl then. Anyway, hashing is a valid and portable solution I think.
Fixes are merged to develop/. Thanks for reporting the issues.
Two issues causing builds to fail:
This can be fixed by disabling
Wmaybe-uninitialized
for the relavent functions:The second fail is due to
std::thread::id::operator<
not being defined