encryptogroup / MOTION

An efficient, user-friendly, modular, and extensible framework for mixed-protocol secure multi-party computation with two or more parties
MIT License
85 stars 40 forks source link

cannot convert '_opaque_pthread_t*' to 'const char*' #16

Closed Cryptographer63 closed 2 years ago

Cryptographer63 commented 2 years ago

When I use intel macos to compile, the following problems occur, the version of g++ is g++-11

`error: cannot convert '_opaque_pthread_t' to 'const char' 32 pthread_setname_np(handle, name.c_str()); ^~
_opaque_pthread_t*

In file included from /usr/local/Cellar/gcc/11.2.0_3/include/c++/11/x86_64-apple-darwin21/bits/gthr-default.h:35, from /usr/local/Cellar/gcc/11.2.0_3/include/c++/11/x86_64-apple-darwin21/bits/gthr.h:148, from /usr/local/Cellar/gcc/11.2.0_3/include/c++/11/ext/atomicity.h:35, from /usr/local/Cellar/gcc/11.2.0_3/include/c++/11/bits/basic_string.h:39, from /usr/local/Cellar/gcc/11.2.0_3/include/c++/11/string:55, from /Users/zhangshuguang/Desktop/MOTION/src/motioncore/utility/thread.h:23, from /Users/zhangshuguang/Desktop/MOTION/src/motioncore/utility/thread.cpp:21: /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/pthread.h:510:28: note: initializing argument 1 of 'int pthread_setname_np(const char)' 510 | int pthread_setname_np(const char); | ^~~ make[2]: [src/motioncore/CMakeFiles/motion.dir/utility/thread.cpp.o] Error 1 make[1]: [src/motioncore/CMakeFiles/motion.dir/all] Error 2 make: *** [all] Error 2`

Oleksandr-Tkachenko commented 2 years ago

Does changing the content of https://github.com/encryptogroup/MOTION/blob/3f9ba6a0248677422ee90a4792bc7810a51878c0/src/motioncore/utility/thread.cpp#L29 to

#if !defined(__APPLE__)
  assert(name.size() <= 16);
  auto handle = thread.native_handle();
  pthread_setname_np(handle, name.c_str());
#endif

solve the problem for you?

Cryptographer63 commented 2 years ago

Resolved, thanks

Oleksandr-Tkachenko commented 2 years ago

Would you mind to make a PR?