mitsuba icon indicating copy to clipboard operation
mitsuba copied to clipboard

CentOS 7: pthread_setname_np issue

Open iscaswcm opened this issue 8 years ago • 5 comments

src/libcore/thread.cpp: In static member function ‘static void mitsuba::Thread::initializeOpenMP(size_t)’: src/libcore/thread.cpp:637:53: error: invalid conversion from ‘const char*’ to ‘pthread_t {aka long unsigned int}’ [-fpermissive] pthread_setname_np(threadName.c_str()); ^ src/libcore/thread.cpp:637:54: error: too few arguments to function ‘int pthread_setname_np(pthread_t, const char*)’ pthread_setname_np(threadName.c_str());

I modify pthread_setname_np(threadName.c_str()); to pthread_setname_np((pthread_self(),threadName.c_str()); It's OK.

iscaswcm avatar Oct 11 '17 00:10 iscaswcm

cc @amyspark

wjakob avatar Oct 11 '17 00:10 wjakob

Yes, my mistake (I was setting up Travis in my fork and it bit me). I've amended #38 to close this issue as well.

amyspark avatar Oct 11 '17 00:10 amyspark

The same file src/libcore/thread.cpp, line 444 : pthread_setname_np(threadName.c_str());

line 444 runs on OSX, I wonder whether it has the same issue ? @amyspark

iscaswcm avatar Oct 11 '17 00:10 iscaswcm

Line 444 works in MacOS because its pthreads library does not require the thread name. Conversely, Linux does, and this is why the build breaks in line 637:

PTHREAD_SETNAME_NP(3)    BSD Library Functions Manual    PTHREAD_SETNAME_NP(3)

NAME
     pthread_setname_np -- set the thread name

SYNOPSIS
     #include <pthread.h>

     void
     pthread_setname_np(const char *name);

DESCRIPTION
     The pthread_set_name_np() function sets the internal name for the calling
     thread to string value specified by name argument.

AUTHORS
     This manual page was written by Alexey Zelkin <[email protected]>.

BSD                            February 13, 2003                           BSD

My mistake was in #34, I replaced the old prctl call without testing it in Linux. Try the pull request I linked. Does it still fail for you?

amyspark avatar Oct 11 '17 01:10 amyspark

Mitsuba 0.6.0 works well on CentOS 7, thanks a lot. @amyspark

iscaswcm avatar Oct 11 '17 01:10 iscaswcm