<div class="gmail_quote">---------- Переадресованное сообщение ----------<br>От: "Anton Smirnov" <<a href="mailto:dev@antonsmirnov.name">dev@antonsmirnov.name</a>><br>Дата: 06 Июл 2014 г. 12:58<br>Тема: Re: [cfe-dev] linking with libclang for ios<br>
Кому: "Alp Toker" <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a>><br>Копия: <br><br type="attribution"><p dir="ltr">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.</p>
<div class="gmail_quote">06 Июл 2014 г. 12:03 пользователь "Alp Toker" <<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>> написал:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Did you try building with LLVM_ENABLE_THREADS off?<br>
<br>
Also consider trying ToT to get the latest fixes.<br>
<br>
Alp.<br>
<br>
<br>
On 06/07/2014 08:23, Anton Smirnov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've found Mutex.cpp file in llvm sources and it seems it's not the first mutex-related call in constructor.<br>
This makes me think it's really absent method in system libs:<br>
<br>
// Construct a Mutex using pthread calls<br>
<br>
MutexImpl::MutexImpl( bool recursive)<br>
<br>
: data_(0)<br>
<br>
{<br>
<br>
// Declare the pthread_mutex data structures<br>
<br>
pthread_mutex_t* mutex =<br>
<br>
static_cast<pthread_mutex_t*>(<u></u>malloc(sizeof(pthread_mutex_t)<u></u>));<br>
<br>
pthread_mutexattr_t attr;<br>
<br>
<br>
// Initialize the mutex attributes<br>
<br>
int errorcode = pthread_mutexattr_init(&attr);<br>
<br>
assert(errorcode == 0); (void)errorcode;<br>
<br>
<br>
// Initialize the mutex as a recursive mutex, if requested, or normal<br>
<br>
// otherwise.<br>
<br>
int kind = ( recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_NORMAL );<br>
<br>
errorcode = pthread_mutexattr_settype(&<u></u>attr, kind);<br>
<br>
assert(errorcode == 0);<br>
<br>
<br>
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \<br>
<br>
!defined(__DragonFly__) && !defined(__Bitrig__)<br>
<br>
// Make it a process local mutex<br>
<br>
errorcode = pthread_mutexattr_setpshared(&<u></u>attr, PTHREAD_PROCESS_PRIVATE);<br>
<br>
assert(errorcode == 0);<br>
<br>
#endif<br>
<br>
<br>
// Initialize the mutex<br>
<br>
errorcode = pthread_mutex_init(mutex, &attr);<br>
<br>
assert(errorcode == 0);<br>
<br>
<br>
// Destroy the attributes<br>
<br>
errorcode = pthread_mutexattr_destroy(&<u></u>attr); // fails here<br>
<br>
assert(errorcode == 0);<br>
<br>
// Assign the data member<br>
data_ = mutex;<br>
<br>
}<br>
<br>
I've marked where it fails.<br>
How can that be that previous mutex-related methods success and this one fails?<br>
What can i do to fix it?<br>
<br>
Regards, Anton.<br>
<br>
<br>
2014-07-05 19:31 GMT+06:00 Anton Smirnov <<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a> <mailto:<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>><u></u>>:<br>
<br>
Hi.<br>
<br>
I was able to cross-compile llvm/clang for i386 and i'm trying to<br>
use it in my ios app.<br>
Also i was able to add headers and static libs (both libLLVM*.a<br>
and libclang*.a) and compile/link the project with no errors.<br>
<br>
But when trying to run simple app i'm getting error:<br>
<br>
*Detected an attempt to call a symbol in system libraries that is<br>
not present on the iPhone:*<br>
<br>
*pthread_mutexattr_destroy$<u></u>UNIX2003 called from function<br>
_ZN4llvm3sys9MutexImplC2Eb in image LibClangUsageDemo3.*<br>
<br>
<br>
What can i do in order to fix it?<br>
<br>
Is it llvm/clang issue or i'm doing smth wrong?<br>
<br>
Regards, Anton.<br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote>
<br>
-- <br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</blockquote></div>
</div>