On Tue, Nov 12, 2024 at 4:03 AM Michal Sapka <mic...@sapka.me> wrote:
> On Mon, Nov 11, 2024, at 1:43 PM, Felipe Contreras wrote:
> > It's not just CFLAGS, you need to set LIBPATH too. According to the
> > Makefile that should work. Did you try adding V=1 too? What's the
> > final link command?
> >
> > make -C bindings/ruby V=1 CFLAGS='-g -O2 -pipe -fno-plt -fPIC
> > -I/opt/homebrew/Cellar/talloc/2.4.2/include' LIBPATH='-L. -L/usr/lib
> > -L/opt/homebrew/Cellar/talloc/2.4.2/lib'
>
> I cleaned the entire local repo dir

All right, but just to check:

> All required packages were found. You may now run the following
> commands to compile and install notmuch:
>
>         make
>
> --------------

Instead of this, try running `make V=1`, that should output all the
details so we can see how the Ruby bindings were actually compiled.

>From what I can tell the build should not have worked unless the
location is added to the global variables CPATH and LIBRARY_PATH.

I see some people recommending:

    export CPATH=$(brew --prefix)/include LIBRARY_PATH=$(brew --prefix)/lib

Maybe you have something like that in your environment.

I also in your commands some mixtures of `make` and `sudo make`. The
only time you need sudo is on `make install`.

Anyway, I tried to install talloc on a non-standard location on my
Linux machine, and the build fails, so this can be improved. Attached
is a test patch, if you want to give it a try.

I'll clean up the ruby build stuff and send a proposed patch series later on.

Cheers.

-- 
Felipe Contreras
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 9875123a..ef422da7 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -8,7 +8,8 @@ ruby-bindings: $(dir)/ruby.stamp
 $(dir)/ruby.stamp: lib/$(LINKER_NAME)
 ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
-		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		EXTRA_LDFLAGS="$(TALLOC_LDFLAGS) $(NO_UNDEFINED_LDFLAGS)" \
+		EXTRA_INCFLAGS="$(TALLOC_CFLAGS)" \
 		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
 		NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
 		$(RUBY) extconf.rb --vendor
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index d914537c..ba825e8a 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -8,7 +8,7 @@ require 'mkmf'
 dir = File.join(ENV['NOTMUCH_SRCDIR'], 'lib')
 
 # includes
-$INCFLAGS = "-I#{dir} #{$INCFLAGS}"
+$INCFLAGS = "-I#{dir} #{ENV['EXTRA_INCFLAGS']} #{$INCFLAGS}"
 
 if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to