Opened 4 years ago

Closed 15 months ago

#60655 closed defect (fixed)

flatbuffers: error: use of undeclared identifier 'asprintf_l'

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: herbygillot (Herby Gillot)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: mountainlion Cc: mascguy (Christopher Nielsen), judaew (Vadym-Valdis Yudaiev)
Port: flatbuffers

Description

flatbuffers fails to build on Mountain Lion with this error:

In file included from /opt/local/libexec/llvm-9.0/bin/../include/c++/v1/sstream:173:
In file included from /opt/local/libexec/llvm-9.0/bin/../include/c++/v1/ostream:140:
/opt/local/libexec/llvm-9.0/bin/../include/c++/v1/locale:1571:20: error: use of undeclared identifier 'asprintf_l'
            __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
                   ^
/opt/local/libexec/llvm-9.0/bin/../include/c++/v1/__bsd_locale_defaults.h:33:61: note: expanded from macro '__libcpp_asprintf_l'
#define __libcpp_asprintf_l(...)                            asprintf_l(__VA_ARGS__)
                                                            ^

this llvm bug report suggests defining _DARWIN_C_SOURCE is the solution.

Change History (5)

comment:1 Changed 4 years ago by kencu (Ken)

same thing happens now with cmake 60885.

I wonder why, after all these years, this starts showing up now in two ports... coincidence?

comment:2 Changed 15 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:3 Changed 15 months ago by mascguy (Christopher Nielsen)

Cc: judaew added

Add another port to the list: abseil. We're now seeing the following, for 10.8 and earlier:

In file included from /opt/local/libexec/llvm-16/bin/../include/c++/v1/ostream:172:
/opt/local/libexec/llvm-16/bin/../include/c++/v1/locale:1627:16: error: use of undeclared identifier 'snprintf_l'; did you mean 'vswprintf_l'?
    int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
               ^
/opt/local/libexec/llvm-16/bin/../include/c++/v1/__bsd_locale_defaults.h:32:61: note: expanded from macro '__libcpp_snprintf_l'
#define __libcpp_snprintf_l(...)                            snprintf_l(__VA_ARGS__)
                                                            ^
/usr/include/xlocale/_wchar.h:54:5: note: 'vswprintf_l' declared here
int     vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
        ^

I'll add a separate ticket for the above. But just an FYI...

comment:4 in reply to:  3 Changed 15 months ago by mascguy (Christopher Nielsen)

Replying to mascguy:

Add another port to the list: abseil. We're now seeing the following, for 10.8 and earlier:

In file included from /opt/local/libexec/llvm-16/bin/../include/c++/v1/ostream:172:
/opt/local/libexec/llvm-16/bin/../include/c++/v1/locale:1627:16: error: use of undeclared identifier 'snprintf_l'; did you mean 'vswprintf_l'?
    int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v);
               ^
/opt/local/libexec/llvm-16/bin/../include/c++/v1/__bsd_locale_defaults.h:32:61: note: expanded from macro '__libcpp_snprintf_l'
#define __libcpp_snprintf_l(...)                            snprintf_l(__VA_ARGS__)
                                                            ^
/usr/include/xlocale/_wchar.h:54:5: note: 'vswprintf_l' declared here
int     vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
        ^

Sorry, that was for snprintf_l, albeit with the same general pattern. And also for asprintf_l:

In file included from /opt/local/libexec/llvm-16/bin/../include/c++/v1/ostream:172:
/opt/local/libexec/llvm-16/bin/../include/c++/v1/locale:3365:15: error: use of undeclared identifier 'asprintf_l'; did you mean 'vsprintf_l'?
        __n = __libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
              ^
/opt/local/libexec/llvm-16/bin/../include/c++/v1/__bsd_locale_defaults.h:33:61: note: expanded from macro '__libcpp_asprintf_l'
#define __libcpp_asprintf_l(...)                            asprintf_l(__VA_ARGS__)
                                                            ^
/usr/include/xlocale/_stdio.h:45:6: note: 'vsprintf_l' declared here
int      vsprintf_l(char * __restrict, locale_t, const char * __restrict, va_list)
         ^

comment:5 Changed 15 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

Given that this port now builds fine for 10.7/10.8 - and has been updated numerous times, in the three years since this ticket was created - we can probably close this...

Note: See TracTickets for help on using tickets.