[LLVMdev] LLVM-2.5 WinXP/Cygwin can't find puts() for the hello.c in GettingStarted document

Chuck Zhao czhao at eecg.toronto.edu
Fri Mar 27 10:53:49 PDT 2009

I am using LLVM 2.5 release, together with llvm-gcc4.2-2.5.
For the hello.c demo testing found close to the end of the 
GettingStarted document:

#include <stdio.h>

int main() {
  printf("hello world\n");
  return 0;

Following the instructions:
obtaining the bc file:    /llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc/
running through lli:     *  */lli hello.bc/

I got this error msg:    /*ERROR: Program used external function 'puts' 
which could not be resolved! Abort*/

I think this might have to do with my LD_LIBRARY_PATH settings, thus 
explicitly checked that it includes a path to libc,
echo $LD_LIBRARY_PATH:    

How could I fix this WinXP/Cygwin only thing?

I tried the same steps on a Debian4-i386 machine, everything works fine.

Thank you very much



The bc code of the hello.c file:
llvm-dis < hello.bc:

; ModuleID = '<stdin>'
target datalayout = 
target triple = "i386-mingw32"
@.str = internal constant [13 x i8] c"Hello, world\00"        ; <[13 x 
i8]*> [#uses=1]

define i32 @main() nounwind {
    %0 = tail call i32 @puts(i8* getelementptr ([13 x i8]* @.str, i32 0, 
i32 0)) nounwind        ; <i32> [#uses=0]
    ret i32 0

declare i32 @puts(i8*)

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

More information about the llvm-dev mailing list