unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: David Bremner <david@tethera.net>
Cc: "notmuch@notmuchmail.org" <notmuch@notmuchmail.org>
Subject: Re: ruby: building with CFLAGS="something"
Date: Sun, 16 May 2021 13:41:24 -0500	[thread overview]
Message-ID: <CAMP44s1vK7RThN5+xCo5_fK2GJo4_Oc+MuA8ehn=UGYRezRc5A@mail.gmail.com> (raw)
In-Reply-To: <87v97izwuk.fsf@tethera.net>

On Sun, May 16, 2021 at 7:28 AM David Bremner <david@tethera.net> wrote:
>
>
> The rest of the (C and C++) codebase supports
>
>     make CFLAGS="-g -O0"
>
> or
>
>     CFLAGS="-g -O0" ./configure
>
> but the ruby bindings don't build:

That's because -fPIC is needed.

The way Ruby's mkmf generates the Makefile is wrong, because it should do:

  override CFLAGS+=-fPIC

So that the user can specify other CFLAGS.

However, we can fix that by doing that ourselves:

--- 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

We lose -march=x86-64 -mtune=generic (at least on my machine), but I
guess that's not a big deal since libnotmuch itself isn't getting
compiled with those.

I'll send a patch soonish.

-- 
Felipe Contreras

  reply	other threads:[~2021-05-16 18:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 12:28 ruby: building with CFLAGS="something" David Bremner
2021-05-16 18:41 ` Felipe Contreras [this message]
2021-05-16 19:08   ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMP44s1vK7RThN5+xCo5_fK2GJo4_Oc+MuA8ehn=UGYRezRc5A@mail.gmail.com' \
    --to=felipe.contreras@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).