From owner-freebsd-ports@freebsd.org Sun Oct 30 02:31:51 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 260E3C25D2B for ; Sun, 30 Oct 2016 02:31:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E314CACD for ; Sun, 30 Oct 2016 02:31:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::c31:6177:bac9:4152] (unknown [IPv6:2001:7b8:3a7:0:c31:6177:bac9:4152]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 78E6815B6D; Sun, 30 Oct 2016 03:31:47 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_974229DC-1DCE-4529-8910-13BC82B8FD71"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Problem with gcc5 std library when building ports From: Dimitry Andric In-Reply-To: Date: Sun, 30 Oct 2016 03:31:36 +0100 Cc: ports-list freebsd Message-Id: References: To: Dewayne Geraghty X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2016 02:31:51 -0000 --Apple-Mail=_974229DC-1DCE-4529-8910-13BC82B8FD71 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 27 Oct 2016, at 01:01, Dewayne Geraghty = wrote: >=20 > Can anyone help regarding the apparant absence of snprintf from std? = Am I > missing something, perhaps LDCONFIG or? I've looked in /usr/ports/Mk/ > bsd.gcc.mk and /usr/ports/Mk/bsd.port.mk but this is an area that I'm > unfamiliar, so nothing really stood out. >=20 > If I change the compiler from gcc5 to clang everything compiles and = runs > correctly. I have in /etc/make.conf > USE_GCC=3D 5 > and to use clang, I just comment out the above. So everything is = constant, > on FreeBSD 10.3Stable (updated and rebuilt overnight) The difference is that clang by default uses libc++, while gcc uses libstcd++. Unfortunately, our gcc ports have a long-standing problem with recognition of C99 functionality for their copies of libstdc++. If you look in gcc5's header, usually located in /usr/local/lib/gcc5/include/c++/cstdio, you will see this: #if _GLIBCXX_USE_C99 #undef snprintf [...] namespace __gnu_cxx { #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC extern "C" int (snprintf)(char * __restrict, std::size_t, const char * __restrict, = ...) throw (); [...] #endif #if !_GLIBCXX_USE_C99_DYNAMIC using ::snprintf; [...] #endif } // namespace __gnu_cxx namespace std { using ::__gnu_cxx::snprintf; [...] } // namespace std #endif // _GLIBCXX_USE_C99 So in a slightly convoluted way, it only defines std::snprintf() when _GLIBCXX_USE_C99 is defined. However, during the port build, the gcc configuration mechanism seems to conclude that C99 support is *not* available, and stores this in = /usr/local/lib/gcc5/include/c++/${ARCH}-portbld-freebsd${VERSION}/bits/c++= config.h: /* Define if C99 functions or macros from , , = , , and can be used or exposed. */ /* #undef _GLIBCXX_USE_C99 */ This has been the case for ages now, and there must be lots of bug reports for it, but it has not been fixed. -Dimitry --Apple-Mail=_974229DC-1DCE-4529-8910-13BC82B8FD71 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlgVW5IACgkQsF6jCi4glqNKtgCgvRoQFssLunGb7u3ExE5zeHli 0FkAoNn1jrw5fXsqaLZOzIlLt0NA+mWk =Bv4n -----END PGP SIGNATURE----- --Apple-Mail=_974229DC-1DCE-4529-8910-13BC82B8FD71--