[LLVMdev] Adding system libraries to the LLVM build

Evan Jones ejones at uwaterloo.ca
Tue Mar 15 19:36:58 PST 2005

I'm back working on my threading patch for the LLVM JIT after being 
distracted by a paper deadline. I think I have things working nicely on 
Mac OS X (I just did a CVS up and it will take another hour or two to 
build), but I'm having an issue with building on Linux. Specifically, 
"lli" fails to link because it now needs to link against libpthread, 
because it ends up pulling in ExecutionEngine.h which in turn pulls in 
ThreadSupport.h. I'm wondering how this should be fixed, because I'm 
afraid it may not be a simple problem.

So the first question is, to which Makefile do I need to add the 
"-lpthread" flag to get the thing to compile? The next issue is what is 
the *right* way to do this:

1. Some platforms (eg. Mac OS X) don't need to specify "-lpthread" 
because pthreads is included in the base libc (thankfully, on Mac OS X 
it doesn't hurt if you do). Other platforms need to pull in some other 
thread library entirely (Windows). Some platforms may not HAVE 
pthreads, or may have a broken version. This suggests that this likely 
has to be part of the autoconf magic which I do not understand.

2. The interpreter probably does not need thread support at all, since 
it is almost certainly thread unsafe. Maybe it should override the 
"platform" version of ThreadSupport and with a null implementation. 
Alternatively, perhaps ExecutionEngine.h should not pull in 
ThreadSupport, and only JIT.h should.

Any suggestions for the correct direction out of this situation?


Evan Jones

More information about the llvm-dev mailing list