[cfe-dev] [libc++] Support for systems lacking pthreads?

Jonathan Roelofs jonathan at codesourcery.com
Tue Jul 15 13:34:14 PDT 2014



On 7/15/14, 7:31 AM, Marshall Clow wrote:
> On Jul 10, 2014, at 3:36 PM, Jeff Kuskin <jk500500 at yahoo.com> wrote:
>
>> I'm trying to cross-compile libc++ for an embedded system that lacks any kind of threading support, meaning it has no pthread libraries, headers, etc.  I've got a working clang,compiler-rt, newlib, and libc++abi already built and installed.
>>
>> For libc++, CMake seems to test for libpthread and (properly) not find it:
>>
>>    -- Looking for pthread_create in pthread
>>    -- Looking for pthread_create in pthread - not found
>>
>> But when I try to do the actual libc++ build, various source files that use pthreads are still part of the build, which causes the build to fail.  For example, condition_variable.cpp:
>>
>>      In file included from /data0/jsk/llvm/llvm-svn/llvm/projects/libcxx/src/condition_variable.cpp:10:
>>      In file included from /data0/jsk/llvm/llvm-svn/llvm/projects/libcxx/include/condition_variable:111:
>>      /data0/jsk/llvm/llvm-svn/llvm/projects/libcxx/include/__mutex_base:27:5: error: unknowntype name 'pthread_mutex_t'
>>      pthread_mutex_t __m_;
>>
>> Is there any workaround for this issue?
>
> Jeff —
>
> Currently there is no workaround for this; libc++ is not set up to run on a system that does not have threading support.
> However, Jon Roelofs, who did the “single threaded” work on libc++abi, is planning on working on that.
Jeff,

Here's a currently-in-progress review of the libc++ patch: 
http://reviews.llvm.org/D3969

I haven't finished it, but it should get you most of the way there. I plan to 
pick this back up in the near-ish future.


Cheers,
Jon
>
> — Marshall
>
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the cfe-dev mailing list