termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

A request to enable import std in clang 20

Open shavesha opened this issue 9 months ago • 6 comments

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.

shavesha avatar Mar 21 '25 10:03 shavesha

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

TomJo2000 avatar Mar 21 '25 11:03 TomJo2000

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.

finagolfin avatar Mar 21 '25 17:03 finagolfin

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

shavesha avatar Mar 21 '25 18:03 shavesha

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.

finagolfin avatar Mar 21 '25 18:03 finagolfin

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.

BlazByte avatar Mar 22 '25 03:03 BlazByte

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.

finagolfin avatar Mar 31 '25 03:03 finagolfin