From ccef8d7f59c62cc20f4ce0e5bb2874cee7f693c5 Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Fri, 27 Feb 2015 12:14:23 +1800 Subject: [PATCH] Re: [PATCH] lib: make notmuch shared library install_name be full path on Mac OS X --- 4e/77b52325a1f5d4fdfb46b9cd33d75651b6cc71 | 115 ++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 4e/77b52325a1f5d4fdfb46b9cd33d75651b6cc71 diff --git a/4e/77b52325a1f5d4fdfb46b9cd33d75651b6cc71 b/4e/77b52325a1f5d4fdfb46b9cd33d75651b6cc71 new file mode 100644 index 000000000..d5c51da08 --- /dev/null +++ b/4e/77b52325a1f5d4fdfb46b9cd33d75651b6cc71 @@ -0,0 +1,115 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id A1087431FD2 + for ; Thu, 26 Feb 2015 10:20:18 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.438 +X-Spam-Level: ** +X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Sl91gRz7xQdG for ; + Thu, 26 Feb 2015 10:20:15 -0800 (PST) +Received: from tuna.imca.aps.anl.gov (tuna.imca.aps.anl.gov [164.54.200.33]) + by olra.theworths.org (Postfix) with ESMTP id 768DC431FBF + for ; Thu, 26 Feb 2015 10:20:15 -0800 (PST) +Received: from bass.imca.aps.anl.gov (bass.imca.aps.anl.gov [164.54.200.38]) + by tuna.imca.aps.anl.gov (Postfix) with SMTP id 26A8920063 + for ; Thu, 26 Feb 2015 12:14:23 -0600 (CST) +Received: (qmail 2849 invoked by uid 502); 26 Feb 2015 18:14:23 -0000 +Date: Thu, 26 Feb 2015 12:14:23 -0600 +From: "J. Lewis Muir" +To: David Bremner +Subject: Re: [PATCH] lib: make notmuch shared library install_name be full + path on Mac OS X +Message-ID: <20150226181423.GA2822@bass.imca.aps.anl.gov> +References: <1409541227-38895-1-git-send-email-jlmuir@imca-cat.org> + <87twyao35q.fsf@maritornes.cs.unb.ca> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87twyao35q.fsf@maritornes.cs.unb.ca> +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 26 Feb 2015 18:20:18 -0000 + +On 2/25/15 1:34 AM, David Bremner wrote: +> Unfortunately we did not receive any feedback from Mac users in the +> meantime. It would be nice to know that your patch won't break the +> existing macports and brew packages. I suppose that those work +> because they install the libraries into a well known location. + +Hi, David. + +I just tried installing to /usr/local (now on OS X Yosemite 10.10.2), +and you're right about that; it appears that because it's a standard +location, it works without my patch. Looking at the dyld(1) man page, +it says the following for the DYLD_FALLBACK_LIBRARY_PATH environment +variable (and I think the fact that /usr/local/lib is in the default +list is the reason why it works without the patch): + + This is a colon separated list of directories that contain + libraries. It is used as the default location for libraries + not found in their install path. By default, it is set to + $(HOME)/lib:/usr/local/lib:/lib:/usr/lib. + +However, if I install to /opt, it does *not* work without my patch. So, +I'm still confident that the patch is correct and needed. + +The reason it works in Homebrew is twofold. One, assuming Homebrew +installs packages to /usr/local, the dynamic linker finds the notmuch +library in /usr/local/lib because it's in the default list of locations +that the dynamic linker looks for libraries. Two, Homebrew globally +corrects all install names in dynamically shared libraries and binaries +for all packages. So, even if the package is broken, Homebrew corrects +it automatically, and no one ever knows. + +The reason it works in MacPorts is because they apply a patch that's the +same as what I submitted! See: + + https://trac.macports.org/browser/trunk/dports/mail/notmuch/files/patch-lib-Makefile.local.diff + +For any OS X notmuch developer willing to test this, here are +the five commands to run to reproduce the problem (note: another +libnotmuch*.dylib must *not* be in /usr/local/lib where it would +be found automatically by the dynamic linker; similarly, no DYLD_* +environment variables should be set for this test; obviously, change the +CFLAGS and LDFLAGS environment variables in the ./configure command to +point to where the libraries are that notmuch needs): + +=== +$ git clone git://notmuchmail.org/git/notmuch +$ CFLAGS='-I/pkg/include' LDFLAGS='-L/pkg/lib' ./configure --prefix=/opt --without-emacs +$ make +$ make install +$ /opt/bin/notmuch --version +=== + +When I run the just-installed notmuch in that last command, it produces +the following output: + +=== +dyld: Library not loaded: libnotmuch.4.dylib + Referenced from: /opt/bin/notmuch + Reason: image not found +Trace/BPT trap: 5 (core dumped) +=== + +Regards, + +Lewis -- 2.26.2