{"id":27230543,"url":"https://github.com/algorithm0/modules-and-pch-libcxx-bug","last_synced_at":"2025-10-12T01:10:14.552Z","repository":{"id":286814319,"uuid":"962604854","full_name":"Algorithm0/modules-and-pch-libcxx-bug","owner":"Algorithm0","description":"This repository contains an example of a problem with using C++ modules and precompiled headers when using libc++","archived":false,"fork":false,"pushed_at":"2025-04-08T14:30:38.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T13:52:10.169Z","etag":null,"topics":["bug","clang","cxx","cxx20","cxx20-library","cxx20-modules","libcxx","llvm"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Algorithm0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-08T12:03:17.000Z","updated_at":"2025-04-08T14:30:42.000Z","dependencies_parsed_at":"2025-04-10T13:45:04.313Z","dependency_job_id":null,"html_url":"https://github.com/Algorithm0/modules-and-pch-libcxx-bug","commit_stats":null,"previous_names":["algorithm0/modules-and-pch-libcxx-bug"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Algorithm0/modules-and-pch-libcxx-bug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algorithm0%2Fmodules-and-pch-libcxx-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algorithm0%2Fmodules-and-pch-libcxx-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algorithm0%2Fmodules-and-pch-libcxx-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algorithm0%2Fmodules-and-pch-libcxx-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Algorithm0","download_url":"https://codeload.github.com/Algorithm0/modules-and-pch-libcxx-bug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algorithm0%2Fmodules-and-pch-libcxx-bug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009683,"owners_count":26084645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bug","clang","cxx","cxx20","cxx20-library","cxx20-modules","libcxx","llvm"],"created_at":"2025-04-10T13:24:21.302Z","updated_at":"2025-10-12T01:10:14.545Z","avatar_url":"https://github.com/Algorithm0.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Potential Issue with libc++ and C++ Modules and Precompiled Headers\n\nThis repository demonstrates a potential issue when using C++ modules and precompiled headers with LLVM's libc++ standard library implementation.\n\n## CMake Configuration Options\n\n#### `USE_PCH`\n- **Type**: `ON`/`OFF`\n- **Default**: `OFF`\n- **Description**: Enables precompiled headers configuration when set to `ON`.\n\n#### `USE_STD_FORMAT`\n- **Type**: `ON`/`OFF`\n- **Default**: `OFF`\n- **Description**: Enables string output using `std::format` for library standard testing.\n\n## Test Results\n\n| Standard Library Implementation | clang 19.1.7 (Fedora) | clang 21.0.0 (git) |\n|---------------------------------|-----------------------|--------------------|\n| **libstdc++ 14.2.1 (Fedora)**   | OK                    | OK                 |\n| **libc++ 19.1.7 (Fedora)**      | Error                 | Error              |\n| **libc++ 21.0.0 (git)**         | Error                 | Error              |\n\n## Build Configurations\n\n### Compiler Settings\n\n**clang 19.1.7 (Fedora 19.1.7-3.fc41)**\n```bash\nCOMPILER_CONFIG=\"-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_CLANG_SCAN_DEP=clang-scan-deps\"\n```\n**clang 21.0.0 (git [148111fdcf0e807fe74274b18fcf65c4cff45d63](https://github.com/llvm/llvm-project/commit/148111fdcf0e807fe74274b18fcf65c4cff45d63))**\n```bash\nCOMPILER_CONFIG=\"-DCMAKE_C_COMPILER=${LLVM_21}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_21}/bin/clang++ -DCMAKE_CXX_COMPILER_CLANG_SCAN_DEP=${LLVM_21}/bin/clang-scan-deps\"\n```\n\n###  Standard Library Settings\n\n**libstdc++ 14.2.1 (Fedora 14.2.1-7.fc41)**\n```bash\nSTDLIB_CONFIG=\"\"\n```\n\n**libc++ 19.1.7 (Fedora 19.1.7-1.fc41)**\n```bash\nSTDLIB_CONFIG=\"-DCMAKE_EXE_LINKER_FLAGS_INIT='-stdlib=libc++' -DCMAKE_CXX_FLAGS='-stdlib++-isystem/usr/include/c++/v1'\"\n```\n\n**libc++ 21.0.0 (git [148111fdcf0e807fe74274b18fcf65c4cff45d63](https://github.com/llvm/llvm-project/commit/148111fdcf0e807fe74274b18fcf65c4cff45d63))**\n```bash\nSTDLIB_CONFIG=\"-DCMAKE_EXE_LINKER_FLAGS_INIT='-stdlib=libc++' \\\n               -DCMAKE_CXX_FLAGS='-stdlib++-isystem${LLVM_21}/include/c++/v1 -isystem${LLVM_21}/include/x86_64-unknown-linux-gnu/c++/v1' \\\n               -DCMAKE_CXX_STANDARD_LIBRARIES='-L${LLVM_21}/lib/x86_64-unknown-linux-gnu -lc++ -lc++abi'\"\n```\n\n### Building the Project\n```bash\nmkdir build\neval \" cmake ${STDLIB_CONFIG} ${COMPILER_CONFIG} -DUSE_PCH=ON -G Ninja -B build\"\nninja -C build -v\n```\n\n## Additional Observations\nThe build succeeds in all configurations when precompiled headers are disabled (`-DUSE_PCH=OFF`).\\\nThe corresponding [issue](https://github.com/llvm/llvm-project/issues/134855) is open in the [LLVM repository](https://github.com/llvm/llvm-project/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgorithm0%2Fmodules-and-pch-libcxx-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgorithm0%2Fmodules-and-pch-libcxx-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgorithm0%2Fmodules-and-pch-libcxx-bug/lists"}