A request to enable import std in clang 20
Even though importing standard libraries via std import is possible it has never been enabled in the clang builds available here. I would like to request that this is included by default in the next update.
We have an open PR to update LLVM/Clang to version 20.x, please leave any feedback about features you think should be enabled there.
- #23705
Are there any instructions on how to enable it? We do ship the libc++ module map separately, so if there's anything else we need to add, let us know.
We do ship the libc++ module map separately
This is news to me. I have been struggling with this issue for some time. Kindly point to the module map. I would really appreciate it. Thanks
My Termux install says it comes in this dependency of the clang package:
> dpkg -S /data/data/com.termux/files/usr/include/c++/v1/module.modulemap
ndk-sysroot: /data/data/com.termux/files/usr/include/c++/v1/module.modulemap
Maybe you just need to add some flag to use modules, like -fmodules, but we already ship a lot of this, in part because the Swift package also relies on clang modules for C/C++ compatibility.
import std; doesnt work for me either. -fmodules seems to be clang modules which is incompatible with c++ standard modules. so doing -fmodules will generate error
main.cpp:1:1: error: import of module 'std' imported non C++20 importable modules 1 | import std; | ^
maybe need LIBCXX_INSTALL_MODULES https://releases.llvm.org/19.1.0/projects/libcxx/docs/BuildingLibcxx.html srry i dont know much about building.
It appears this doesn't work in the NDK either, android/ndk#2119, whose headers we simply repackage with a couple tweaks. I suggest you take this matter up with them, as I doubt any Termux dev cares enough about this for us to get it working here first.
Leaving this open in case anybody does and so interested users know it currently does not work.