[FR] support std module
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
### 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
```log
[build] In file included from /_deps/std-src/std.cppm:249:
[build] /_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] /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?
Contributor guide
Research direction
Reproduce the failure by building libc++ with the NDK toolchain and using the local build as described in the linked libc++ Modules documentation. Start with std.cppm, std/cstdio.inc, and the NDK header bits/fortify/stdio.h; done means the std module can be used on Android without the internal-linkage export errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, cpp
- Domain
- compilers, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100