[LLVMdev] Difficulty compiling LLVM-based tools with clang

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Thu May 12 18:08:04 PDT 2011


On 11-05-12 8:33 PM, Talin wrote:
> 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)
>

Interesting. A coworker had exactly the same problem trying to build 
rust with clang after having built llvm with gcc.

The problem comes from  SearchForAddressOfSpecialSymbol.cpp:

     // FIXME: Currently disabled when using Clang, as we don't always 
have our
     // runtime support libraries available.
#ifndef __clang__
#ifdef __i386__
     EXPLICIT_SYMBOL(__eprintf);
#endif
#endif

Now, exactly what runtime library is not available is something that 
someone more familiar with OS X will have to answer :-)

> --
> -- Talin

Cheers,
Rafael



More information about the llvm-dev mailing list