NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/56102: libstc++ missing locale_t if _XOPEN_SOURCE defined



>Number:         56102
>Category:       toolchain
>Synopsis:       libstc++ missing locale_t if _XOPEN_SOURCE defined
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 12 00:30:01 +0000 2021
>Originator:     Tobias Ulmer
>Release:        NetBSD 9.99.81
>Organization:
>Environment:
NetBSD wind.tmux.org 9.99.81 NetBSD 9.99.81 (GENERIC) #0: Sat Apr 10 15:34:05 UTC 2021  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
Trying to build https://github.com/abseil/abseil-cpp from source (because youcompleteme), it fails.

In pkgsrc this is fixed by removing _XOPEN_SOURCE: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/abseil/patches/patch-absl_time_internal_cctz_src_time__zone__format.cc?rev=1.1&content-type=text/x-cvsweb-markup

But come on guys, that's not a fix. Let me paste you the error message:

--8<--
[  5%] Building CXX object absl/absl/time/CMakeFiles/absl_time_zone.dir/internal/cctz/src/time_zone_format.cc.o
In file included from /usr/include/g++/bits/localefwd.h:40,
                 from /usr/include/g++/string:43,
                 from /home/tobiasu/.vimruntime/YouCompleteMe_/third_party/ycmd/cpp/absl/absl/time/internal/cctz/include/cctz/time_zone.h:25,
                 from /home/tobiasu/.vimruntime/YouCompleteMe_/third_party/ycmd/cpp/absl/absl/time/internal/cctz/src/time_zone_format.cc:28:
/usr/include/g++/bits/c++locale.h: In function ?int std::__convert_from_v(int* const&, char*, int, const char*, ...)?:
/usr/include/g++/bits/c++locale.h:82:51: error: ?locale_t? was not declared in this scope
   82 |     const int __ret = vsnprintf_l(__out, __size, (locale_t)__cloc, __fmt,
      |                                                   ^~~~~~~~
/usr/include/g++/bits/c++locale.h:82:23: error: ?vsnprintf_l? was not declared in this scope; did you mean ?vsnprintf??
   82 |     const int __ret = vsnprintf_l(__out, __size, (locale_t)__cloc, __fmt,
      |                       ^~~~~~~~~~~
      |                       vsnprintf
--8<--

/usr/include/g++/bits/c++locale.h modified by NetBSD quite a bit.

locale_t is not defined in this situation because it's guarded everywhere:
#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)

_POSIX_C_SOURCE is not defined because C++, duh
_NETBSD_SOURCE is not defined because sys/featuretest.h prevents its definition if _XOPEN_SOURCE is already defined.
>How-To-Repeat:
Build this with g++:
#define _XOPEN_SOURCE 1
#include <string>
int main() { return 0; }


>Fix:
Maybe include locale.h and define __SETLOCALE_SOURCE__ internally?



Home | Main Index | Thread Index | Old Index