vendredi 13 avril 2018

Building thread.o from libstdc++11

I'm trying to make helgrind works with C++11 std::thread. I tried to do what is says here (those are the instructions):

rebuild just thread.cc and link thread.o into your program.

I got thread.cc and when I tried g++ -std=c++11 -c thread.cc but then I got

thread.cc:30:27: fatal error: cxxabi_forced.h: No such file or directory
 #include <cxxabi_forced.h>

so I commented that line and then got

thread.cc: In function ‘void* std::execute_native_thread_routine(void*)’:
thread.cc:79:7: error: ‘_State_ptr’ is not a member of ‘std::thread’
       thread::_State_ptr __t{ static_cast<thread::_State*>(__p) };
       ^
thread.cc:79:26: error: expected ‘;’ before ‘__t’
       thread::_State_ptr __t{ static_cast<thread::_State*>(__p) };
                          ^
thread.cc:80:7: error: ‘__t’ was not declared in this scope
       __t->_M_run();
       ^
thread.cc: At global scope:
thread.cc:102:3: error: ‘_State’ in ‘class std::thread’ does not name a type
   thread::_State::~_State() = default;
   ^
thread.cc:133:27: error: variable or field ‘_M_start_thread’ declared void
   thread::_M_start_thread(_State_ptr state, void (*)())
                           ^
thread.cc:133:27: error: ‘_State_ptr’ was not declared in this scope
thread.cc:133:45: error: expected primary-expression before ‘void’
   thread::_M_start_thread(_State_ptr state, void (*)())
                                             ^
thread.cc: In member function ‘void std::thread::_M_start_thread(std::thread::__shared_base_type)’:
thread.cc:155:44: error: no matching function for call to ‘std::thread::_M_start_thread(std::remove_reference<std::shared_ptr<std::thread::_Impl_base>&>::type, std::nullptr_t)’
     _M_start_thread(std::move(__b), nullptr);
                                            ^
thread.cc:155:44: note: candidate is:
thread.cc:145:3: note: void std::thread::_M_start_thread(std::thread::__shared_base_type)
   thread::_M_start_thread(__shared_base_type __b)
   ^
thread.cc:145:3: note:   candidate expects 1 argument, 2 provided
thread.cc: At global scope:
thread.cc:159:3: error: prototype for ‘void std::thread::_M_start_thread(std::thread::__shared_base_type, void (*)())’ does not match any in class ‘std::thread’
   thread::_M_start_thread(__shared_base_type __b, void (*)())
   ^
thread.cc:145:3: error: candidate is: void std::thread::_M_start_thread(std::thread::__shared_base_type)
   thread::_M_start_thread(__shared_base_type __b)
   ^

Any ideas how to make it to be compiled?

Aucun commentaire:

Enregistrer un commentaire