[LLVMdev] darwin dragon-egg build issues

Peter O'Gorman peter at pogma.com
Sat Apr 10 18:29:07 PDT 2010


On 04/10/2010 08:01 PM, Jack Howarth wrote:

> 
> bash-3.2$ GCC=/sw/bin/gcc-4 CC=gcc-4 CXX=g++-4 CFLAGS=-I/sw/include CXXFLAGS=-I/sw/include LLVM_CONFIG=/sw/lib/llvm/bin/llvm-config make
> g++-4 -c  -I/sw/lib/llvm/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -MD -MP -DIN_GCC -DREVISION=\"100954M\" -DTARGET_NAME=\"x86_64-apple-darwin10.3.0\" -I/Users/howarth/llvm_svn/dragonegg -I/sw/lib/gcc4.5/lib/gcc/x86_64-apple-darwin10.3.0/4.5.0/plugin/include -I/Users/howarth/llvm_svn/dragonegg/x86 -I/Users/howarth/llvm_svn/dragonegg/darwin -I/sw/include -Wall -Werror -I/sw/lib/llvm/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2  -fno-exceptions -fno-rtti -fno-common -Woverloaded-virtual /Users/howarth/llvm_svn/dragonegg/llvm-convert.cpp
> In file included from /Users/howarth/llvm_svn/dragonegg/llvm-convert.cpp:88:0:
> /Users/howarth/llvm_svn/dragonegg/llvm-debug.h:150:3: error: ‘DIFile’ does not name a type


After editing the dragonegg Makefile to remove -Werror, installing
r100954 of llvm/clang (to /opt/llv, being too lazy to type the 'm'),
copying the missing  darwin-sections.def to the installed gcc-4.5.0
release-candidate, as you noticed, I could add /opt/llv/bin to my path
and the path to my gcc-4.5 install, and do:

GCC=/sw/lib/gcc4.5/bin/gcc make CPPFLAGS="-DENABLE_LTO -I/sw/include"

And it worked until the final link, which failed (-shared works in
recent gcc, but is just an alias for -dynamiclib, and doesn't allow
undefined symbols). I copy & pasted the link line, added -undefined
dynamic_lookup, and it linked and apparently works:

mini:dragonegg pogma$ gcc hello.c -S -O1 -o - -fplugin=./dragonegg.so
-fplugin-arg-dragonegg-emit-ir
; ModuleID = 'hello.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.3.0"

%"char[]" = type [6 x i8]

@.str = private constant %"char[]" c"Hello\00", align 1 ; <%"char[]"*>
[#uses=2]

define i32 @main() nounwind {
entry:
  %0 = tail call i32 @puts(i8* getelementptr inbounds (%"char[]"* @.str,
i64 0, i64 0)) nounwind ; <i32> [#uses=0]
  ret i32 undef
}

declare i32 @puts(i8* nocapture) nounwind

Pretty awesome!

Peter



More information about the llvm-dev mailing list