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

Jeff Kuskin jk500500 at yahoo.com
Wed Jul 16 06:52:15 PDT 2014


Thanks for the info.

I've temporarily hacked around this issue by creating a set of dummy (stub) pthread data types and functions (only those that libc++ and libc++abi actually use).  Once the real patch is integrated into svn, I'll of course switch to that.

-- Jeff




----- Original Message -----
> From: Jonathan Roelofs <jonathan at codesourcery.com>
> To: Marshall Clow <mclow.lists at gmail.com>; Jeff Kuskin <jk500500 at yahoo.com>
> Cc: "cfe-dev at cs.uiuc.edu" <cfe-dev at cs.uiuc.edu>
> Sent: Tuesday, July 15, 2014 4:34 PM
> Subject: Re: [cfe-dev] [libc++] Support for systems lacking pthreads?
> 
> 
> 
> 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