This is an archive of the discontinued LLVM Phabricator instance.

[libc++][Android] Android/Bionic headers don't work with modules yet
ClosedPublic

Authored by rprichard on Dec 6 2022, 7:32 PM.

Details

Summary

The current Android headers don't appear to work with modules. We may
want to fix them eventually.

Diff Detail

Event Timeline

rprichard created this revision.Dec 6 2022, 7:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 7:32 PM
Herald added a subscriber: danielkiss. · View Herald Transcript
rprichard requested review of this revision.Dec 6 2022, 7:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 7:32 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

This test fails with this output:

$ "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++" "/llvm/libcxx/test/libcxx/modules_include.sh.cpp" "--target=x86_64-none-linux-android21" "-nostdinc++" "-I" "/llvm/build/android-ndk/include/c++/v1" "-I" "/llvm/build/android-ndk/include/c++/v1" "-I" "/llvm/libcxx/test/support" "-std=c++2b" "-Werror" "-Wall" "-Wctad-maybe-unsupported" "-Wextra" "-Wshadow" "-Wundef" "-Wno-unused-command-line-argument" "-Wno-attributes" "-Wno-pessimizing-move" "-Wno-c++11-extensions" "-Wno-noexcept-type" "-Wno-atomic-alignment" "-Wno-user-defined-literals" "-Wno-tautological-compare" "-Wsign-compare" "-Wunused-variable" "-Wunused-parameter" "-Wunreachable-code" "-Wno-unused-local-typedef" "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER" "-D_LIBCPP_ENABLE_EXPERIMENTAL" "-D_LIBCPP_DISABLE_AVAILABILITY" "-fcoroutines-ts" "-Werror=thread-safety" "-Wuser-defined-warnings" "-fmodules" "-fcxx-modules" "-fmodules-cache-path=/llvm/build/android-ndk/test/libcxx/Output/modules_include.sh.cpp.dir/t.tmp" "-fsyntax-only" "-DTEST_0"
# command stderr:
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:14:
In file included from /llvm/build/android-ndk/include/c++/v1/locale.h:47:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/locale.h:31:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/locale.h:103:1: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
locale_t duplocale(locale_t __l) __INTRODUCED_IN(21);
^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:17:
In file included from /llvm/build/android-ndk/include/c++/v1/math.h:312:
In file included from /llvm/build/android-ndk/include/c++/v1/stdlib.h:94:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/stdlib.h:31:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdlib.h:259:68: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
long long strtoll_l(const char* __s, char** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
                                                                   ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:26:
In file included from /llvm/build/android-ndk/include/c++/v1/string.h:61:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/string.h:159:53: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
int strcoll_l(const char* __lhs, const char* __rhs, locale_t __l) __attribute_pure__ __INTRODUCED_IN(21);
                                                    ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:32:
In file included from /llvm/build/android-ndk/include/c++/v1/wctype.h:67:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/wctype.h:31:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/wctype.h:39:29: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
int iswalnum_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
                            ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:237:
In file included from /llvm/build/android-ndk/include/c++/v1/iosfwd:100:
In file included from /llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:29:
In file included from /llvm/build/android-ndk/include/c++/v1/wchar.h:124:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/wchar.h:31:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/wchar.h:37:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/time.h:33:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/time.h:37:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/sys/select.h:40:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/signal.h:167:18: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/pthread_types.h"'; 'pthread_t' must be declared before it is used
int pthread_kill(pthread_t __pthread, int __signal);
                 ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/pthread_types.h:104:14: note: declaration here is not visible
typedef long pthread_t;
             ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:237:
In file included from /llvm/build/android-ndk/include/c++/v1/iosfwd:100:
In file included from /llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:29:
In file included from /llvm/build/android-ndk/include/c++/v1/wchar.h:124:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/wchar.h:31:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/wchar.h:37:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/time.h:86:86: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __strftimelike(3) __INTRODUCED_IN(21);
                                                                                     ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:237:
In file included from /llvm/build/android-ndk/include/c++/v1/iosfwd:100:
In file included from /llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:29:
In file included from /llvm/build/android-ndk/include/c++/v1/wchar.h:124:
In file included from /home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/local/include/wchar.h:31:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/wchar.h:56:19: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/mbstate_t.h"'; 'mbstate_t' must be declared before it is used
int mbsinit(const mbstate_t* __ps);
                  ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/mbstate_t.h:47:3: note: declaration here is not visible
} mbstate_t;
  ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:238:
In file included from /llvm/build/android-ndk/include/c++/v1/stdexcept:46:
In file included from /llvm/build/android-ndk/include/c++/v1/cstdlib:87:
/llvm/build/android-ndk/include/c++/v1/stdlib.h:150:34: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdlib.h"'; 'ldiv_t' must be declared before it is used
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
                                 ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdlib.h:187:3: note: declaration here is not visible
} ldiv_t;
  ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:238:
In file included from /llvm/build/android-ndk/include/c++/v1/stdexcept:46:
In file included from /llvm/build/android-ndk/include/c++/v1/cstdlib:87:
/llvm/build/android-ndk/include/c++/v1/stdlib.h:150:41: error: redefinition of 'div'
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
                                        ^
/llvm/build/android-ndk/include/c++/v1/stdlib.h:150:41: note: previous definition is here
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT {
                                        ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:238:
In file included from /llvm/build/android-ndk/include/c++/v1/stdexcept:46:
In file included from /llvm/build/android-ndk/include/c++/v1/cstdlib:87:
/llvm/build/android-ndk/include/c++/v1/stdlib.h:154:42: error: redefinition of 'div'
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
                                         ^
/llvm/build/android-ndk/include/c++/v1/stdlib.h:154:42: note: previous definition is here
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x,
                                         ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:168:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/shared_ptr.h:22:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/allocation_guard.h:14:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/allocator_traits.h:14:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/construct_at.h:20:
/llvm/build/android-ndk/include/c++/v1/new:346:11: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdlib.h"'; 'posix_memalign' must be declared before it is used
  (void)::posix_memalign(&__result, __alignment, __size);
          ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/stdlib.h:98:5: note: declaration here is not visible
int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __INTRODUCED_IN(17);
    ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:168:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/shared_ptr.h:43:
In file included from /llvm/build/android-ndk/include/c++/v1/atomic:525:
In file included from /llvm/build/android-ndk/include/c++/v1/__thread/poll_with_backoff.h:15:
In file included from /llvm/build/android-ndk/include/c++/v1/__chrono/high_resolution_clock.h:14:
In file included from /llvm/build/android-ndk/include/c++/v1/__chrono/system_clock.h:16:
In file included from /llvm/build/android-ndk/include/c++/v1/ctime:53:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/time.h:86:86: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h"'; 'locale_t' must be declared before it is used
size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __strftimelike(3) __INTRODUCED_IN(21);
                                                                                     ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/xlocale.h:49:28: note: declaration here is not visible
typedef struct __locale_t* locale_t;
                           ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:168:
In file included from /llvm/build/android-ndk/include/c++/v1/__memory/shared_ptr.h:43:
In file included from /llvm/build/android-ndk/include/c++/v1/atomic:526:
In file included from /llvm/build/android-ndk/include/c++/v1/__thread/timed_backoff_policy.h:18:
In file included from /llvm/build/android-ndk/include/c++/v1/__threading_support:37:
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/pthread.h:97:26: error: use of undeclared identifier 'pthread_attr_t'; did you mean 'pthread_atfork'?
int pthread_attr_destroy(pthread_attr_t* __attr);
                         ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/pthread.h:95:5: note: 'pthread_atfork' declared here
int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void));
    ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/pthread.h:97:42: error: use of undeclared identifier '__attr'
int pthread_attr_destroy(pthread_attr_t* __attr);
                                         ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/pthread.h:98:39: error: missing '#include "/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/pthread_types.h"'; 'pthread_attr_t' must be declared before it is used
int pthread_attr_getdetachstate(const pthread_attr_t* __attr, int* __state);
                                      ^
/home/libcxx-builder/android-sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/pthread_types.h:44:3: note: declaration here is not visible
} pthread_attr_t;
  ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:170:
In file included from /llvm/build/android-ndk/include/c++/v1/bitset:131:
In file included from /llvm/build/android-ndk/include/c++/v1/string:561:
/llvm/build/android-ndk/include/c++/v1/__string/char_traits.h:86:24: error: reference to 'mbstate_t' is ambiguous
    using state_type = mbstate_t;
                       ^
/llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:40:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
/llvm/build/android-ndk/include/c++/v1/cwchar:125:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:170:
In file included from /llvm/build/android-ndk/include/c++/v1/bitset:131:
In file included from /llvm/build/android-ndk/include/c++/v1/string:561:
/llvm/build/android-ndk/include/c++/v1/__string/char_traits.h:201:33: error: reference to 'mbstate_t' is ambiguous
    using state_type          = mbstate_t;
                                ^
/llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:40:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
/llvm/build/android-ndk/include/c++/v1/cwchar:125:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:170:
In file included from /llvm/build/android-ndk/include/c++/v1/bitset:131:
In file included from /llvm/build/android-ndk/include/c++/v1/string:561:
/llvm/build/android-ndk/include/c++/v1/__string/char_traits.h:317:33: error: reference to 'mbstate_t' is ambiguous
    using state_type          = mbstate_t;
                                ^
/llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:40:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
/llvm/build/android-ndk/include/c++/v1/cwchar:125:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
While building module 'std' imported from /llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:
In file included from <module-includes>:34:
In file included from /llvm/build/android-ndk/include/c++/v1/complex.h:27:
In file included from /llvm/build/android-ndk/include/c++/v1/ccomplex:21:
In file included from /llvm/build/android-ndk/include/c++/v1/complex:243:
In file included from /llvm/build/android-ndk/include/c++/v1/sstream:191:
In file included from /llvm/build/android-ndk/include/c++/v1/istream:165:
In file included from /llvm/build/android-ndk/include/c++/v1/ostream:170:
In file included from /llvm/build/android-ndk/include/c++/v1/bitset:131:
In file included from /llvm/build/android-ndk/include/c++/v1/string:561:
/llvm/build/android-ndk/include/c++/v1/__string/char_traits.h:436:33: error: reference to 'mbstate_t' is ambiguous
    using state_type          = mbstate_t;
                                ^
/llvm/build/android-ndk/include/c++/v1/__mbstate_t.h:40:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
/llvm/build/android-ndk/include/c++/v1/cwchar:125:9: note: candidate found by name lookup is 'std::mbstate_t'
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/llvm/libcxx/test/libcxx/modules_include.sh.cpp:54:10: fatal error: could not build module 'std'
#include <algorithm>
 ~~~~~~~~^
21 errors generated.
rprichard edited the summary of this revision. (Show Details)
rprichard added a subscriber: enh.

I wonder how important Clang-modules are for the Android platform. If they are important the proper fix would be to fix the module map.
It would be good to add the rationale for this direction in the commit message.

I'm definitely not ruling out adding Android/Bionic support for modules later on. They might be needed to fix things like the user namespace pollution in D139380. At the moment, the goal is to update the libc++ used on Android, which is a few years out of date.

rprichard edited the summary of this revision. (Show Details)Dec 7 2022, 9:59 AM
Mordante accepted this revision.Dec 7 2022, 10:54 AM

I'm definitely not ruling out adding Android/Bionic support for modules later on. They might be needed to fix things like the user namespace pollution in D139380. At the moment, the goal is to update the libc++ used on Android, which is a few years out of date.

I'm perfectly fine with getting things working again and polishing later. If it's intended to be fixed I rather see an
XFAIL: LIBCXX-ANDROID-FIXME to mark that it is an issue that should be fixed. We use, and have used, that for other platforms too. For example in this test // XFAIL: LIBCXX-AIX-FIXME, which is "defined" in test/configs/ibm-libc++-shared.cfg.in.

We tend to use UNSUPPORTED for things that are not supported and never will, for example we never expect Clang modules to work with GCC.

So I encourage you to implement a proper android XFAIL, but I don't see it as a blocker.

I have checked and I see AIX failures for other builds too, so I it seems an issue with the buildbots. (The same for your other patch.)

This revision is now accepted and ready to land.Dec 7 2022, 10:54 AM
rprichard updated this revision to Diff 481102.Dec 7 2022, 4:24 PM
rprichard edited the summary of this revision. (Show Details)

Use XFAIL instead of UNSUPPORTED.

rprichard retitled this revision from [libc++][Android] Android/Bionic headers don't work with modules to [libc++][Android] Android/Bionic headers don't work with modules yet.Dec 7 2022, 4:26 PM
rprichard edited the summary of this revision. (Show Details)
Mordante accepted this revision.Dec 8 2022, 9:39 AM

Use XFAIL instead of UNSUPPORTED.

Thanks!

This revision was landed with ongoing or failed builds.Dec 9 2022, 3:16 PM
This revision was automatically updated to reflect the committed changes.