From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D5E6E40D16C for ; Fri, 29 Oct 2010 16:18:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham 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 OEbgUecQ3P3Q for ; Fri, 29 Oct 2010 16:17:50 -0700 (PDT) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) by olra.theworths.org (Postfix) with ESMTP id AC61E40D16F for ; Fri, 29 Oct 2010 16:17:19 -0700 (PDT) Received: by bwz7 with SMTP id 7so3484576bwz.26 for ; Fri, 29 Oct 2010 16:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=F1kdWlxasvvdrehEY0MoemlOMf80bkxp5w3Aqe7Fa0w=; b=Cm4Jtu8xSqlTb1R1G0jmlqUxAHmi6bgJATGt68FIi1YZPEB6S0sCXtE9S/PcgfFuUm gjoHxgCbSOYONgErBMX7Yo50BZTNAPrcnUj/vAiENNd9wIsgJK/rt+ClzjdS5fT0soq4 IY8LnmmJiubkG8jYSkDtuP2yY+Onh7CKSu0dg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LaiGQ5TFiRkO72QSpC7C+Yj31p27/KMtKXduKRjcdlscFviBplj/leVEUnJbPSLChs uGucvHFy93i3fh/MsnXSbWTGvhdb+yJqL3Wu0fEoPxps3TPR+KdKaKY+TB+4vZp15qPG nMUgPd34+0VTJMKYkLPy1RtG2DdJ4IHb/279A= MIME-Version: 1.0 Received: by 10.204.46.33 with SMTP id h33mr10516656bkf.95.1288394238663; Fri, 29 Oct 2010 16:17:18 -0700 (PDT) Received: by 10.204.58.204 with HTTP; Fri, 29 Oct 2010 16:17:18 -0700 (PDT) In-Reply-To: <87pqus65pv.fsf@yoom.home.cworth.org> References: <1275735915-22650-1-git-send-email-felipe.contreras@gmail.com> <1275735915-22650-3-git-send-email-felipe.contreras@gmail.com> <87pqus65pv.fsf@yoom.home.cworth.org> Date: Sat, 30 Oct 2010 02:17:18 +0300 Message-ID: Subject: Re: [PATCH 2/3] build: fix DSO dependencies From: Felipe Contreras To: Carl Worth Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Fri, 29 Oct 2010 23:18:01 -0000 Hello, On Sat, Oct 30, 2010 at 12:37 AM, Carl Worth wrote: > On Sat, =C2=A05 Jun 2010 14:05:14 +0300, Felipe Contreras wrote: >> At least on Fedora 13, this doesn't link; the linker finds the >> dependencies, and aborts saying we should include them. > ... >> We do need to link at least to what we really use, the linker resolves >> the dependencies of our dependencies at loading time. So let's only >> specify what we use directly. > > You're certainly right that the linking was bogus. The notmuch binary > was only linking directly against libnotmuch (which in turned linked > against GMime, Xapian, and talloc). But meanwhile, the notmuch binary > is also directly using GMime and talloc so should be linking directly > against those. > >> -ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1) >> =C2=A0FINAL_NOTMUCH_LDFLAGS +=3D $(CONFIGURE_LDFLAGS) >> -FINAL_NOTMUCH_LINKER =3D CXX >> -endif > > But the change above causes the notmuch binary to also link directly > against Xapian, (which the binary does not use directly), so that's > undesired. Yes, I wanted to fix that in subsequent patches, but my first objective was to get it to build. >> - =C2=A0 =C2=A0 gmime_ldflags=3D$(pkg-config --libs $gmimepc) >> + =C2=A0 =C2=A0 if [ $linker_resolves_library_dependencies =3D "1" ]; th= en >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gmime_ldflags=3D"-lgmime-2.6= -lgobject-2.0 -lglib-2.0" >> + =C2=A0 =C2=A0 else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gmime_ldflags=3D$(pkg-config= --libs $gmimepc) >> + =C2=A0 =C2=A0 fi > > This part I don't understand. Why is it necessary to avoid using > pkg-config in this case? That sounds to me like a maintenance > nightmare. If the pkg-config information for GMime is wrong then we > should get that fixed, and not workaround it. Well, it's not possible: pkg-config is supposed to work on win32 and osx, so all the dependencies must be there, so: % pkg-config --libs gmime-2.6 -pthread -lgmime-2.6 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 Means we would be linking to many libraries we are not going to use directl= y. Fortunately, I found the solution after writing that patch: -Wl,--as-needed. With this the linker would automatically figure out that we actually want to link only to -lgmime-2.6 -lgobject-2.0 -lglib-2.0. > So, finally, I implemented a much more narrow fix for the linking > problem, (simply adding $(GMIME_LDFLAGS) and $(TALLOC_LDFLAGS) to the > FINAL_NOTMUCH_LDFLAGS assignement). > > I tested this by installing binutils-gold on my Debian system. This > caused a compilation failure before my patch, but compilation succeeds > after my patch. I'm optimistic that this means that a Fedora compilation > will work as well now. Can you test that please? Patch #1 is not needed if gmime_ldflags in patch #2 are not changed conditionally, which can be achieved by --as-needed. I just sent my proposed updated patches. --=20 Felipe Contreras