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

clang++-libc++ on Trusty doesn't seem to support thread_local #208

Closed
pdimov opened this issue Jan 17, 2018 · 4 comments
Closed

clang++-libc++ on Trusty doesn't seem to support thread_local #208

pdimov opened this issue Jan 17, 2018 · 4 comments

Comments

@pdimov
Copy link
Member

pdimov commented Jan 17, 2018

I added a few more configurations to Travis here: 0ac815e

and the clang++-libc++ one (which uses the provided libc++-dev package) fails when thread_local is used with

/home/travis/build/boostorg/boost-root/libs/config/test/boost_no_cxx11_thread_local.ipp:20: undefined reference to `__cxa_thread_atexit'

https://travis-ci.org/boostorg/config/jobs/329979139#L2474

I'm not quite sure what we ought to do about that; either define BOOST_NO_CXX11_THREAD_LOCAL for libc++ on Linux, or somehow figure out a way to make that config work. I think I tend towards the former.

(Having a working libc++ Linux Travis config is nice as it doesn't need to wait for the permanently clogged Mac jobs.)

@jzmaddock
Copy link
Collaborator

I get the impression that libc++ on Linux is somewhat under-supported. I've seen that error before - but can't remember where for now - and without using thread_local, just std lib code if I remember correctly.

I believe the fix is to link to libcxxabi - but I've never found it that easy to set up on Linux - is there a package?

@pdimov
Copy link
Member Author

pdimov commented Jan 18, 2018

In this case everything else seems to work correctly, it's just thread_local that fails (and then presumably only in the case of a nontrivial destructor.)

smart_ptr tests pass on this config: https://travis-ci.org/boostorg/smart_ptr/jobs/330025116
and system passes too: https://travis-ci.org/boostorg/system/jobs/330093113

So it's not like the whole ABI is missing; just __cxa_thread_atexit. Presumably libsup++ gets linked in, why does its __cxa_thread_exit not work, no idea. The libc++-dev package contains no libc++-abi.so, just libc++.so, so that's not being used.

The command clang++-libc++ is just a shell script that calls clang++ -stdlib=libc++ and nothing else; and clang++ itself does support thread_local so it's somewhat of a mystery why -stdlib=libc++ breaks it.

No idea about libcxxabi. I generally try to keep the Travis configs as standard (as in, close to the system-provided) as possible, to mimic what real-world users would encounter.

All in all, it seems to me that defining BOOST_NO_CXX11_THREAD_LOCAL for Linux libc++ seems our best course at the moment.

I haven't tried g++-libc++ but no sane person would use that. :-)

@jzmaddock
Copy link
Collaborator

OK lets go with that for now and see how it goes.

@pdimov
Copy link
Member Author

pdimov commented Jan 19, 2018

OK: #210

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

No branches or pull requests

2 participants