Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] support std module #2119

Open
RichardLuo0 opened this issue Jan 24, 2025 · 2 comments
Open

[FR] support std module #2119

RichardLuo0 opened this issue Jan 24, 2025 · 2 comments

Comments

@RichardLuo0
Copy link

Description

I am trying to get the std module to work on Android.
Here is some progress I have made:
I compiled the libc++ from llvm-project using ndk toolchain, and it does build without issues. But when I try to use it according to https://libcxx.llvm.org/Modules.html#using-the-local-build, I got lots of errors like

[build] In file included from <path to build dir>/_deps/std-src/std.cppm:249:
[build] <path to build dir>/_deps/std-src/std/cstdio.inc:48:14: error: using declaration referring to 'sprintf' with internal linkage cannot be exported
[build]    48 |   using std::sprintf _LIBCPP_USING_IF_EXISTS;
[build]       |              ^
[build] <path to android sdk>/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/bits/fortify/stdio.h:59:5: note: target of using declaration
[build]    59 | int sprintf(char* __BIONIC_COMPLICATED_NULLNESS dest, const char* _Nonnull format)
[build]       |     ^

It is due to the NDK using internal linkage inside c headers. In MinGW, they are defined as declarations instead of implementations.
Is there a way to get rid of this?

@DanAlbert
Copy link
Member

It is due to the NDK using internal linkage inside c headers

https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/sys/cdefs.h;l=262-268;drc=ed2d3832bd8afef5021c3efc6db3352f2b35a848 says they have to be. Unless @enh-google knows otherwise, this is something that'd have to be fixed in Clang (why can't it handle a static inline?), not bionic.

@enh-google
Copy link
Collaborator

It is due to the NDK using internal linkage inside c headers

https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/sys/cdefs.h;l=262-268;drc=ed2d3832bd8afef5021c3efc6db3352f2b35a848 says they have to be. Unless @enh-google knows otherwise, this is something that'd have to be fixed in Clang (why can't it handle a static inline?), not bionic.

@gburgessiv for that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants