From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 464 invoked by alias); 6 Jul 2013 11:19:38 -0000 Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org Received: (qmail 451 invoked by uid 89); 6 Jul 2013 11:19:37 -0000 X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_GC,TW_IB,URIBL_BLACK autolearn=no version=3.3.1 Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 06 Jul 2013 11:19:35 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id AC2E7B0076; Sat, 6 Jul 2013 07:19:33 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id r66BJXh7011541; Sat, 6 Jul 2013 07:19:33 -0400 Date: Sat, 06 Jul 2013 11:19:00 -0000 From: Jack Howarth To: Andrew Haley Cc: java-patches@gcc.gnu.org Subject: Re: [PATCH] link libgcj directly to libiconv to resolve symbols Message-ID: <20130706111933.GA21424@bromo.med.uc.edu> References: <20130705161058.GA15079@bromo.med.uc.edu> <51D6F38B.4000205@redhat.com> <20130706035819.GA22350@bromo.med.uc.edu> <51D7BD32.7050509@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51D7BD32.7050509@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2013-q3/txt/msg00006.txt.bz2 On Sat, Jul 06, 2013 at 07:46:10AM +0100, Andrew Haley wrote: > On 07/06/2013 04:58 AM, Jack Howarth wrote: > > On Fri, Jul 05, 2013 at 05:25:47PM +0100, Andrew Haley wrote: > >> On 07/05/2013 05:10 PM, Jack Howarth wrote: > >>> Currently the build of the libgcj shared library in libjava > >>> omits a direct linkage against the libiconv shared library to > >>> resolve the undefined _libiconv, _libiconv_close and > >>> _libiconv_open symbols in libgcj. My understanding of shared > >>> library best practices is that shared libraries should always be > >>> linked directly to the those shared libraries required to resolve > >>> their undefined symbols rather than postponing this linkage until > >>> when the shared library is used (as is currently done in > >>> libjava/libgcj.spec.in). The attached patch achieves this by > >>> removing the @LIBMATHSPEC@ from *lib: in libjava/libgcj.spec.in > >>> and moving it as $(LDLIBICONV) onto libgcj_la_LDFLAGS in > >>> libjava/Makefile.am and libjava/Makefile.in. > >>> Bootstrap and regression tested on x86_64-apple-darwin12 for gcc > >>> trunk and gcc-4_8-branch. > >>> Okay for gcc trunk and gcc-4_8-branch? > >> > >> No. Some systems have iconv in libc, some have it in libiconv. > > > > I assume you are doing this to create binary tarball > > distributions which can be deployed on various linux distros, > > correct? Isn't this rather dangerous as you are compiling libgcj > > against the headers of some unknown libiconv release and then having > > it linked against a completely different one when deployed in the > > field. > > It's never broken anything before. Why would it do so now? > > > Doesn't this require a lot of assumptions about the data structures > > on libiconv calls not changing between the various releases? It > > would seem to be safier if you just added an option to statically > > link libiconv.a into libgcj if such a portable tarball release was > > required. > > It'd help a lot if you explained what problem you're trying to solve. > "shared library best practices" doesn't quite do it. The problem is that the current configury in libjava can't cope with the case of building a multilib on a system has a fat x86_64/i386 libiconv present in /usr/include and /usr/lib and a targeted libiconv in /sw/include and /sw/lib that only exists as x86_64. The normal build handles this okay with just... --with-libiconv-prefix=/sw producing no linkages against the system libiconv shared library but if one uses... --with-sysroot="/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk --with-libiconv-prefix=/sw the x86_64 libraries of the multilib built with libgcj.spec end up linked to /usr/lib/libiconv. I believe this is another permutation of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49441 where the multilib build on x86_64-apple-darwin12 starts in the 32-bit i386 subdirectory (which can't find a usable libiconv) and used to force that finding onto the toplevel x86_64 build which should be able to find one but uses the cached information. My observation has been that this whole mess of cached libiconv settings in the multilib is avoided if the linkage to libiconv is removed from libgcj.spec.in and placed on the libgcj shared lib (which actually contains the undefined symbols being resolved anyway). Jack ps I still don't see how you can defend totally decoupling the headers used for building against a supporting library from the actual library itself. Isnt' that why soversioning was created in the first place? pps We have used the proposed patch in the past as the configury in libjava with regard to libiconv has always been fragile. > > Andrew.