Julia Installation on RISC-V (Build Failing at 79%)

I’m trying to build Julia from source for the RISC-V architecture by following the guide provided here: julia/doc/src/devdocs/build/riscv.md at master · alexfanqi/julia · GitHub.

I’m running the script located in my RISC-V environment: build-julia-riscv.sh, but the build process has stopped at 79% with the following error:

collect2: error: ld returned 1 exit status
make[4]: *** [tools/llvm-shlib/CMakeFiles/LLVM.dir/build.make:240: lib/libLLVM-14jl.so] Error 1
make[4]: Leaving directory '/home/user/julia/deps/scratch/llvm-julia-14.0.6-0/build_Release'
make[3]: *** [CMakeFiles/Makefile2:25382: tools/llvm-shlib/CMakeFiles/LLVM.dir/all] Error 2
make[3]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/user/julia/deps/scratch/llvm-julia-14.0.6-0/build_Release'
[ 79%] Built target llvm-exegesis
make[3]: Leaving directory '/home/user/julia/deps/scratch/llvm-julia-14.0.6-0/build_Release'
make[2]: *** [Makefile:159: all] Error 2
make[2]: Leaving directory '/home/user/julia/deps/scratch/llvm-julia-14.0.6-0/build_Release'
make[1]: *** [/home/user/julia/deps/llvm.mk:250: scratch/llvm-julia-14.0.6-0/build_Release/build-compiled] Error 2
make[1]: Leaving directory '/home/user/julia/deps'
make: *** [Makefile:75: julia-deps] Error 2

I’ve already tried the basic debugging steps, including ensuring all dependencies are installed and checking system resources. Despite this, the build keeps failing.

I would really appreciate any guidance on:

  1. How to resolve this specific linking issue.
  2. Whether there are any pre-built Julia binaries or installation packages for the RISC-V architecture that I can use.

Thanks in advance for any help or suggestions!

2 Likes

I suspect the actual error was before the portion you copied. To be clear your build is failing at building llvm.

2 Likes

While I do see in the 2-year-old docs (has there much work been done since? RISC-V support was incomplete then):

Currently, this fork is compiling okay and seems to work fine.

I note that it used patched LLVM 14, and Julia is now at LLVM 18 or 19. It might help, actually, or hurt?

Two years ago is Julia 1.7-1.8 timeframe, and you might start with trying to build such Julia (i.e. some that uses LLVM 14). If you hit success, it might do for you, or then I would try 1.8, 1.9 etc.

RISC-V isn’t yet an officially-supported platform, thus no official binaries, nor unofficial that I know of (i.e. under “General usage” maybe misleading, rather go under internals category?), so unless you really need it, or want to help with it working, why are you using it?

You usually do not have to build Julia from source. It’s only for advanced/developer use, not for beginner Julia users. Not saying you are, maybe you want to help with RISC-V.

RISC-V has no official support tier, not even tier 3, maybe that would have been appropriate at the time, I’m guessing now (unofficial) tier 4 (only 1.10 is now stable version, older no longer supported, 1.10 will become LTS, and then likely 1.6 dropped as LTS soon, I’m even unclear on if 1.6 ever ran RISC-V):

  • Tier 3: Julia may or may not build. If it does, it is unlikely to pass tests. Binaries may be available in some cases. When they are, they should be considered experimental. Ongoing support is dependent on community efforts.
  • Tier 4: Julia built at some point in the past, but is known not to build currently.
2 Likes

I’m having a look at rebasing that branch, and should have a PR ready in a couple of days.

4 Likes
7 Likes

After reading

I was wondering if that’s the time that took you to compile everything :sweat_smile:

1 Like

A significant part of it, yeah; compiling LLVM on my VisionFive2 is a real doozy! I’ve kicked off a binary-dist build now, with a more conservative rv64gc target, so I should be able to share that here… in a couple of days :sweat_smile:

2 Likes

is it faster to compile on the VisionFive2 or on a VM?

A VM is probably faster; I didn’t bother setting one up (which is always a bit annoying since how Julia’s build system really expects the ability to execute binaries). It’s just chugging along in the background.

1 Like