[libc-commits] [libc] [libcxx] [llvm] [libcxx][libc] Hand in Hand PoC with from_chars (PR #91651)

Heejin Ahn via libc-commits libc-commits at lists.llvm.org
Tue May 13 20:57:07 PDT 2025


aheejin wrote:

Hello. We ([Emscripten](https://github.com/emscripten-core/emscripten)) are importing LLVM's libc++ but not libc, but after this change, I think we need to import at least a part of libc.

1. Is there a preprocessor that allows us not dependent on LLVM libc headers?
2. I'm trying to how much of the headers should I import into our codebase. I skimmed https://discourse.llvm.org/t/rfc-project-hand-in-hand-llvm-libc-libc-code-sharing/77701, and it says the directory dependency is as follows:
![image](https://github.com/user-attachments/assets/c8319b90-7d10-4d6a-8748-bffa674c6e57)
but after I imported all those directories (`libc/shared`, `libc/src/__support`, `libc/include/llvm-libc-macros`, and `libc/include/llvm-libc-types`) it also depends on `libc/hdr`:
```
In file included from ../../../system/lib/libcxx/src/charconv.cpp:12:
In file included from ../../../system/lib/libcxx/src/include/from_chars_floating_point.h:13:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/shared/fp_bits.h:12:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/FPUtil/FPBits.h:18:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/CPP/bit.h:14:
/usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/CPP/limits.h:12:10: fatal error: 'hdr/limits_macros.h' file not found                
   12 | #include "hdr/limits_macros.h" // CHAR_BIT                               
      |          ^~~~~~~~~~~~~~~~~~~~~                                           
1 error generated.         
```
Also even on `src/errno`:
```
In file included from ../../../system/lib/libcxx/src/charconv.cpp:12:            
In file included from ../../../system/lib/libcxx/src/include/from_chars_floating_point.h:14:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/shared/str_to_float.h:12:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/str_to_float.h:27:
In file included from /usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/high_precision_decimal.h:21:                                   
/usr/local/google/home/aheejin/emscripten/system/lib/llvm-libc/src/__support/str_to_integer.h:27:10: fatal error: 'src/errno/libc_errno.h' file not found         
   27 | #include "src/errno/libc_errno.h" // For ERANGE                          
      |          ^~~~~~~~~~~~~~~~~~~~~~~~                                        
2 errors generated.  
```

So I'm wondering, is this dependency an intended behavior, or is this something that should be fixed?
Thank you.

https://github.com/llvm/llvm-project/pull/91651


More information about the libc-commits mailing list