Re: ruby: building with CFLAGS="something"

Subject: Re: ruby: building with CFLAGS="something"

Date: Sun, 16 May 2021 22:08:57 +0300

To: Felipe Contreras, David Bremner

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


On Sun, May 16 2021, Felipe Contreras wrote:

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

forget my suggestion -- also in general, usually, make variables have more
"power" than defining such a thing in environment (would not be in those
cases there is intermediate wrapper which does not get the make variable...)

Tomi

>  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
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: