[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:    
*//lib:/usr/lib:/opt/llvm-2.5/lib:.:/home/czhao/suif/suif_1.3.0/i686-cygwin-cygwin/solib//*


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

Chuck


Env:
WinXP/Cygwin/LLVM-2.5/LLVMGCC4.2-2.5

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

; ModuleID = '<stdin>'
target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-mingw32"
@.str = internal constant [13 x i8] c"Hello, world\00"        ; <[13 x 
i8]*> [#uses=1]

define i32 @main() nounwind {
entry:
    %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