{"id":15101448,"url":"https://github.com/codewithmirza/sample4","last_synced_at":"2026-01-19T21:33:43.097Z","repository":{"id":254061758,"uuid":"778757994","full_name":"codewithmirza/sample4","owner":"codewithmirza","description":"compiling libclang from the llvm repository to WASM.","archived":false,"fork":false,"pushed_at":"2024-04-02T19:42:48.000Z","size":45179,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T10:44:00.233Z","etag":null,"topics":["c","cpp","libclang","llvm","webassembly"],"latest_commit_sha":null,"homepage":"","language":null,"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/codewithmirza.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":"Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3.c.o","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-28T10:46:44.000Z","updated_at":"2024-08-21T04:56:53.000Z","dependencies_parsed_at":"2024-08-21T07:04:58.645Z","dependency_job_id":null,"html_url":"https://github.com/codewithmirza/sample4","commit_stats":null,"previous_names":["codewithmirza/sample4"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codewithmirza/sample4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmirza%2Fsample4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmirza%2Fsample4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmirza%2Fsample4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmirza%2Fsample4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithmirza","download_url":"https://codeload.github.com/codewithmirza/sample4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmirza%2Fsample4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28585518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T20:45:59.482Z","status":"ssl_error","status_checked_at":"2026-01-19T20:45:41.500Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["c","cpp","libclang","llvm","webassembly"],"created_at":"2024-09-25T18:23:09.419Z","updated_at":"2026-01-19T21:33:43.077Z","avatar_url":"https://github.com/codewithmirza.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compiling libclang from the llvm repository to WASM.\n\n## Prerequisites\n- Install Emscripten: Ensure you have Emscripten installed and set up on your system. You can download and install it from the official Emscripten website.\n- Clone the llvm-project from LLVM Repository.\n- Install Ninja `sudo install Ninja`\n\n## Steps\n\n1. **Create Build Directory**:\n   - Before configuring LLVM/Clang, create a build directory named `build.emscripten`:\n     ```\n     mkdir build.emscripten\n     ```\n\n2. **Configure LLVM/Clang with Emscripten**:\n   - Run the following command to configure LLVM/Clang with Emscripten:\n     ```\n     emcmake cmake -S llvm -B build.emscripten -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='llvm;clang;clang-tools-extra' -DCMAKE_EXPORT_COMPILE_COMMANDS=on -DCMAKE_LINKER=\"/mnt/d/emscripten/emsdk/upstream/bin/lld\" -DLLVM_TARGET_TRIPLE=\"wasm32-unknown-emscripten\"\n     ```\n\n3. **Build LLVM/Clang with Emscripten**:\n   - Run the following command to build LLVM/Clang with Emscripten:\n     ```\n     cmake --build build.emscripten --target libclang\n     ```\n\n4. **Extract `libclang.a`**:\n   - After the build process is complete, extract `libclang.a` from the LLVM/Clang build directory:\n     ```\n     ar x build.emscripten/lib/libclang.a\n     ```\n\n5. **Compile `libclang.a` to `libclang.wasm`**:\n   - Change to the lib directory and use Emscripten's `emcc` compiler to compile `libclang.a` to WebAssembly:\n     ```\n     cd build.emscripten/lib\n     emcc -o libclang.wasm *.o --no-entry\n     ```\n\n6. **Locate `libclang.wasm`**:\n   - After compiling, you can find the resulting `libclang.wasm` file in the `build.emscripten/lib` directory.\n\n## Additional Notes\n- Be sure to check the Emscripten documentation for any specific configuration options or considerations when compiling C/C++ code to WebAssembly.\n- Experiment with different build configurations and options to optimize performance and compatibility for your specific use case.\n\n## Files in the `libclang` Folder Before Process\n```\nDirectory: D:\\llvm-project\\clang\\tools\\libclang\n\nMode                          File Name\n----                 -------------         ------ ----\n-a----                     ARCMigrate.cpp\n-a----                     BuildSystem.cpp\n-a----                   CIndex.cpp\n-a----                  CIndexCodeCompletion.cpp\n-a----                    CIndexCXX.cpp\n...\n...\n-a----                     CXType.cpp\n-a----                     CXType.h\n-a----              FatalErrorHandler.cpp\n-a----                    Indexing.cpp\n-a----                    Index_Internal.h\n-a----                    libclang.map\n-a----          linker-script-to-export-list.py\n-a----                     Rewrite.cpp\n----                 -------------         ------ ----\n```\n## Files in `build.emscripten/lib` folder after build/configuration process\n```\nDirectory: D:\\llvm-project\\clang\\tools\\libclang\n\nMode                          File Name\n----                 -------------         ------ ----\n-a----                     ARCMigrate.cpp.o\n-a----                     BuildSystem.cpp.o\n-a----                   CIndex.cpp.o\n-a----                  CIndexCodeCompletion.cpp.o\n-a----                    CIndexCXX.cpp.o\n...\n...\n-a----                     CXType.cpp.o\n-a----                     CXType.h.o\n-a----              FatalErrorHandler.cpp.o\n-a----                    Indexing.cpp.o\n-a----                    Index_Internal.h.o\n-a----                    libclang.map.o\n-a----          linker-script-to-export-list.py.o\n-a----                     Rewrite.cpp.o\n----                 -------------         ------ ----\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmirza%2Fsample4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithmirza%2Fsample4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmirza%2Fsample4/lists"}