Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#67988 closed defect (fixed)

abseil: builds failing for 10.7/10.8; undeclared identifiers 'snprintf_l' and 'asprintf_l'

Reported by: mascguy (Christopher Nielsen) Owned by: judaew (Vadym-Valdis Yudaiev)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: lion mountainlion Cc: barracuda156, kencu (Ken)
Port: abseil

Description

Details, which are similar to issue:60655, are as follows:

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,
        ^

[...]

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)
         ^

Change History (7)

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

I haven't done too much digging into headers, etc, yet.

But it's interesting that this is occurring on 10.7/10.8, but not 10.6.

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

Based on a cmake ticket from three years ago, these functions - provided by xlocale.h - may be guarded with _DARWIN_C_SOURCE [for 10.7/10.8].

That ticket is: issue:60885

With the ultimate fix being the following, still in place today:

platform darwin {
    if {${os.major} >= 11 && ${os.major} <= 12} {
        # some functions in xlocale.h are hidden without this define
        # https://trac.macports.org/ticket/60885
        configure.cxxflags-append -D_DARWIN_C_SOURCE
    }
}

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

Replying to mascguy:

Based on a cmake ticket from three years ago, these functions - provided by xlocale.h - may be guarded with _DARWIN_C_SOURCE [for 10.7/10.8].

And yes indeed, simply defining _DARWIN_C_SOURCE for 10.7/10.8 fixes the issue. Fix pending ASAP.

comment:4 Changed 15 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

comment:5 Changed 15 months ago by szhorvat (Szabolcs Horvát)

Strangely this started happening for igraph, even though in the past it was fine.

https://build.macports.org/builders/ports-10.8_x86_64-builder/builds/147245/steps/install-port/logs/stdio

comment:6 Changed 15 months ago by szhorvat (Szabolcs Horvát)

Since this error seems to be triggered by a simple #include <iostream>, perhaps it should be dealt with globally instead of in a per-port manner?

There is a chance that for igraph it was somehow triggered by the latest version using -D_POSIX_C_SOURCE=200809L. But defining this symbol should not break #include <iostream>

Unfortunately I can't test on 0.10.7 or 0.10.8 to investigate this in detail.

comment:7 Changed 15 months ago by szhorvat (Szabolcs Horvát)

In 42c7a8eb91bc9ccd4e300cfa2c78749714fdd0ad/macports-ports (master):

igraph: fix build on 10.7 and 10.8

  • See #67988
  • Workaround added upstream, this commit needs to be reverted for igraph 0.10.8
Note: See TracTickets for help on using tickets.