From ba30bd40678f3a09cdcafa1b5716bb6382317b31 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 31 Oct 2019 22:43:20 +0100 Subject: [PATCH] Revert "buildsys: use the C++ compiler for linking" (#3717) * Revert "buildsys: use the C++ compiler for linking" This reverts commit 57c57c2fa5242f1c1dae6840488ef8cac9f00047. * AppVeyor: use correct CXXFLAGS * AppVeyor: print gcc version to ease debugging * buildsys: use -fno-exceptions -fno-rttit for our C++ code We disable support for exceptions and RTTI as we don't use them and they cause compiler/linker issues in some build configurations; but we are careful to not put these into GAP_CXXFLAGS, as kernel extensions may want to use GAP_CXXFLAGS but also may have a need to interface with C++ code in libraries that use exceptions. --- .appveyor.yml | 1 + .travis.yml | 1 - Makefile.rules | 17 ++++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d46635121d..400feb5aaf 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -42,6 +42,7 @@ build_script: throw "There are newer queued builds for this pull request, failing early." } - SET "PATH=%CYG_ROOT%\bin;%PATH%" - python -m pip install gcovr # for coverage reporting later on + - bash -lc "gcc --version" - bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./etc/ci-prepare.sh" test_script: diff --git a/.travis.yml b/.travis.yml index b138eba9c0..be13082700 100644 --- a/.travis.yml +++ b/.travis.yml @@ -144,7 +144,6 @@ matrix: # test Julia integration - env: TEST_SUITES="testinstall" JULIA=yes CONFIGFLAGS="--disable-Werror" - dist: bionic # need GCC 6 to avoid linker error script: - set -e diff --git a/Makefile.rules b/Makefile.rules index abedbdd943..3f25607e3b 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -342,9 +342,15 @@ $(srcdir)/src/pperm.c: $(srcdir)/src/trans.c: # Build rule for C++ source files +# +# We disable support for exceptions and RTTI as we don't use them and they +# cause compiler/linker issues in some build configurations; but we are +# careful to not put these into GAP_CXXFLAGS, as kernel extensions may want to +# use GAP_CXXFLAGS but also may have a need to interface with C++ code in +# libraries that use exceptions. obj/%.lo: %.cc cnf/GAP-CXXFLAGS cnf/GAP-CPPFLAGS libtool @$(MKDIR_P) $(@D)/$(DEPDIRNAME) - $(QUIET_CXX)$(LIBTOOL) --mode=compile --tag CXX $(CXX) $(DEPFLAGS) $(GAP_CXXFLAGS) $(WARN_CXXFLAGS) $(GAP_CPPFLAGS) -c $< -o $@ + $(QUIET_CXX)$(LIBTOOL) --mode=compile --tag CXX $(CXX) $(DEPFLAGS) $(GAP_CXXFLAGS) -fno-exceptions -fno-rtti $(WARN_CXXFLAGS) $(GAP_CPPFLAGS) -c $< -o $@ @echo "$<:" >> $(DEPFILE) # Build rule for C source files @@ -358,7 +364,7 @@ obj/%.lo: %.c cnf/GAP-CFLAGS cnf/GAP-CPPFLAGS libtool # Linker rules for gap executable ######################################################################## -LINK=$(LIBTOOL) --mode=link $(CXX) -export-dynamic +LINK=$(LIBTOOL) --mode=link $(CC) -export-dynamic libgap.la: $(OBJS) cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS $(QUIET_LINK)$(LINK) -no-undefined -rpath $(libdir) $(GAP_LDFLAGS) $(OBJS) $(GAP_LIBS) -o $@ @@ -391,8 +397,8 @@ GAP_LDFLAGS += -Wl,--allow-multiple-definition all: bin/$(GAPARCH)/gap.dll bin/$(GAPARCH)/gap.dll: symlinks libgap.la cp .libs/cyggap-0.dll $@ # FIXME: HACK to support kernel extensions -gap$(EXEEXT): obj/src/gapw95.lo libgap.la cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS - $(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) obj/src/gapw95.lo $(GAP_LIBS) libgap.la -o $@ +gap$(EXEEXT): libgap.la cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS + $(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $(srcdir)/src/gapw95.c $(GAP_LIBS) libgap.la -o $@ @( if which peflags > /dev/null ; then peflags --cygwin-heap=2048 gap$(EXEEXT) ; fi ) else @@ -694,9 +700,6 @@ endif # BUILD_BOEHM_GC # ensure subprojects are built and "installed" before compiling and linking GAP gap$(EXEEXT): $(EXTERN_FILES) $(OBJS): $(EXTERN_FILES) -ifeq ($(SYS_IS_CYGWIN32),yes) -obj/src/gapw95.lo: $(EXTERN_FILES) -endif ifeq ($(HPCGAP),yes) $(SOURCES): $(EXTERN_FILES) endif