Problem with gcc5 std library when building ports
dim at FreeBSD.org
Sun Oct 30 02:31:51 UTC 2016
On 27 Oct 2016, at 01:01, Dewayne Geraghty <dewaynegeraghty at gmail.com> wrote:
> 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.
> If I change the compiler from gcc5 to clang everything compiles and runs
> correctly. I have in /etc/make.conf
> USE_GCC= 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 <cstdio> header, usually located in
/usr/local/lib/gcc5/include/c++/cstdio, you will see this:
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" int
(snprintf)(char * __restrict, std::size_t, const char * __restrict, ...)
} // namespace __gnu_cxx
} // 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
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the freebsd-ports