office-gobmx/external/firebird/ExternalProject_firebird.mk
Stephan Bergmann 8ea07101c1 external/firebird: Work around operator new alignment violations
...causing problems at least when building with recent Clang trunk on
x86_64-unknown-linux-gnu:

> make[5]: Entering directory 'workdir/UnpackedTarball/firebird/gen'
> rm -f metadata.fdb
> core/workdir/UnpackedTarball/firebird/gen/Release/firebird/bin/isql -q -i workdir/UnpackedTarball/firebird/src/dbs/metadata.sql
> Makefile:325: recipe for target 'metadata.fdb' failed
> make[5]: *** [metadata.fdb] Segmentation fault (core dumped)

See the mail thread starting at
<https://sourceforge.net/p/firebird/mailman/firebird-devel/thread/ec7c3bb1-3fef-e9b8-5b23-0d07fc412f95%40redhat.com/#msg35669676>
"[Firebird-devel] alloc.h global operator new replacement violating alignment
requirements".  With DEBUG_GDS_ALLOC defined, the allocation functions defined
in src/common/classes/alloc.h are no longer replacements of standard allocation
functions, so Clang happens to not make aggressive alignment assumptions, see
the mail thread starting at
<http://lists.llvm.org/pipermail/cfe-dev/2017-February/052676.html> "[cfe-dev]
operator new alignment assumptions".

(Instead of always defining DEBUG_GDS_ALLOC, I first tried to comment out the
definitions of global operator new/delete replacement functions in alloc.h,
falling back to the compiler-provided versions.  But many places in Firebird
allocate via Firebird-specific operator new placement overrides and deallocate
via delete expressions, which happens to work at runtime when the replaceable
operator delete is Firebird's, but not when it is the compiler-provided one.)

Change-Id: Ie02adb440fa959b723983d7f5b0246d3634dc06b
2017-02-16 14:38:37 +01:00

99 lines
3.6 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalProject_ExternalProject,firebird))
$(eval $(call gb_ExternalProject_use_autoconf,firebird,build))
$(eval $(call gb_ExternalProject_use_externals,firebird,\
boost_headers \
icu \
libatomic_ops \
libtommath \
))
$(eval $(call gb_ExternalProject_register_targets,firebird,\
build \
))
ifneq ($(OS),WNT)
INVOKE_FPA:="CPU=\$$(EMPTY) $${FB_CPU_ARG}"
endif
MAKE_PRE=$(call gb_Helper_extend_ld_path,$(call gb_UnpackedTarball_get_dir,icu)/source/lib)
MAKE_POST=$(if $(filter MACOSX,$(OS)),&& $(PERL) \
$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
$(gb_Package_SOURCEDIR_firebird)/gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/plugins/libEngine12.dylib \
$(gb_Package_SOURCEDIR_firebird)/gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/lib/libfbclient.dylib.3.0.0)
$(call gb_ExternalProject_get_state_target,firebird,build):
$(call gb_ExternalProject_run,build,\
unset MAKEFLAGS \
&& FB_CPU_ARG='$(filter --jobserver-fds=%,$(MAKEFLAGS))' \
&& export PKG_CONFIG="" \
&& export CPPFLAGS=" \
$(if $(SYSTEM_LIBATOMIC_OPS),$(LIBATOMIC_OPS_CFLAGS), \
-I$(call gb_UnpackedTarball_get_dir,libatomic_ops)/src \
) \
$(if $(SYSTEM_LIBTOMMATH),$(LIBTOMMATH_CFLAGS), \
-I$(call gb_UnpackedTarball_get_dir,libtommath) \
-L$(call gb_UnpackedTarball_get_dir,libtommath) \
) \
$(if $(SYSTEM_ICU),$(ICU_CPPFLAGS), \
-I$(call gb_UnpackedTarball_get_dir,icu)/source \
-I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \
-I$(call gb_UnpackedTarball_get_dir,icu)/source/common \
) \
" \
&& export CXXFLAGS=" \
$(if $(filter MSC,$(COM)),$(if $(MSVC_USE_DEBUG_RUNTIME),-DMSVC_USE_DEBUG_RUNTIME)) \
$(if $(filter LINUX/X86_64/TRUE,$(OS)/$(CPUNAME)/$(COM_IS_CLANG)), \
-DDEBUG_GDS_ALLOC) \
$(if $(HAVE_GCC_FNO_SIZED_DEALLOCATION),-fno-sized-deallocation -fno-delete-null-pointer-checks) \
$(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS), \
$(BOOST_CPPFLAGS) \
-L$(call gb_UnpackedTarball_get_dir,boost)/source/lib \
) \
$(if $(SYSTEM_ICU),$(ICU_CPPFLAGS), \
-I$(call gb_UnpackedTarball_get_dir,icu)/source \
-I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \
-I$(call gb_UnpackedTarball_get_dir,icu)/source/common \
) \
$(if $(SYSTEM_LIBTOMMATH),$(LIBTOMMATH_CFLAGS), \
-L$(call gb_UnpackedTarball_get_dir,libtommath) \
) \
" \
&& export LDFLAGS=" \
$(if $(SYSTEM_ICU),$(ICU_LIBS), \
-L$(call gb_UnpackedTarball_get_dir,icu)/source/lib \
) \
" \
&& export LIBREOFFICE_ICU_LIB="$(call gb_UnpackedTarball_get_dir,icu)/source/lib" \
&& MAKE=$(MAKE) ./configure \
--without-editline \
--with-wire-compress=no \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
$(if $(DISABLE_DYNLOADING), \
--enable-static --disable-shared \
, \
--enable-shared --disable-static \
) \
$(if $(filter MACOSX,$(OS)), \
$(if $(filter 1, \
$(shell expr '$(MAC_OS_X_VERSION_MIN_REQUIRED)' \
'<' 101200)), \
ac_cv_func_clock_gettime=no)) \
&& if [ -n "$${FB_CPU_ARG}" ]; then \
$(MAKE_PRE) $(MAKE) $(if $(ENABLE_DEBUG),Debug) $(INVOKE_FPA) SHELL='$(SHELL)' $(MAKE_POST); \
else \
$(MAKE_PRE) $(MAKE) $(if $(ENABLE_DEBUG),Debug) SHELL='$(SHELL)' $(MAKE_POST); \
fi \
)
# vim: set noet sw=4 ts=4: