{"id":20245564,"url":"https://github.com/noloader/build-llvm","last_synced_at":"2025-10-14T19:33:18.693Z","repository":{"id":80169940,"uuid":"157818196","full_name":"noloader/build-llvm","owner":"noloader","description":"Recipes to download and build LLVM, Clang front end and Compiler-RT from sources","archived":false,"fork":false,"pushed_at":"2019-09-22T05:59:40.000Z","size":102,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-21T04:40:15.369Z","etag":null,"topics":["clang","llvm"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/noloader.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}},"created_at":"2018-11-16T05:41:06.000Z","updated_at":"2024-06-12T22:35:01.000Z","dependencies_parsed_at":"2023-03-03T23:15:48.700Z","dependency_job_id":null,"html_url":"https://github.com/noloader/build-llvm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/noloader/build-llvm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noloader%2Fbuild-llvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noloader%2Fbuild-llvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noloader%2Fbuild-llvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noloader%2Fbuild-llvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noloader","download_url":"https://codeload.github.com/noloader/build-llvm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noloader%2Fbuild-llvm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020649,"owners_count":26086898,"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-14T02:00:06.444Z","response_time":60,"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":["clang","llvm"],"created_at":"2024-11-14T09:22:05.380Z","updated_at":"2025-10-14T19:33:18.659Z","avatar_url":"https://github.com/noloader.png","language":"Shell","readme":"# Build LLVM\n\nRecipes to download and build LLVM, Compiler front end and Compiler-RT from sources. The script builds the latest LLVM from release tarballs, which is currently version 7.0. The script also patches the LLVM 7.0 sources for PowerPC Issue 39704, [Vector load/store builtins overstate alignment of pointers](https://bugs.llvm.org/show_bug.cgi?id=39704) (see [Review D54787](https://reviews.llvm.org/D54787)).\n\nTesting on Fedora, Ubuntu, CentOS and PowerPC reveals no `LD_LIBRARY_PATH` is needed to run an executable. LLVM fails to build on a old Apple PowerMac G5.\n\nLLVM requires CMake 3.4.3 or above, and GCC 4.8.5 or above. Be sure you meet the prerequisites.\n\n# Variables\n\nThere are several variables of interest you can tune for the build. `BS_` stands for `BUILD_SCRIPT`.\n\n* `CMAKE` - the tool to use for CMake. The default value is `cmake`.\n* `BS_INSTALL_PREFIX` - the installation directory. The default value is `/opt/llvm`.\n* `BS_SOURCE_DIR` - scratch directory to download an unpack the sources. The default value is `$HOME/llvm_source`. The scripts adds the `llvm/` tail, so you should not add it.\n* `BS_BUILD_DIR` - scratch directory to build the the sources. Output artifacts are in this directory. The default value is `$HOME/llvm_build`.\n* `BS_MAKE_JOBS` - the number of concurrent make jobs. The default value is `4`.\n* `BS_TOOLS` - controls compiler-rt. The default value is `ON`.\n* `BS_LIBCXX` - controls libcxx and libcxxabi. The default value is `OFF` because building libc++ mostly does not work.\n* `BS_TESTS` - controls the Test Suite. The Test Suite is a different download and more comprehensive than check. The default value is `ON`.\n\n# Building the sources\n\n`./build-llvm.sh` is all that is required to download and build the LLVM sources. You will have to manually install Clang after you build it. The script honors alternate compilers, and you can pass them to CMake using:\n\n```\n# Attempt to build on PowerMac with MacPorts GCC\nCC=/opt/local/bin/gcc-mp-5 CXX=/opt/local/bin/g++-mp-5 ./build-llvm.sh\n```\n\nAnd if you need an alternate CMake to satisfy LLVM requirements:\n\n```\nCMAKE=/opt/local/bin/cmake ./build-llvm.sh\n```\n\nAnd more options:\n\n```\n    CMAKE=\"$HOME/cmake/bin/cmake\" \\\n    PREFIX=\"$HOME/llvm\" \\\n    BS_LIBCXX=\"ON\" \\\n    BS_TESTS=\"OFF\" \\\n    BS_COMPILE_JOBS=\"8\" \\\n./build-llvm.sh\n```\n\n# Installing the toolchain\n\nYou have to manually install the LLVM toolchain after building it, if desired. Perform the following steps to install the toolchain:\n\n```\n# Defaults to $HOME/llvm_build\ncd \"$BS_BUILD_DIR\"\nsudo make install\n```\n\nYou can also delete `BS_SOURCE_DIR` and `BS_BUILD_DIR` after installation. The defaults for `BS_SOURCE_DIR` and `BS_BUILD_DIR` and `$HOME/llvm_build` and `$HOME/llvm_source`, respectively.\n\n# libc++\n\nThe libcxx and libcxxabi recipes are mostly broken. There's a problem with a missing symbol called `__thread_local_data()`. We don't know how to work around it, and our LLVM mailing list questions have not been answered. Also see https://stackoverflow.com/q/53356172/608639 and https://stackoverflow.com/q/53459921/608639.\n\nIf you want to attempt to build libcxx and libcxxabi then set `BS_LIBCXX=ON`. On PowerPC and Solaris we unconditionally set `BS_LIBCXX=OFF` because we know it breaks us.\n\n# Building CMake\n\nLLVM requires CMake 3.4.3 or higher. You can use `build-cmake.sh` to update CMake if needed. The script builds in the `cmake_build` directory and installs itself at `$HOME/cmake`. You can change the variables by editing the top of the script.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoloader%2Fbuild-llvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoloader%2Fbuild-llvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoloader%2Fbuild-llvm/lists"}