[LLVMdev] Difficulty compiling LLVM-based tools with clang

Talin viridia at gmail.com
Thu May 12 17:33:38 PDT 2011


I recently modified my compiler's build files to use clang if it detects its
available, however I'm running into a number of problems with this. I'm
having one set of problems on OS X, and a different set of problems under
Ubuntu.

In both cases I'm attempting to link my frontend - compiled with clang -
against the LLVM libraries - compiled with gcc. (I thought about compiling
LLVM with clang, but then I'd have to compile it twice to bootstrap.)

Under OS X, I get the following error when I try to link:

Undefined symbols:

  "___eprintf", referenced from:

      ___eprintf$non_lazy_ptr in
libLLVMSupport.a(SearchForAddressOfSpecialSymbol.cpp.o)

ld: symbol(s) not found

clang-3: error: linker command failed with exit code 1 (use -v to see
invocation)


As you can see the reference is coming from the LLVM libs.

Under Ubuntu, the problem I get is a crash when calling a method in
DIBuilder. The problem appears to be in the StringRef param, which looks
like it's full of junk when I examine it in the debugger, even though my
code is just passing in the default value for the parameter, which is an
empty StringRef(). I'm guessing there is some incompatibility in the calling
conventions, but I'm passing virtually the same command-line arguments to
clang as I would normally pass to gcc. (With some minor differences having
to do with warning suppression).

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110512/ca77e9ca/attachment.html>


More information about the llvm-dev mailing list