# Building Julia with the latest LLVM

**URL:** https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395
**Category:** Internals & Design
**Tags:** llvm, arm
**Created:** [January 29, 2024, 1:29pm UTC](https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395 "2024-01-29T13:29:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![eymay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eymay/32/206613_2.png) [@eymay](https://discourse.julialang.org/u/eymay)
#### Post date: [January 29, 2024, 1:29pm UTC](https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395/1 "2024-01-29T13:29:40Z")

</div>

Hi,  
I would like to build Julia for ARM and run it on Raspberry Pi 4 in 32 bit mode. I am quite new to Julia and would like to ask if my current config direction is correct.

`Make.user`

```julia
DEPS_GIT = llvm
USE_BINARYBUILDER_LLVM = 0
LLVM_GIT_URL = https://github.com/llvm/llvm-project.git
LLVM_BRANCH = main
#SHA hash of the alterate commit to check out automatically
LLVM_SHA1 = $(LLVM_BRANCH)
#Use ccache for faster recompilation in case you need to restart a build.
USECCACHE = 1
CMAKE_GENERATOR=Ninja
LLVM_ASSERTIONS=1
LLVM_DEBUG=Symbols
LLVM_TARGETS += "ARM"

```

Some variables don’t seem to overwrite so I also modified `llvm.version` and `llvm.mk`

`deps/llvm.mk`

```Makefile
 ifneq ($(USE_BINARYBUILDER_LLVM), 1)
-LLVM_GIT_URL:=https://github.com/JuliaLang/llvm-project.git
-LLVM_TAR_URL=https://api.github.com/repos/JuliaLang/llvm-project/tarball/$1
 $(eval $(call git-external,llvm,LLVM,CMakeLists.txt,,$(SRCCACHE)))

```

`deps/llvm.version`

```Makefile
 # Version number of LLVM
 LLVM_VER := 15.0.7
 # Git branch name in `LLVM_GIT_URL` repository
-LLVM_BRANCH=julia-15.0.7-10
+LLVM_BRANCH=main
 # Git ref in `LLVM_GIT_URL` repository
-LLVM_SHA1=julia-15.0.7-10
+LLVM_SHA1=$(LLVM_BRANCH)

 ## Following options are used to automatically fetch patchset from Julia's fork. This is
 ## useful if you want to build an external LLVM while still applying Julia's patches.
 # Set to 1 if you want to automatically apply Julia's patches to a different fork of LLVM.
-LLVM_APPLY_JULIA_PATCHES := 0
+LLVM_APPLY_JULIA_PATCHES := 1

```

Best,  
Eymen

Ping: @vchuravy @staticfloat

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [January 29, 2024, 1:34pm UTC](https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395/2 "2024-01-29T13:34:25Z")

</div>

This is very unlikely to work. LLVM has breaking changes roughly twice a year so you should not expect building Julia with the latest LLVM to work. you almost always should use the default julia-LLVM branch.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [January 29, 2024, 1:38pm UTC](https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395/3 "2024-01-29T13:38:56Z")

</div>

In addition to using latest LLVM version requiring substantial changes because of frequent API breakage in libLLVM, note that Julia has been broken on 32-bit ARM for some time, see for example [Julia cannot be compiled anymore on 32bit ARM Linux plus glibc · Issue #47345 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/47345) and [Fixes for armv7l buildbots by staticfloat · Pull Request #51945 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/51945), independently of the version of LLVM used. Of course you’re more than welcome to help fixing this issue if you care about this platform, there aren’t enough people looking into this issue.

---

<div class="post-metadata">

### Author: ![eymay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eymay/32/206613_2.png) [@eymay](https://discourse.julialang.org/u/eymay)
#### Post date: [January 29, 2024, 2:00pm UTC](https://discourse.julialang.org/t/building-julia-with-the-latest-llvm/109395/4 "2024-01-29T14:00:44Z")

</div>

Thanks for the quick replies. I would be happy to contribute this effort as we develop the JITLink ARM backend currently and some errors seem to be LLVM related.

> [@giordano](#):
>
> [Fixes for armv7l buildbots by staticfloat · Pull Request #51945 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/51945)

Thanks for pointing out the PR! Although I checked out its branch, I can write to PR if anything happens.
