From: Vladimir Panteleev <notmuch@thecybershadow.net>
To: notmuch@notmuchmail.org
Cc: Vladimir Panteleev <vladimir@thecybershadow.net>
Subject: [PATCH 6/8] Fix linking shared library on Cygwin
Date: Tue, 22 Aug 2017 22:43:37 +0000 [thread overview]
Message-ID: <20170822224339.22601-7-notmuch@thecybershadow.net> (raw)
In-Reply-To: <20170822224339.22601-1-notmuch@thecybershadow.net>
From: Vladimir Panteleev <vladimir@thecybershadow.net>
Apparently due to historical reasons, when given -lfoo, Cygwin's ld
will prefer to link against libfoo.a over libfoo.so (or even
libfoo.dll). As such, we need to explicitly specify the library file
name when on Cygwin to avoid creating a broken notmuch-shared binary.
* Makefile.global: Use -l:libnotmuch.so instead of -lnotmuch on
Cygwin.
---
Makefile.global | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Makefile.global b/Makefile.global
index 5d10bff7..0b536302 100644
--- a/Makefile.global
+++ b/Makefile.global
@@ -48,11 +48,19 @@ GPG_FILE=$(SHA256_FILE).asc
PV_FILE=bindings/python/notmuch/version.py
+# Cygwin's linker prefers .a files over shared objects, so indicate
+# that we want to link against the shared library explicitly.
+ifeq ($(PLATFORM),CYGWIN)
+NOTMUCH_LIBRARY_FLAG=-l:libnotmuch.so
+else
+NOTMUCH_LIBRARY_FLAG=-lnotmuch
+endif
+
# Smash together user's values with our extra values
STD_CFLAGS := -std=gnu99
FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(STD_CFLAGS) $(CFLAGS) $(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS)
FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(extra_cflags) $(extra_cxxflags) $(CONFIGURE_CXXFLAGS)
-FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lnotmuch_util -Llib -lnotmuch
+FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lnotmuch_util -Llib $(NOTMUCH_LIBRARY_FLAG)
ifeq ($(LIBDIR_IN_LDCONFIG),0)
FINAL_NOTMUCH_LDFLAGS += $(RPATH_LDFLAGS)
endif
--
2.13.3
next prev parent reply other threads:[~2017-08-22 22:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 22:43 [PATCH 0/8] notmuch on Windows (Cygwin) and AppVeyor Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 1/8] lib: Fix talloc not being defined on Cygwin Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 2/8] Split CONFIGURE_LDFLAGS out of FINAL_LIBNOTMUCH_LDFLAGS Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 3/8] lib: Fix libnotmuch.so link under Cygwin Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 4/8] configure: Refactor uname parsing into a case statement Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 5/8] configure: Detect Cygwin, and set PLATFORM accordingly Vladimir Panteleev
2017-08-22 22:43 ` Vladimir Panteleev [this message]
2017-08-22 22:43 ` [PATCH 7/8] test: Don't attempt to build symbol-test on Cygwin Vladimir Panteleev
2017-08-22 22:43 ` [PATCH 8/8] Add AppVeyor CI configuration and test script Vladimir Panteleev
2017-08-25 11:35 ` [PATCH 0/8] notmuch on Windows (Cygwin) and AppVeyor David Bremner
2017-08-25 18:52 ` Vladimir Panteleev
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=20170822224339.22601-7-notmuch@thecybershadow.net \
--to=notmuch@thecybershadow.net \
--cc=notmuch@notmuchmail.org \
--cc=vladimir@thecybershadow.net \
/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).