From owner-freebsd-ports@FreeBSD.ORG Sun Aug 18 22:47:17 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B565F97B for ; Sun, 18 Aug 2013 22:47:17 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-pb0-x22c.google.com (mail-pb0-x22c.google.com [IPv6:2607:f8b0:400e:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8272E215E for ; Sun, 18 Aug 2013 22:47:17 +0000 (UTC) Received: by mail-pb0-f44.google.com with SMTP id xa7so4223330pbc.31 for ; Sun, 18 Aug 2013 15:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=message-id:date:from:organization:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type; bh=aW3GUvKjzqzkOth10IAEtqtDS2Y8aukuahZa3dDx6Jw=; b=mmYjFTHpVgboNfsLabVTe9lml3tjfC2FBl2QUHGNDzydNoQqj/JQqDFzkbzZ8qvArc SiPhUvjZ6m95TYbPMrYN31MlUNMhUlG5RTMyOPouEBA3o8lrJ/5YR4rLOGIXspFTHBif tASpiqULBj+jt8GQedsKPSH+daT1O7rINhSno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type; bh=aW3GUvKjzqzkOth10IAEtqtDS2Y8aukuahZa3dDx6Jw=; b=dUmD/3y8WDWfatx80qAAUusChov0/PWYym3kUpia2hZMD8xR4Q0HOFcBJtlvd4nFIz fjS1knrlBJ61DtqHoijAvMmDUDobQGTu1xQ8Zc89/OP6fskrArhxqg1Bn8xa6whlDmcs N7pscIESr61oQzig9UZseuRmF/L9J93G4R9hDvHRNWN3KovIJAKwljgtKbHV/Boh2E1e Nn57by30FncFgWi33H6klJQ0u+SodF5zeNHBqK3AyRCAQuoaGNNLomFixRpSZsQ8bN1A yWtorYcOLUdvapwzAx+F9kRKoIaCm/G4HwQxGDSBhrazHrUvHAKQ7WVwjPpLE3VfxL2q eZ/w== X-Gm-Message-State: ALoCoQnR4+OA+qubeMnSRMY+gpxOG5UkZHvHCS48vYGWnzL8zXjO/Q3LTrIKM4KK/gixpei8ilTU X-Received: by 10.68.134.65 with SMTP id pi1mr10118814pbb.59.1376866036922; Sun, 18 Aug 2013 15:47:16 -0700 (PDT) Received: from hackintosh.wemm.org (c-71-198-8-135.hsd1.ca.comcast.net. [71.198.8.135]) by mx.google.com with ESMTPSA id xs1sm11604324pac.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 18 Aug 2013 15:47:16 -0700 (PDT) Message-ID: <52114EF2.6040901@wemm.org> Date: Sun, 18 Aug 2013 15:47:14 -0700 From: Peter Wemm Organization: World Domination in progress. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r254273 - in head: . include lib lib/libc/iconv lib/libiconv_compat lib/libkiconv share/mk sys/sys tools/build/mk References: <201308130715.r7D7F1nu076335@svn.freebsd.org> <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> In-Reply-To: <3887D7C7-D766-40DF-B154-D05768B86AA6@FreeBSD.org> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1108D0dque474thv0WB72TSxd6TVLrlWF" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, FreeBSD Ports , Peter Wemm X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2013 22:47:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1108D0dque474thv0WB72TSxd6TVLrlWF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 8/17/13 3:34 PM, Dimitry Andric wrote: > On Aug 13, 2013, at 09:15, Peter Wemm wrote: >> Author: peter >> Date: Tue Aug 13 07:15:01 2013 >> New Revision: 254273 >> URL: http://svnweb.freebsd.org/changeset/base/254273 >> >> Log: >> The iconv in libc did two things - implement the standard APIs, the G= NU >> extensions and also tried to be link time compatible with ports libic= onv. >> This splits that functionality and enables the parts that shouldn't >> interfere with the port by default. >> >> WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. >> WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API,= linker >> symbols and even a stub libiconv.so.3 that are good enough to be able= >> to 'pkg delete -f libiconv' on a running system and reasonably expect= it >> to work. >> >> I have tortured many machines over the last few days to try and reduc= e >> the possibilities of foot-shooting as much as I can. I've successful= ly >> recompiled to enable and disable the libiconv_compat modes, ports tha= t use >> libiconv alongside system iconv etc. If you don't enable the >> WITH_LIBICONV_COMPAT switch, they don't share symbol space. >> >> This is an extension of behavior on other system. iconv(3) is a stan= dard >> libc interface and libiconv port expects to be able to run alongside = it on >> systems that have it. >=20 > Unfortunately I expect this will break many ports, when the libiconv > port is installed. A simple example is the following: >=20 > #include >=20 > int main(void) > { > iconv_t ic =3D iconv_open("UTF-8", "ISO-8859-1"); > iconv_close(ic); > return 0; > } >=20 > If you compile this on a system after r254273 with -I/usr/local/include= , > and the libiconv port installed, it will result in: >=20 > $ cc -I/usr/local/include iconv-test.c -o iconv-test > /tmp/iconv-test-I1ltw1.o: In function `main': > iconv-test.c:(.text+0x21): undefined reference to `libiconv_open' > iconv-test.c:(.text+0x2f): undefined reference to `libiconv_close' > cc: error: linker command failed with exit code 1 (use -v to see invo= cation) >=20 > This is because libiconv's iconv.h does: >=20 > #define iconv_open libiconv_open > ... > #define iconv_close libiconv_close >=20 > and so on for most of its functions. Yep, but since is a standard include file, even on Linux system= s. Autoconf/libtool/etc know this, that's why it typically compiles and lin= ks like this: cc -I/usr/local/include -L/usr/local/lib iconv-test.c -liconv I'm sure there are exceptions though. Random linux box (ubuntu fwiw): peter@bit1:~$ readelf -a /lib/x86_64-linux-gnu/libc-2.15.so |grep iconv= 1554: 00220c0 45 FUNC GLOBAL DEFAULT 12 iconv_close@@GLIBC_2.2.= 5 1745: 0021f10 418 FUNC GLOBAL DEFAULT 12 iconv@@GLIBC_2.2.5 1764: 0021d00 523 FUNC GLOBAL DEFAULT 12 iconv_open@@GLIBC_2.2.5= peter@bit1:~$ grep '^extern' /usr/include/iconv.h extern iconv_t iconv_open (__const char *, __const char *); extern size_t iconv (iconv_t, char **__restrict, extern int iconv_close (iconv_t); If you mix includes and libraries like in your example, it would fail on linux too. However, linux tends to not add libiconv to the mix. peter@bit1:~$ find / -mount -name 'libiconv*' peter@bit1:~$ uname -a Linux bit1 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux The WITH_LIBICONV_COMPAT switch can be turned on - that adds the libiconv_open etc aliases. It was intended as a transition aid though - = it was intended to make 'pkg delete -f libiconv' on a running system keep wo= rking. I compile my personal systems like this: Index: Mk/Uses/iconv.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Mk/Uses/iconv.mk (revision 324679) +++ Mk/Uses/iconv.mk (working copy) @@ -16,6 +16,8 @@ IGNORE=3D USES=3Diconv does not require args .endif +.if !exists(/usr/include/iconv.h) LIB_DEPENDS+=3D libiconv.so.3:${PORTSDIR}/converters/libiconv +.endif .endif =2E. and keep libiconv completely off them. There's a couple of other po= rts with it hard coded in, but this covers most of them. eg: glib20, epic5, unzip, php-iconv. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6F= JV UTF-8: for when a ' just won\342\200\231t do. ZFS must be the bacon of file systems. "everything's better with ZFS" --1108D0dque474thv0WB72TSxd6TVLrlWF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIRTvIACgkQFRKuUnJ3cX+A6wCbBf8CKXehHv+8PLCikmiZwDZT LUkAoJJ448BiqHMW5bxl3GINw3kE5ZZD =T+p9 -----END PGP SIGNATURE----- --1108D0dque474thv0WB72TSxd6TVLrlWF--