diff options
author | Pedro Giffuni <pfg@apache.org> | 2015-08-05 01:14:28 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2015-08-05 01:14:28 +0000 |
commit | edd086fbf20a11380fc3c29a4a90a37e25fdc3e2 (patch) | |
tree | 542dea07772542ffc2aa6b6a48982e50c586e075 | |
parent | 4a9ff9da561ec0aac03234d6362dc22eabdad1d0 (diff) |
FreeBSD build fixes.
This allows out the box builds with gcc and to
simplify the build with clang and also the FreeBSD port.
From Don Lewis (FreeBSD port maintainer):
Because we need to use different CFLAGS for gcc and clang, I had to add
some compiler detection logic. On most platforms, the value of $(COM)
is either set statically by set_soenv, or set_soenv parses the compiler
name to figure out which compiler is being used and then set $(COM)
appropriately. The latter doesn't work for FreeBSD because cc could
either be gcc or clang. For FreeBSD, I added the compiler detection
logic to configure, which then passes that to set_soenv, in a somewhat
hackish manner.
When building with ports gcc on FreeBSD, we need to pass the rpath for
the gcc runtime to the linker. The FreeBSD port attempts to to this by
adding this information to LDFLAGS, which the openoffice configure
script then steps on, and in any case, this does not help the out of the
box build. My solution is to add some logic to configure to generate
the necessary linker flags, which it then passes to set_soenv for
inclusion in FreeBSD*Env.Set.sh.
On FreeBSD, the out of the box build needs to pass $LIBINTL_PREFIX in
the environment to the build phase. I added some code to configure to
figure out the value of this variable and to pass it to set_soenv for
inclusion in FreeBSD*Env.Set.sh so that this does not need to be done as
a extra step in the build.
Changing $(COM) from GCC to CLANG for clang builds caused a number
regressions elsewhere in the build framework. These were mostly caused
by the framework checking for $(COM) == GCC and $(OS) == FREEBSD, with
$(COM) == CLANG case unhandled. The fix was generally to just ignore
the value of $(COM) and only test the value of $(OS). One special case
was the bridgetest regression test, which started dumping core on INTEL
32-bit when built with clang. It turns out that this entire test is was
skipped for $(COM) == gcc, $(OS) == FREEBSD, and $(CPU) == I. Rather
than also skipping this test when building with clang, I tracked down
the failure to a particular subtest involving polymorphic structures
that also fails on OS/2 and tweaked the code to also skip that subtest
on FREEBSD INTEL (32-bit). Now bridgetest is run and passes on FreeBSD
with both gcc and clang, on both i386 and amd64.
Submitted by: Don Lewis
Notes
ignore: obsolete
-rw-r--r-- | bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk | 2 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_freebsd_x86-64/makefile.mk | 2 | ||||
-rw-r--r-- | configure.in | 29 | ||||
-rw-r--r-- | graphite/makefile.mk | 4 | ||||
-rw-r--r-- | set_soenv.in | 7 | ||||
-rw-r--r-- | solenv/gbuild/platform/freebsd.mk | 16 | ||||
-rw-r--r-- | solenv/inc/tg_compv.mk | 5 | ||||
-rw-r--r-- | solenv/inc/unx.mk | 2 | ||||
-rw-r--r-- | solenv/inc/unxfbsd.mk | 19 | ||||
-rw-r--r-- | testtools/source/bridgetest/bridgetest.cxx | 7 | ||||
-rw-r--r-- | testtools/source/bridgetest/makefile.mk | 4 |
11 files changed, 78 insertions, 19 deletions
diff --git a/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk index 14fc726cbd2a..7e3ba721c720 100644 --- a/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_freebsd_intel/makefile.mk @@ -34,7 +34,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -.IF "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDIgcc3" +.IF "$(OS)$(CPU)$(COMNAME)" == "FREEBSDIgcc3" .IF "$(cppu_no_leak)" == "" CFLAGS += -DLEAK_STATIC_DATA diff --git a/bridges/source/cpp_uno/gcc3_freebsd_x86-64/makefile.mk b/bridges/source/cpp_uno/gcc3_freebsd_x86-64/makefile.mk index 2fdc1d7afd0a..e98f3d3f9bfc 100644 --- a/bridges/source/cpp_uno/gcc3_freebsd_x86-64/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_freebsd_x86-64/makefile.mk @@ -34,7 +34,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -.IF "$(COM)$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDXgcc3" +.IF "$(OS)$(CPU)$(COMNAME)" == "FREEBSDXgcc3" .IF "$(cppu_no_leak)" == "" CFLAGS += -DLEAK_STATIC_DATA diff --git a/configure.in b/configure.in index 1baf940e4250..20ab2e2d4692 100644 --- a/configure.in +++ b/configure.in @@ -1691,6 +1691,23 @@ if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then AC_PROG_CC fi +if test "$_os" = "FreeBSD"; then + FBSD_GCC_RPATH= + if $CC --version 2>&1 | grep clang > /dev/null ; then + COM_IS=CLANG + else + COM_IS=GCC + rpath=`$CC --print-file-name libstdc++.so` + rpath=`realpath $rpath` + rpath=`dirname $rpath` + if test "$rpath" != "/usr/lib" ; then + FBSD_GCC_RPATH="-Wl,-rpath=$rpath" + fi + fi + AC_SUBST(COM_IS) + AC_SUBST(FBSD_GCC_RPATH) +fi + COMPATH=`dirname "$CC"` if test "$COMPATH" = "." ; then AC_PATH_PROGS(COMPATH, $CC) @@ -6829,6 +6846,18 @@ dnl =================================================================== SYSTEM_GETTEXT=YES AC_SUBST(SYSTEM_GETTEXT) +if test "$_os" = "FreeBSD"; then + LIBINTL_PREFIX= + for dir in $CPPFLAGS; do + if dir=`expr -- $dir : '-I\(.*\)'`; then + if test -f "$dir/libintl.h" ; then + LIBINTL_PREFIX=`dirname $dir` + fi + fi + done + AC_SUBST(LIBINTL_PREFIX) +fi + dnl =================================================================== dnl always rely on the system version of pango dnl =================================================================== diff --git a/graphite/makefile.mk b/graphite/makefile.mk index 438f632e6804..6f72808dd5f5 100644 --- a/graphite/makefile.mk +++ b/graphite/makefile.mk @@ -92,7 +92,7 @@ CFLAGS4MSC= $(CFLAGS2MSC:s/ -/ $(JUSTASLASH)/) BUILD_FLAGS+= "CFLAGS4MSC=$(CFLAGS4MSC)" /F makefile.vc$(VCNUM) lib_dll .ENDIF -.IF "$(COM)"=="GCC" +.IF "$(COM)"=="GCC" || "$(OS)"=="FREEBSD" # Does linux want --disable-shared? .IF "x$(debug)"!="x" @@ -137,7 +137,7 @@ OUT2LIB=engine$/release$/*.lib OUT2LIB=engine$/src$/.libs$/libgraphite*.a .ENDIF -.IF "$(COM)"=="GCC" +.IF "$(COM)"=="GCC" || "$(OS)"=="FREEBSD" BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS) .ENDIF diff --git a/set_soenv.in b/set_soenv.in index 90a221762cd3..17d302240ddd 100644 --- a/set_soenv.in +++ b/set_soenv.in @@ -358,7 +358,7 @@ elsif ( $platform =~ m/kfreebsd/ ) } elsif ( $platform =~ m/freebsd/ ) { $BIG_SVX = "TRUE"; - $COM = "GCC"; + $COM = "@COM_IS@"; $COMPATH = '@COMPATH@' . '/bin'; $CVER = "C300"; $GUI = "UNX"; @@ -1724,6 +1724,11 @@ if ( $platform =~ m/darwin/ ) ToFile( "MACOSX_DEPLOYMENT_TARGET", "@MACOSX_DEPLOYMENT_TARGET@", "e" ); ToFile( "MACOSX_SDK_PATH", "@MACOSX_SDK_PATH@", "e" ); } +if ( $platform =~ m/freebsd/ ) +{ + ToFile( "FBSD_GCC_RPATH", "@FBSD_GCC_RPATH@", "e" ); + ToFile( "LIBINTL_PREFIX", "@LIBINTL_PREFIX@", "e" ); +} # # Writing the variables to file. diff --git a/solenv/gbuild/platform/freebsd.mk b/solenv/gbuild/platform/freebsd.mk index b816f442a3a0..db8ab61fbff9 100644 --- a/solenv/gbuild/platform/freebsd.mk +++ b/solenv/gbuild/platform/freebsd.mk @@ -20,7 +20,6 @@ #************************************************************************* GUI := UNX -COM := GCC # BSD mktemp -t expects a prefix, not a pattern gb_MKTEMP ?= /usr/bin/mktemp -t gbuild. @@ -95,8 +94,12 @@ gb_CXXFLAGS := \ -fno-use-cxa-atexit \ -fvisibility-inlines-hidden \ -fvisibility=hidden \ - -pipe \ - -DHAVE_STL_INCLUDE_PATH \ + -pipe +ifeq ($(COM),CLANG) +gb_CXXFLAGS += -DHAVE_STL_INCLUDE_PATH +else +gb_CXXFLAGS += -DBOOST_TR1_DISABLE_INCLUDE_NEXT -DBOOST_TR1_GCC_INCLUDE_PATH=c++ +endif ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE) gb_CFLAGS_WERROR := -Werror @@ -110,7 +113,10 @@ gb_LinkTarget_LDFLAGS := -Wl,--sysroot=$(SYSBASE) endif gb_LinkTarget_EXCEPTIONFLAGS := \ -DEXCEPTIONS_ON \ - -fexceptions \ + -fexceptions +ifeq ($(COM),GCC) +gb_LinkTarget_EXCEPTIONFLAGS += -fno-enforce-eh-specs +endif gb_LinkTarget_NOEXCEPTIONFLAGS := \ -DEXCEPTIONS_OFF \ @@ -121,7 +127,7 @@ gb_LinkTarget_LDFLAGS += \ -Wl,-z,combreloc \ -Wl,-z,defs \ $(subst -L../lib , ,$(SOLARLIB)) \ - ${FBSD_LDFLAGS} \ + ${FBSD_GCC_RPATH} \ \ ifeq ($(HAVE_LD_HASH_STYLE),TRUE) diff --git a/solenv/inc/tg_compv.mk b/solenv/inc/tg_compv.mk index 445b037a090e..e1295e618773 100644 --- a/solenv/inc/tg_compv.mk +++ b/solenv/inc/tg_compv.mk @@ -132,9 +132,14 @@ COMNAME=MipsPro .ENDIF .IF "$(COM)"=="CLANG" +.IF "$(OS)" == "FREEBSD" +COMID=gcc3 +COMNAME=gcc3 +.ELSE COMID=s5abi COMNAME=s5abi .ENDIF +.ENDIF .IF "$(COMNAME)"=="" diff --git a/solenv/inc/unx.mk b/solenv/inc/unx.mk index 585459161922..57a47f441e74 100644 --- a/solenv/inc/unx.mk +++ b/solenv/inc/unx.mk @@ -139,7 +139,7 @@ .INCLUDE : unxbsds.mk .ENDIF -.IF "$(COM)$(OS)" == "GCCFREEBSD" +.IF "$(OS)" == "FREEBSD" .INCLUDE : unxfbsd.mk .ENDIF diff --git a/solenv/inc/unxfbsd.mk b/solenv/inc/unxfbsd.mk index a9d946bc5b62..a7fc04104119 100644 --- a/solenv/inc/unxfbsd.mk +++ b/solenv/inc/unxfbsd.mk @@ -49,7 +49,12 @@ JAVAFLAGSDEBUG=-g #LINKOUTPUT_FILTER=" |& $(SOLARENV)/bin/msg_filter" # _PTHREADS is needed for the stl -CDEFS+=$(PTHREAD_CFLAGS) -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=450 -DHAVE_STL_INCLUDE_PATH +CDEFS+=$(PTHREAD_CFLAGS) -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=450 +.IF "$(COM)"=="CLANG" +CDEFS+=-DHAVE_STL_INCLUDE_PATH +.ELSE +CDEFS+=-DBOOST_TR1_DISABLE_INCLUDE_NEXT -DBOOST_TR1_GCC_INCLUDE_PATH=c++ +.ENDIF # enable visibility define in "sal/types.h" .IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" @@ -88,7 +93,11 @@ CFLAGSENABLESYMBOLS=-g # was temporarily commented out, reenabled before Beta # flags for the C++ Compiler CFLAGSCC= -pipe $(ARCH_FLAGS) # Flags for enabling exception handling +.IF "$(COM)"=="CLANG" CFLAGSEXCEPTIONS=-fexceptions +.ELSE +CFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs +.ENDIF # Flags for disabling exception handling CFLAGS_NO_EXCEPTIONS=-fno-exceptions @@ -199,11 +208,11 @@ STDSHLCUIMT+=-ltcmalloc .ENDIF # libraries for linking applications -STDLIBGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_LDFLAGS} -STDLIBCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_LDFLAGS} +STDLIBGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH} +STDLIBCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH} # libraries for linking shared libraries -STDSHLGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_LDFLAGS} -STDSHLCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_LDFLAGS} +STDSHLGUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH} +STDSHLCUIMT+=-Wl,--as-needed $(PTHREAD_LIBS) -lm -Wl,--no-as-needed ${FBSD_GCC_RPATH} X11LINK_DYNAMIC = -Wl,--as-needed -lXext -lX11 -Wl,--no-as-needed diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 332f15060e54..12f4079a2601 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -544,7 +544,12 @@ static sal_Bool performTest( } catch (...) { bRet &= check(false, "getRaiseAttr2 threw wrong type"); } -#ifndef OS2 // see i120310 for details +#if !defined(OS2) && !(defined(FREEBSD) && defined(INTEL)) +// see i120310 for OS2 details +// FreeBSD i386 coredumps on this test in cpp_vtable_call(): +// pTypeDescr appears to point to garbage, pMapFunctionIndexToMemberIndex +// points to unreadable memory, as does abase.pTypeName. Refcounts +// don't look reasonable, etc. // Test instantiated polymorphic struct types: { bRet &= check( diff --git a/testtools/source/bridgetest/makefile.mk b/testtools/source/bridgetest/makefile.mk index a348e1203d52..fc17c47663d8 100644 --- a/testtools/source/bridgetest/makefile.mk +++ b/testtools/source/bridgetest/makefile.mk @@ -134,8 +134,8 @@ ALLTAR: \ runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \ $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN) -.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(COM)$(OS)$(CPU)" == "GCCFREEBSDI" || "$(OS)$(CPU)"=="SOLARISS" - @echo "Mac OSX PPC GCC ad FreeBDS/i386 fails this test! likely broken UNO bridge. Fix me." +.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(OS)$(CPU)"=="SOLARISS" + @echo "Mac OSX PPC GCC and Solaris fails this test! likely broken UNO bridge. Fix me." .ELSE cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \ -ro uno_services.rdb -ro uno_types.rdb \ |