[LLVMdev] C API linking problem

Paul Melis llvm at assumetheposition.nl
Tue Sep 15 06:34:09 PDT 2009

Hello all,

Does anyone have any inside why I can't get the below simple C API test to
link? This is on a 32-bit Gentoo Linux system and LLVM TOT which was
compiled with enable-optimized, gcc is 4.3.2.

15:26|melis at juggle2:~/c/llvmpy> cat t.c
#include "llvm-c/Core.h"

int main()
    LLVMContextRef ctx;
    ctx = LLVMContextCreate();
    return 0;

15:29|melis at juggle2:~/c/llvmpy> llvm-config --cflags --ldflags --libs all
-I/home/melis/llvm/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS -O3 -fomit-frame-pointer -fPIC
-L/home/melis/llvm/lib  -lpthread -ldl -lm
-lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT
-lLLVMExecutionEngine -lLLVMDebugger -lLLVMCBackend -lLLVMCBackendInfo
-lLLVMBitWriter -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen
-lLLVMSelectionDAG -lLLVMX86Info -lLLVMAsmPrinter -lLLVMCodeGen
-lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAsmParser
-lLLVMArchive -lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMMC
-lLLVMCore -lLLVMSupport -lLLVMSystem

15:29|melis at juggle2:~/c/llvmpy> gcc -W -Wall -o blah `llvm-config --cflags
--ldflags --libs all` t.c
/tmp/ccs4MbKp.o: In function `main':
t.c:(.text+0x21): undefined reference to `LLVMContextCreate'
collect2: ld returned 1 exit status

15:29|melis at juggle2:~/c/llvmpy> nm ~/llvm/lib/libLLVMCore.a | grep
00001bc0 T LLVMContextCreate


More information about the llvm-dev mailing list