Skip to content

Commit 32b11b1

Browse files
committed
buildsys: always link gap against libgap
... even the copy we don't install system wide. On macOS this allows us an annoying issue with the linker flags used by e.g. gac for building kernel extensions: by always linking them against libgap we don't need to use a flat namespace, nor rely on a bundle loader (which breaks if you try to load the kernel extension in another binary using libgap).
1 parent ca83874 commit 32b11b1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Makefile.rules

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,12 @@ ifneq (,$(findstring cygwin,$(host_os)))
308308
else
309309
ifneq (,$(findstring darwin,$(host_os)))
310310
GAC_CFLAGS = -fno-common
311-
GAC_LDFLAGS = -bundle -undefined dynamic_lookup -Wl,-no_fixup_chains
311+
GAC_LDFLAGS = -bundle -L$(abs_builddir) -lgap
312+
GAC_LDFLAGS_FOR_INSTALL = -bundle -L$(libdir) -lgap
312313
else
313314
GAC_CFLAGS = -fPIC
314-
GAC_LDFLAGS = -shared -fPIC
315+
GAC_LDFLAGS = -shared -fPIC -L$(abs_builddir) -lgap
316+
GAC_LDFLAGS_FOR_INSTALL = -shared -fPIC -L$(libdir) -lgap
315317
endif
316318
endif
317319

@@ -510,8 +512,8 @@ libgap$(SHLIB_EXT): $(LIBGAP_FULL)
510512
ln -sf $< $@
511513

512514
# build rule for the main gap executable
513-
gap$(EXEEXT): build/obj/src/main.c.o $(OBJS) cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS
514-
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $< $(OBJS) $(GAP_LIBS) -o $@
515+
gap$(EXEEXT): build/obj/src/main.c.o libgap$(SHLIB_EXT) cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS
516+
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $< $(GAP_LIBS) -L${abs_builddir} -lgap -o $@
515517

516518
# generate a modified copy of main.c for use by the `gap-install` binary
517519
build/main.c: src/main.c config.status
@@ -673,6 +675,7 @@ install-sysinfo: SYSINFO_CPPFLAGS = -I${includedir}/gap -I${includedir} $(GAP_DE
673675
install-sysinfo: SYSINFO_LDFLAGS = $(ABI_CFLAGS)
674676
install-sysinfo: SYSINFO_GAP = $(bindir)/gap
675677
install-sysinfo: SYSINFO_GAC = $(bindir)/gac
678+
install-sysinfo: GAC_LDFLAGS = $(GAC_LDFLAGS_FOR_INSTALL)
676679
install-sysinfo: GMP_PREFIX =
677680
install-sysinfo: install-dirs
678681
@echo "$$sysinfo_gap" > $(DESTDIR)$(libdir)/gap/sysinfo.gap

0 commit comments

Comments
 (0)