unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jinwoo Lee <jinwoo68@gmail.com>
To: David Bremner <david@tethera.net>,
	David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
Date: Sat, 13 Jun 2015 23:20:24 -0700	[thread overview]
Message-ID: <yq65a8w2u7yv.fsf@jinwoo-macbookair.roam.corp.google.com> (raw)
In-Reply-To: <1434261524-14139-1-git-send-email-david@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

There are 2 problems.

1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
   dependency of ruby-bindings.

> make: *** No rule to make target `lib/libnotmuch.so', needed by
> `ruby-bindings'.  Stop.

2. After manually changing it to lib/libnotmuch.dylib, I still get an
   error like below:

> cd bindings/ruby && \
> 		EXTRA_LDFLAGS="" \
> 		ruby extconf.rb --vendor
> checking for notmuch_database_create in libnotmuch.so... no
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.

> Provided configuration options:
> 	--with-opt-dir
> 	--without-opt-dir
> 	--with-opt-include
> 	--without-opt-include=${opt-dir}/include
> 	--with-opt-lib
> 	--without-opt-lib=${opt-dir}/lib
> 	--with-make-prog
> 	--without-make-prog
> 	--srcdir=.
> 	--curdir
> 	--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
> make: *** [ruby-bindings] Error 1

I tried updating extconf.rb to change libnotmuch.so to libnotmuch.dylib
but that still emit a similar error.

And the attached is the log file, mkmf.log generated in bindings/ruby.


[-- Attachment #2: mkmf.log --]
[-- Type: text/plain, Size: 3733 bytes --]

have_local_library: checking for notmuch_database_create in libnotmuch.dylib... -------------------- no

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0 ../../lib/libnotmuch.dylib -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
Undefined symbols for architecture i386:
  "_notmuch_database_create", referenced from:
      _t in conftest-2cad94.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <notmuch.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))notmuch_database_create; return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0 ../../lib/libnotmuch.dylib -lpthread -ldl -lobjc "
conftest.c:7:39: error: too few arguments to function call, expected 2, have 0
int t(void) { notmuch_database_create(); return 0; }
              ~~~~~~~~~~~~~~~~~~~~~~~ ^
../../lib/notmuch.h:234:1: note: 'notmuch_database_create' declared here
notmuch_status_t
^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <notmuch.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { notmuch_database_create(); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

--------------------


[-- Attachment #3: Type: text/plain, Size: 3291 bytes --]


On Sat, Jun 13, 2015 at 10:58 PM, David Bremner <david@tethera.net> wrote:
> In particular this is supposed to help build on systems (presumably
> using a non-gnu ld) where this flag is not available.
> ---
>  bindings/Makefile.local  |  4 +++-
>  bindings/ruby/extconf.rb |  5 +++--
>  configure                | 13 +++++++++++++
>  lib/Makefile.local       |  2 +-
>  4 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/bindings/Makefile.local b/bindings/Makefile.local
> index 16817f5..d236f01 100644
> --- a/bindings/Makefile.local
> +++ b/bindings/Makefile.local
> @@ -5,7 +5,9 @@ dir := bindings
>  # force the shared library to be built
>  ruby-bindings: lib/libnotmuch.so
>  ifeq ($(HAVE_RUBY_DEV),1)
> -	cd $(dir)/ruby && ruby extconf.rb --vendor
> +	cd $(dir)/ruby && \
> +		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
> +		ruby extconf.rb --vendor
>  	$(MAKE) -C $(dir)/ruby
>  else
>  	@echo Missing dependency, skipping ruby bindings
> diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
> index 6160db2..6d5607e 100644
> --- a/bindings/ruby/extconf.rb
> +++ b/bindings/ruby/extconf.rb
> @@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
>  # includes
>  $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
>  
> -# make sure there are no undefined symbols
> -$LDFLAGS += ' -Wl,--no-undefined'
> +if ENV['EXTRA_LDFLAGS']
> +  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
> +end
>  
>  def have_local_library(lib, path, func, headers = nil)
>    checking_for checking_message(func, lib) do
> diff --git a/configure b/configure
> index 13a8dca..b967a4e 100755
> --- a/configure
> +++ b/configure
> @@ -751,6 +751,16 @@ else
>      as_needed_ldflags=""
>  fi
>  
> +printf "Checking for -Wl,--no-undefined... "
> +if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
> +then
> +    printf "Yes.\n"
> +    no_undefined_ldflags="-Wl,--no-undefined"
> +else
> +    printf "No (nothing to worry about).\n"
> +    no_undefined_ldflags=""
> +fi
> +
>  WARN_CXXFLAGS=""
>  printf "Checking for available C++ compiler warning flags... "
>  for flag in -Wall -Wextra -Wwrite-strings; do
> @@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
>  # Flags needed to have linker link only to necessary libraries
>  AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
>  
> +# Flags to have the linker flag undefined symbols in object files
> +NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
> +
>  # Whether valgrind header files are available
>  HAVE_VALGRIND = ${have_valgrind}
>  
> diff --git a/lib/Makefile.local b/lib/Makefile.local
> index f9ecd50..b58b4e8 100644
> --- a/lib/Makefile.local
> +++ b/lib/Makefile.local
> @@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so
>  LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
>  SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
>  LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
> -LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
> +LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
>  ifeq ($(PLATFORM),OPENBSD)
>  LIBRARY_LINK_FLAG += -lc
>  endif
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2015-06-14  6:20 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01 12:16 Build and test ruby bindings David Bremner
2015-01-01 12:16 ` [PATCH 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
2015-01-01 12:16 ` [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
2015-01-01 15:53   ` David Bremner
2015-01-01 12:16 ` [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-03-06 21:57     ` [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-03-06 21:57     ` [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-06-13  6:37           ` David Bremner
2015-06-13 19:59             ` Jinwoo Lee
2015-06-13 20:46               ` Jinwoo Lee
2015-06-13 20:51                 ` Jinwoo Lee
2015-06-13 21:11                   ` David Bremner
2015-06-13 21:22                     ` Jinwoo Lee
2015-06-13 21:24                       ` Jinwoo Lee
2015-06-13 21:34                         ` Jinwoo Lee
2015-06-14  5:49                           ` David Bremner
2015-06-15  6:35             ` David Bremner
2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-06-14  5:58           ` [PATCH] lib, ruby: " David Bremner
2015-06-14  6:20             ` Jinwoo Lee [this message]
2015-06-14  6:53               ` David Bremner
2015-06-14 15:16                 ` Jinwoo Lee
2015-06-14 18:34                   ` David Bremner
2015-06-15  3:56                     ` Jinwoo Lee
2015-06-15  9:20                       ` Tomi Ollila
2015-06-15 21:49                         ` Jinwoo Lee
2015-06-16 18:20                           ` Tomi Ollila
2015-06-16 23:43                             ` Jinwoo Lee
2015-06-17  0:15                               ` Jinwoo Lee
2015-06-17  6:23                               ` David Bremner
2015-06-17  6:39                                 ` Jinwoo Lee
2015-06-17 11:16                                 ` Tomi Ollila
2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-06-14  6:26           ` [PATCH] " David Bremner
2015-06-01  7:09         ` [patch v3 4/4] test: add initial ruby tests David Bremner

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=yq65a8w2u7yv.fsf@jinwoo-macbookair.roam.corp.google.com \
    --to=jinwoo68@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).