Hi David, First, apologies for the delay. I had a bicycle accident, still recovering. On Tue, Jun 30, 2015 at 07:02:52PM +0200, David Bremner wrote: > Suvayu Ali <fatkasuvayu+linux@gmail.com> writes: > > > Yes, I have looked at what the official packages[1] do, I do exactly the > > same[2]. Essentially the spec file does the following: > > > > pushd bindings/ruby > > ruby extconf.rb --vendor --with-cflags="%{optflags}" > > make %{?_smp_mflags} > > popd > > I think the problem is contained in the original message. Since we want > to create a shared library "notmuch.so" for ruby to import, we need to > compile the C files in bindings/ruby with -fPIC. > > I don't know if this is Debian specific, or ruby version specific, but > on my Debian Jessie machine with ruby 2.1, the generated Makefile > bindings/ruby/Makefile has > > CFLAGS = $(CCDLFLAGS) -g -O2 -fstack-protector-strong -Wformat > -Werror=format-security -fPIC $(ARCH_FLAG) > > in it > > even when invoked outside the notmuch build system; e.g. > > % cd bindings/ruby && ruby extconf.rb > > I guess the first step is to see if the -fPIC flag is also there on > Fedora, and if not, why not. If I look at the builds for 0.19 [1] > it seems it is. But notice there it is not required to pass it in to "--with-cflags" Indeed. I looked at the generated Makefiles, they like below: --- nm-0.20.2.mk 2015-07-06 15:11:26.138317221 +0200 +++ nm-master.mk 2015-07-06 15:41:14.929951640 +0200 @@ -80,7 +80,7 @@ debugflags = -ggdb3 warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat CCDLFLAGS = -fPIC -CFLAGS = $(CCDLFLAGS) -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic $(ARCH_FLAG) +CFLAGS = $(CCDLFLAGS) -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -fPIC $(ARCH_FLAG) INCFLAGS = -I. -I../../lib -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) DEFS = CPPFLAGS = $(DEFS) $(cppflags) So actually, the master version gets the -fPIC flag. But it should be redundant, since CCDLFLAGS is already set to -fPIC. Now when I compare the corresponding compile commands, I see (you also noticed that in the logs): 0.20.2: gcc -I. -I../../lib -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -m64 -o message.o -c message.c master: gcc -I. -I../../lib -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -o message.o -c message.c So the trailing bits of the command is somehow dropped, and the CCDLFLAGS seems to be absent (see, no empty space either). I do not understand why that would be the case. I'll dig further when I can find some more time ... > [1] https://kojipkgs.fedoraproject.org/packages/notmuch/0.19/1.fc21/data/logs/x86_64/build.log > - I couldn't find x86_64 build logs for 0.20 You can't, Fedora ships only 0.19. That's why I maintain the 0.20+ copr repository, for myself and other interested (invisible) users out there :-p. This gap was much wider in the past. Cheers, -- Suvayu Open source is the future. It sets us free.