Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CentOS 7: pthread_setname_np issue #39

Open
iscaswcm opened this issue Oct 11, 2017 · 5 comments
Open

CentOS 7: pthread_setname_np issue #39

iscaswcm opened this issue Oct 11, 2017 · 5 comments

Comments

@iscaswcm
Copy link

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.

@wjakob
Copy link
Member

wjakob commented Oct 11, 2017

cc @amyspark

@amyspark
Copy link
Contributor

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.

@iscaswcm
Copy link
Author

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

@amyspark
Copy link
Contributor

amyspark commented Oct 11, 2017

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 <phantom@FreeBSD.org>.

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?

@iscaswcm
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants