From 3dae253c4f63ee9a3d74d63aea4ba547fa334686 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Mon, 17 May 2021 00:47:46 -0500 Subject: [PATCH] ruby: improve compilation with CFLAGS The ruby MakeMakefile generates a makefile that is suboptimal, which has CFLAGS like this: CFLAGS = $(CCDLFLAGS) -march=x86-64 -mtune=generic \ -O2 -pipe -fno-plt -fPIC $(ARCH_FLAG) This works as long as the user doesn't modify the Makefile. Certain flags (namely -fPIC) need to be present regardless of what CFLAGS are specified. The Makefile should have done this instead: CFLAGS = -march=x86-64 -mtune=generic -O2 override CFLAGS += $(CCDLFLAGS) -pipe -fno-plt -fPIC $(ARCH_FLAG) Unfortunately they didn't, so we need to workaround their lack of foresight. We can simply add the necessary flags in the parent Makefile so everyone is happy. Signed-off-by: Felipe Contreras --- bindings/Makefile.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/Makefile.local b/bindings/Makefile.local index bc960bbc..3672e69f 100644 --- a/bindings/Makefile.local +++ b/bindings/Makefile.local @@ -10,7 +10,7 @@ ifeq ($(HAVE_RUBY_DEV),1) LIBNOTMUCH="../../lib/$(LINKER_NAME)" \ NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \ $(RUBY) extconf.rb --vendor - $(MAKE) -C $(dir)/ruby + $(MAKE) -C $(dir)/ruby CFLAGS="$(CFLAGS) -pipe -fno-plt -fPIC" endif python-cffi-bindings: lib/$(LINKER_NAME)