--- /dev/null
+Return-Path: <jinwoo68@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 2D0576DE0948\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 23:20:32 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.57\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.57 tagged_above=-999 required=5 tests=[AWL=-0.000,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 00d3jE0eCqdQ for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Jun 2015 23:20:29 -0700 (PDT)\r
+Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com\r
+ [209.85.220.50])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 63CC56DE0350\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 23:20:29 -0700 (PDT)\r
+Received: by pacgb13 with SMTP id gb13so15433456pac.1\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Jun 2015 23:20:28 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+ :mime-version:content-type;\r
+ bh=+zcSkxkX8+5Yd9amvhK4VyVTROGjVtZ/xpXSk/oDGm0=;\r
+ b=t+2Jp9Sn6J1ITC+mG1Z5uGSEC523b7pWBnkzrBO/eDY6fQEO47jYcplvuQW8nC56Tk\r
+ 527xdvY8+wBdF82UaT8CfJ/lVNSdzFmFCO1aZ82MWti2HVVh2k6jXpcc+peNkB4R9Xx4\r
+ wBN90UGaYWpls9FGBxMXow+p6lK7wyD3+quZ/wKuOIC4JrgXaIfgd2J1wHPVLIJ1T3qK\r
+ Y1pd1KSb2rua+IPQSIP9s1D1+62R/zmjbuurpIu1PZni+/1I7WwNac2IdZEyDJHHNGa/\r
+ MyFG6AA/zbZ5tjfNy1dPyiHCLHVatqmXOXXcTC2XGMjw40veNZe41Hit6DIuSrNMqg+c\r
+ ujaQ==\r
+X-Received: by 10.66.66.140 with SMTP id f12mr38067295pat.120.1434262828457;\r
+ Sat, 13 Jun 2015 23:20:28 -0700 (PDT)\r
+Received: from localhost ([2601:647:4b02:71ea:edc7:1c56:e47a:dbb0])\r
+ by mx.google.com with ESMTPSA id nt6sm4133442pbc.18.2015.06.13.23.20.25\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 13 Jun 2015 23:20:26 -0700 (PDT)\r
+From: Jinwoo Lee <jinwoo68@gmail.com>\r
+To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable\r
+In-Reply-To: <1434261524-14139-1-git-send-email-david@tethera.net>\r
+References: <1433142542-2307-3-git-send-email-david@tethera.net>\r
+ <1434261524-14139-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.20.1+21~g4e79903 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-apple-darwin14.3.0)\r
+Date: Sat, 13 Jun 2015 23:20:24 -0700\r
+Message-ID: <yq65a8w2u7yv.fsf@jinwoo-macbookair.roam.corp.google.com>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="=-=-="\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 14 Jun 2015 06:20:32 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+There are 2 problems.\r
+\r
+1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the\r
+ dependency of ruby-bindings.\r
+\r
+> make: *** No rule to make target `lib/libnotmuch.so', needed by\r
+> `ruby-bindings'. Stop.\r
+\r
+2. After manually changing it to lib/libnotmuch.dylib, I still get an\r
+ error like below:\r
+\r
+> cd bindings/ruby && \\r
+> EXTRA_LDFLAGS="" \\r
+> ruby extconf.rb --vendor\r
+> checking for notmuch_database_create in libnotmuch.so... no\r
+> *** extconf.rb failed ***\r
+> Could not create Makefile due to some reason, probably lack of\r
+> necessary libraries and/or headers. Check the mkmf.log file for more\r
+> details. You may need configuration options.\r
+\r
+> Provided configuration options:\r
+> --with-opt-dir\r
+> --without-opt-dir\r
+> --with-opt-include\r
+> --without-opt-include=${opt-dir}/include\r
+> --with-opt-lib\r
+> --without-opt-lib=${opt-dir}/lib\r
+> --with-make-prog\r
+> --without-make-prog\r
+> --srcdir=.\r
+> --curdir\r
+> --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby\r
+> make: *** [ruby-bindings] Error 1\r
+\r
+I tried updating extconf.rb to change libnotmuch.so to libnotmuch.dylib\r
+but that still emit a similar error.\r
+\r
+And the attached is the log file, mkmf.log generated in bindings/ruby.\r
+\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+Content-Disposition: attachment; filename=mkmf.log\r
+Content-Description: mkmf.log\r
+\r
+have_local_library: checking for notmuch_database_create in libnotmuch.dylib... -------------------- no\r
+\r
+"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 "\r
+ld: warning: directory not found for option '-L/usr/local/lib'\r
+ld: warning: directory not found for option '-L/usr/local/lib'\r
+checked program was:\r
+/* begin */\r
+1: #include "ruby.h"\r
+2: \r
+3: int main(int argc, char **argv)\r
+4: {\r
+5: return 0;\r
+6: }\r
+/* end */\r
+\r
+"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 "\r
+ld: warning: directory not found for option '-L/usr/local/lib'\r
+ld: warning: directory not found for option '-L/usr/local/lib'\r
+ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib\r
+Undefined symbols for architecture i386:\r
+ "_notmuch_database_create", referenced from:\r
+ _t in conftest-2cad94.o\r
+ld: symbol(s) not found for architecture i386\r
+clang: error: linker command failed with exit code 1 (use -v to see invocation)\r
+checked program was:\r
+/* begin */\r
+ 1: #include "ruby.h"\r
+ 2: \r
+ 3: #include <notmuch.h>\r
+ 4: \r
+ 5: /*top*/\r
+ 6: extern int t(void);\r
+ 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))notmuch_database_create; return 0; }\r
+ 8: int main(int argc, char **argv)\r
+ 9: {\r
+10: if (argc > 1000000) {\r
+11: printf("%p", &t);\r
+12: }\r
+13: \r
+14: return 0;\r
+15: }\r
+/* end */\r
+\r
+"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 "\r
+conftest.c:7:39: error: too few arguments to function call, expected 2, have 0\r
+int t(void) { notmuch_database_create(); return 0; }\r
+ ~~~~~~~~~~~~~~~~~~~~~~~ ^\r
+../../lib/notmuch.h:234:1: note: 'notmuch_database_create' declared here\r
+notmuch_status_t\r
+^\r
+1 error generated.\r
+checked program was:\r
+/* begin */\r
+ 1: #include "ruby.h"\r
+ 2: \r
+ 3: #include <notmuch.h>\r
+ 4: \r
+ 5: /*top*/\r
+ 6: extern int t(void);\r
+ 7: int t(void) { notmuch_database_create(); return 0; }\r
+ 8: int main(int argc, char **argv)\r
+ 9: {\r
+10: if (argc > 1000000) {\r
+11: printf("%p", &t);\r
+12: }\r
+13: \r
+14: return 0;\r
+15: }\r
+/* end */\r
+\r
+--------------------\r
+\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+\r
+On Sat, Jun 13, 2015 at 10:58 PM, David Bremner <david@tethera.net> wrote:\r
+> In particular this is supposed to help build on systems (presumably\r
+> using a non-gnu ld) where this flag is not available.\r
+> ---\r
+> bindings/Makefile.local | 4 +++-\r
+> bindings/ruby/extconf.rb | 5 +++--\r
+> configure | 13 +++++++++++++\r
+> lib/Makefile.local | 2 +-\r
+> 4 files changed, 20 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/bindings/Makefile.local b/bindings/Makefile.local\r
+> index 16817f5..d236f01 100644\r
+> --- a/bindings/Makefile.local\r
+> +++ b/bindings/Makefile.local\r
+> @@ -5,7 +5,9 @@ dir := bindings\r
+> # force the shared library to be built\r
+> ruby-bindings: lib/libnotmuch.so\r
+> ifeq ($(HAVE_RUBY_DEV),1)\r
+> - cd $(dir)/ruby && ruby extconf.rb --vendor\r
+> + cd $(dir)/ruby && \\r
+> + EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \\r
+> + ruby extconf.rb --vendor\r
+> $(MAKE) -C $(dir)/ruby\r
+> else\r
+> @echo Missing dependency, skipping ruby bindings\r
+> diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb\r
+> index 6160db2..6d5607e 100644\r
+> --- a/bindings/ruby/extconf.rb\r
+> +++ b/bindings/ruby/extconf.rb\r
+> @@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')\r
+> # includes\r
+> $INCFLAGS = "-I#{dir} #{$INCFLAGS}"\r
+> \r
+> -# make sure there are no undefined symbols\r
+> -$LDFLAGS += ' -Wl,--no-undefined'\r
+> +if ENV['EXTRA_LDFLAGS']\r
+> + $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']\r
+> +end\r
+> \r
+> def have_local_library(lib, path, func, headers = nil)\r
+> checking_for checking_message(func, lib) do\r
+> diff --git a/configure b/configure\r
+> index 13a8dca..b967a4e 100755\r
+> --- a/configure\r
+> +++ b/configure\r
+> @@ -751,6 +751,16 @@ else\r
+> as_needed_ldflags=""\r
+> fi\r
+> \r
+> +printf "Checking for -Wl,--no-undefined... "\r
+> +if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1\r
+> +then\r
+> + printf "Yes.\n"\r
+> + no_undefined_ldflags="-Wl,--no-undefined"\r
+> +else\r
+> + printf "No (nothing to worry about).\n"\r
+> + no_undefined_ldflags=""\r
+> +fi\r
+> +\r
+> WARN_CXXFLAGS=""\r
+> printf "Checking for available C++ compiler warning flags... "\r
+> for flag in -Wall -Wextra -Wwrite-strings; do\r
+> @@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}\r
+> # Flags needed to have linker link only to necessary libraries\r
+> AS_NEEDED_LDFLAGS = ${as_needed_ldflags}\r
+> \r
+> +# Flags to have the linker flag undefined symbols in object files\r
+> +NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}\r
+> +\r
+> # Whether valgrind header files are available\r
+> HAVE_VALGRIND = ${have_valgrind}\r
+> \r
+> diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+> index f9ecd50..b58b4e8 100644\r
+> --- a/lib/Makefile.local\r
+> +++ b/lib/Makefile.local\r
+> @@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so\r
+> LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)\r
+> SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)\r
+> LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)\r
+> -LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined\r
+> +LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)\r
+> ifeq ($(PLATFORM),OPENBSD)\r
+> LIBRARY_LINK_FLAG += -lc\r
+> endif\r
+> -- \r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--=-=-=--\r