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
NetBSD 9.99.81 NetBSD 9.99.81 (GENERIC) #0: Sat Apr 10 15:34:05 UTC 2021 i386
Trying to build from source (because youcompleteme), it fails.

In pkgsrc this is fixed by removing _XOPEN_SOURCE:

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

[  5%] Building CXX object absl/absl/time/CMakeFiles/absl_time_zone.dir/internal/cctz/src/
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/
/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

/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.
Build this with g++:
#define _XOPEN_SOURCE 1
#include <string>
int main() { return 0; }

Maybe include locale.h and define __SETLOCALE_SOURCE__ internally?

Home | Main Index | Thread Index | Old Index