Skip to content

Commit

Permalink
Revert "buildsys: use the C++ compiler for linking" (#3717)
Browse files Browse the repository at this point in the history
* Revert "buildsys: use the C++ compiler for linking"

This reverts commit 57c57c2.

* 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.
  • Loading branch information
fingolfin authored Oct 31, 2019
1 parent 3e95e6c commit ba30bd4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 $@
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ba30bd4

Please sign in to comment.