[LLVMdev] darwin dragon-egg build issues

Jack Howarth howarth at bromo.med.uc.edu
Sat Apr 10 18:01:02 PDT 2010


On Sat, Apr 10, 2010 at 01:52:18PM +0200, Duncan Sands wrote:
> 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
> 

Duncan,
   The following hack to gcc/configure.ac will allow the --enable-plugin option to build and pass
the plugin tests on x86_64-apple-darwin10 using gcc-4_5-branch...

--- configure.ac.orig   2010-04-10 10:58:34.000000000 -0500
+++ configure.ac        2010-04-10 10:59:52.000000000 -0500
@@ -4380,22 +4380,6 @@
 
 pluginlibs=
 if test x"$enable_plugin" = x"yes"; then
-
-  AC_MSG_CHECKING([for exported symbols])
-  echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
-  ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1
-  if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
-    : # No need to use a flag
-  else
-    AC_MSG_CHECKING([for -rdynamic])
-    ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1
-    if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
-      pluginlibs="-rdynamic"
-    else
-      enable_plugin=no
-    fi
-  fi
-
   # Check -ldl
   saved_LIBS="$LIBS"
   AC_SEARCH_LIBS([dlopen], [dl])
@@ -4403,29 +4387,6 @@
     pluginlibs="$pluginlibs -ldl"
   fi
   LIBS="$saved_LIBS"
-
-  # Check that we can build shared objects with -fPIC -shared
-  saved_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -fPIC -shared"
-  AC_MSG_CHECKING([for -fPIC -shared])
-  AC_TRY_LINK(
-    [extern int X;],[return X == 0;],
-    [AC_MSG_RESULT([yes]); have_pic_shared=yes],
-    [AC_MSG_RESULT([no]); have_pic_shared=no])
-  if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then
-    pluginlibs=
-    enable_plugin=no
-  fi
-  LDFLAGS="$saved_LDFLAGS"
-
-  # If plugin support had been requested but not available, fail.
-  if test x"$enable_plugin" = x"no" ; then
-    if test x"$default_plugin" != x"yes"; then
-      AC_MSG_ERROR([
-Building GCC with plugin support requires a host that supports
--fPIC, -shared, -ldl and -rdynamic.])
-    fi
-  fi
 fi
 
 AC_SUBST(pluginlibs)

Index: gcc/testsuite/lib/plugin-support.exp
===================================================================
--- gcc/testsuite/lib/plugin-support.exp	(revision 158195)
+++ gcc/testsuite/lib/plugin-support.exp	(working copy)
@@ -88,6 +88,10 @@
 
     set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
 
+    if { [ istarget *-*-darwin* ] } {
+        set optstr [concat $optstr "-undefined dynamic_lookup"]
+    }
+
     # Temporarily switch to the environment for the plugin compiler.
     restore_ld_library_path_env_vars
     set status [remote_exec build "$PLUGINCC $PLUGINCFLAGS $plugin_src $optstr -o $plugin_lib"]

I am working towards building current dragon-egg svn against this
installation of FSF gcc 4.5.0. Currently FSF gcc 4.5.0 neglects to install
gcc/config/darwin-sections.def into lib/gcc/x86_64-apple-darwin10.3.0/4.5.0/plugin/include/
so I copied that manually for now. With that change, I think I am bumping
into a bug with building dragon-egg with gcc 4.5.0...

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
make: *** [llvm-convert.o] Error 1

where /sw/bin/gcc-4 is the gcc 4.5.0 from my gcc45 fink package
with plugin support. Do you see this under linux?
              Jack




More information about the llvm-dev mailing list