Building Julia with the latest LLVM

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

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

 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

 # 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

1 Like

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.

3 Likes

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 and Fixes for armv7l buildbots by staticfloat · Pull Request #51945 · JuliaLang/julia · GitHub, 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.

1 Like

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.

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

3 Likes