[CentOS-devel] __gthrw___pthread_key_create in devtoolset-6


dacav at teknik.io
Tue May 22 07:32:56 UTC 2018

Hello good people

I'm packaging for CentOS 7 a piece of proprietary software. The software is
written in C++14, so I need to use the devtoolset to run it.

Unfortunately I'm having some issues with linking of pthreads. First off I'm
getting this warning:

    In file included from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/x86_64-redhat-linux/bits/gthr.h:148:0,
                     from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/ext/atomicity.h:35,
                     from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/bits/ios_base.h:39,
                     from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/ios:42,
                     from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/ostream:38,
                     from /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/iostream:39,
                     from src/logd-main.cpp:23:
    /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/x86_64-redhat-linux/bits/gthr-default.h:236:10: warning: 'int __gthrw___pthread_key_create(pthread_key_t*, void (*)(void*)) throw ()' used but never defined

…Where the problematic line is a `#include <iostream>`.

Then of course it gets problematic upon linking time

    objs/intel-debug/src/logd-main.o:(.rodata+0x8): undefined reference to `__gthrw___pthread_key_create(unsigned int*, void (*)(void*))'
    collect2: error: ld returned 1 exit status

I searched around on the Web: the classic suggestion (from stackoverflow and
such) will be to check for the `-pthread` flag to be present at compilation.
This is of course tackled already.

Since the compilation is working in other contexts, I started to wonder if
this is some known problem in CentOS + Devtoolset: did someone have similar

Perhaps there's something wrong in how I do the build. Is there in CentOS
some software which is using Devtoolset which I could take as example for my

Thanks in advance for any suggestion :)

More information about the CentOS-devel mailing list