[cfe-dev] Fwd: Re: linking with libclang for ios

Anton Smirnov dev at antonsmirnov.name
Sun Jul 6 00:12:21 PDT 2014


---------- Переадресованное сообщение ----------
От: "Anton Smirnov" <dev at antonsmirnov.name>
Дата: 06 Июл 2014 г. 12:58
Тема: Re: [cfe-dev] linking with libclang for ios
Кому: "Alp Toker" <alp at nuanti.com>
Копия:

No, I did not actually. Is it related to mutex somehow? Will this make
llvm/clang slower btw? I've googled a bit and found a lot of similar
reports for older xcode/ios versions. My idea is to recompile the lib with
ios min version 6 instead of 5.
06 Июл 2014 г. 12:03 пользователь "Alp Toker" <alp at nuanti.com> написал:

> Did you try building with LLVM_ENABLE_THREADS off?
>
> Also consider trying ToT to get the latest fixes.
>
> Alp.
>
>
> On 06/07/2014 08:23, Anton Smirnov wrote:
>
>> I've found Mutex.cpp file in llvm sources and it seems it's not the first
>> mutex-related call in constructor.
>> This makes me think it's really absent method in system libs:
>>
>> // Construct a Mutex using pthread calls
>>
>> MutexImpl::MutexImpl( bool recursive)
>>
>>   : data_(0)
>>
>> {
>>
>>   // Declare the pthread_mutex data structures
>>
>>   pthread_mutex_t* mutex =
>>
>> static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t)));
>>
>>   pthread_mutexattr_t attr;
>>
>>
>>   // Initialize the mutex attributes
>>
>>   int errorcode = pthread_mutexattr_init(&attr);
>>
>>   assert(errorcode == 0); (void)errorcode;
>>
>>
>>   // Initialize the mutex as a recursive mutex, if requested, or normal
>>
>>   // otherwise.
>>
>>   int kind = ( recursive  ? PTHREAD_MUTEX_RECURSIVE :
>> PTHREAD_MUTEX_NORMAL );
>>
>>   errorcode = pthread_mutexattr_settype(&attr, kind);
>>
>>   assert(errorcode == 0);
>>
>>
>> #if !defined(__FreeBSD__) && !defined(__OpenBSD__) &&
>> !defined(__NetBSD__) && \
>>
>>     !defined(__DragonFly__) && !defined(__Bitrig__)
>>
>>   // Make it a process local mutex
>>
>>   errorcode = pthread_mutexattr_setpshared(&attr,
>> PTHREAD_PROCESS_PRIVATE);
>>
>>   assert(errorcode == 0);
>>
>> #endif
>>
>>
>>   // Initialize the mutex
>>
>>   errorcode = pthread_mutex_init(mutex, &attr);
>>
>>   assert(errorcode == 0);
>>
>>
>>   // Destroy the attributes
>>
>>   errorcode = pthread_mutexattr_destroy(&attr); // fails here
>>
>>   assert(errorcode == 0);
>>
>>   // Assign the data member
>>   data_ = mutex;
>>
>> }
>>
>> I've marked where it fails.
>> How can that be that previous mutex-related methods success and this one
>> fails?
>> What can i do to fix it?
>>
>> Regards, Anton.
>>
>>
>> 2014-07-05 19:31 GMT+06:00 Anton Smirnov <dev at antonsmirnov.name <mailto:
>> dev at antonsmirnov.name>>:
>>
>>     Hi.
>>
>>     I was able to cross-compile llvm/clang for i386 and i'm trying to
>>     use it in my ios app.
>>     Also i was able to add headers and static libs (both libLLVM*.a
>>     and libclang*.a) and compile/link the project with no errors.
>>
>>     But when trying to run simple app i'm getting error:
>>
>>     *Detected an attempt to call a symbol in system libraries that is
>>     not present on the iPhone:*
>>
>>     *pthread_mutexattr_destroy$UNIX2003 called from function
>>     _ZN4llvm3sys9MutexImplC2Eb in image LibClangUsageDemo3.*
>>
>>
>>     What can i do in order to fix it?
>>
>>     Is it llvm/clang issue or i'm doing smth wrong?
>>
>>     Regards, Anton.
>>
>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
> --
> http://www.nuanti.com
> the browser experts
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140706/a2fded05/attachment.html>


More information about the cfe-dev mailing list