[LLVMdev] darwin dragon-egg build issues

Duncan Sands baldrick at free.fr
Sat Apr 10 04:52:18 PDT 2010


Hi Jack,

>     Is anyone building dragon-egg on darwin?

Anton built it once.  There were some problems with dynamic libraries: gcc's
plugin support requires the use of dynamic libraries, and the configure logic
it uses thinks that darwin does not support dynamic libraries!  So it is
possible that plugin support was automatically disabled because of this.  Try
configuring with --enable-plugin

I am trying
> to build against the fink gcc45 package that I have prepared
> for darwin and a updated fink llvm 2.7 package that is built
> as...
>
> ../llvm-2.7/configure --prefix=/sw --prefix=/sw/lib/llvm --mandir=/sw/share/man --infodir=/sw/share/info --with-gmp=/sw --with-libiconv-prefix=/usr --with-system-zlib --with-as=/Developer/usr/bin/as --with-ld=/Developer/usr/bin/ld --with-nm=/Developer/usr/bin/nm --enable-optimized --enable-assertions --enable-pic --enable-targets=host-only
>
> Since the gcc45 package installs symlinks to the compilers
> in /sw/bin as gcc-4, g++-4, etc, I executed...
>
> GCC=/sw/bin/gcc-4 LLVM_CONFIG=/sw/lib/llvm/bin/llvm-config make
>
> This fails with...
>
> g++ -c  -I/sw/lib/llvm/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -MD -MP -DIN_GCC -DREVISION=\"100909M\" -DTARGET_NAME=\"x86_64-apple-darwin10.3.0\" -I/Users/howarth/llvm_svn/dragonegg -Iplugin/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/utils/target.cpp
> <command-line>: error: "__STDC_LIMIT_MACROS" redefined
> <command-line>: error: this is the location of the previous definition
> <command-line>: error: "__STDC_CONSTANT_MACROS" redefined
> <command-line>: error: this is the location of the previous definition
> make: *** [target.o] Error 1
>
> with GCC apparently being insufficent to redirect the compilers. Instead, I had to use...
>
> GCC=/sw/bin/gcc-4 CC=/sw/bin/gcc-4 CXX=/sw/bin/g++-4 LLVM_CONFIG=/sw/lib/llvm/bin/llvm-config make

That's correct.  There is no need to build dragonegg with gcc-4.5; gcc-4.5 is
the target of the plugin, which is different.  You inform the makefile that the
plugin is for gcc-4.5 using "GCC=...", and as usual you say what compiler to use
to build dragonegg using CC/CXX.

>
> This however fails with...
>
> /sw/bin/gcc-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=\"100909M\" -DTARGET_NAME=\"x86_64-apple-darwin10.3.0\" -I/Users/howarth/llvm_svn/dragonegg -Iplugin/include -I/Users/howarth/llvm_svn/dragonegg/x86 -I/Users/howarth/llvm_svn/dragonegg/darwin -Wall -Werror -I/sw/lib/llvm/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2  -fno-common /Users/howarth/llvm_svn/dragonegg/llvm-cache.c
> In file included from /Users/howarth/llvm_svn/dragonegg/llvm-cache.c:28:0:
> /Users/howarth/llvm_svn/dragonegg/llvm-cache.h:31:20: fatal error: config.h: No such file or directory

This is a gcc-4.5 "plugin header file".  You can ask gcc where to find these by
doing:

   /sw/bin/gcc-4 -print-file-name=plugin

On my machine this returns

   /usr/local/gnat-fsf/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/plugin

I suspect that your gcc-4.5 was built without plugin support, and that
because of this you aren't getting a path here.

> If I manually run /sw/lib/llvm/bin/llvm-config, I get...

These aren't llvm headers, so llvm-config is not relevant here.

Ciao,

Duncan.



More information about the llvm-dev mailing list