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

**URL:** https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047
**Category:** General Usage
**Tags:** installation, risc-v
**Created:** [October 8, 2024, 5:20am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047 "2024-10-08T05:20:23Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![karthick-govindaraj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karthick-govindaraj/32/212492_2.png) [@karthick-govindaraj](https://discourse.julialang.org/u/karthick-govindaraj)
#### Post date: [October 8, 2024, 5:20am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/1 "2024-10-08T05:20:23Z")

</div>

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](https://github.com/alexfanqi/julia/blob/master/doc/src/devdocs/build/riscv.md).

I’m running the script located in my RISC-V environment: [build-julia-riscv.sh](https://github.com/alexfanqi/julia/tree/master/doc/src/devdocs/build/build-julia-riscv.sh), but the build process has stopped at 79% with the following error:

```julia
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!

---

<div class="post-metadata">

### Author: ![Zentrik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zentrik/32/35409_2.png) [@Zentrik](https://discourse.julialang.org/u/Zentrik)
#### Post date: [October 8, 2024, 6:13am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/2 "2024-10-08T06:13:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [October 8, 2024, 9:16am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/3 "2024-10-08T09:16:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 9, 2024, 6:35pm UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/4 "2024-10-09T18:35:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 11, 2024, 10:15am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/5 "2024-10-11T10:15:03Z")

</div>

> <https://github.com/JuliaLang/julia/pull/56105>
>
> Rebase and extension of @alexfanqi's initial work on porting Julia to RISC-V.
> 
> …
> Tested on a VisionFive2, built with:
> 
> \`\`\`make
> MARCH := rv64gc\_zba\_zbb
> MCPU := sifive-u74
> 
> USE\_BINARYBUILDER:=0
> 
> DEPS\_GIT = llvm
> override LLVM\_VER=19.1.1
> override LLVM\_BRANCH=julia-release/19.x
> override LLVM\_SHA1=julia-release/19.x
> \`\`\`
> 
> \`\`\`julia-repl
> ❯ ./julia
> \_
> \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org
> (\_) | (\_) (\_) |
> \_ \_ \_| |\_ \_\_ \_ | Type "?" for help, "\]?" for Pkg help.
> | | | | | | |/ \_\` | |
> | | |\_| | | | (\_| | | Version 1.12.0-DEV.1363 (2024-10-10)
> \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | riscv/bde5e4e2cb\* (fork: 26 commits, 1 day)
> |\_\_/ |
> 
> julia\> versioninfo(; verbose=true)
> Julia Version 1.12.0-DEV.1363
> Commit bde5e4e2cb\* (2024-10-10 12:19 UTC)
> Platform Info:
> OS: Linux (riscv64-linux-gnu)
> uname: Linux 6.11.0-1-riscv64 #1 SMP Debian 6.11.0-1 (2024-09-15) riscv64 unknown
> CPU: unknown:
> speed user nice sys idle irq
> #1 1500 MHz 19950 s 2 s 8918 s 592659 s 0 s
> #2 1500 MHz 22908 s 0 s 11573 s 587279 s 0 s
> #3 1500 MHz 25817 s 19 s 12266 s 583668 s 0 s
> #4 1500 MHz 21483 s 0 s 10650 s 590572 s 0 s
> Memory: 7.758296966552734 GB (5073.27734375 MB free)
> Uptime: 62472.43 sec
> Load Avg: 2.56 2.29 2.21
> WORD\_SIZE: 64
> LLVM: libLLVM-19.1.1 (ORCJIT, sifive-u74)
> Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
> \`\`\`
> 
> Lots of bugs guaranteed, but with this we at least have a functional build and REPL for further development by whoever is interested 🙂 
> 
> Depends on https://github.com/JuliaLang/julia/pull/55650.

---

<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: [October 11, 2024, 10:53am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/6 "2024-10-11T10:53:58Z")

</div>

> [@maleadt](#):
>
> should have a PR ready in a couple of days.

After reading

> <https://github.com/JuliaLang/julia/blob/0a92fecc124a630377277b98e70d8764cf08c24c/doc/src/devdocs/build/riscv.md?plain=1#L43>

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

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 11, 2024, 12:32pm UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/7 "2024-10-11T12:32:53Z")

</div>

> [@giordano](#):
>
> I was wondering if that’s the time that took you to compile everything 😅

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 😅

---

<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: [October 11, 2024, 2:14pm UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/8 "2024-10-11T14:14:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 11, 2024, 2:24pm UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/9 "2024-10-11T14:24:04Z")

</div>

A cross-compiler 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.

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 12, 2024, 7:16am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/10 "2024-10-12T07:16:01Z")

</div>

Here’s a build: [Release v1.12-0a92fecc12 · maleadt/julia · GitHub](https://github.com/maleadt/julia/releases/tag/v1.12-0a92fecc12)

---

<div class="post-metadata">

### Author: ![karthick-govindaraj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karthick-govindaraj/32/212492_2.png) [@karthick-govindaraj](https://discourse.julialang.org/u/karthick-govindaraj)
#### Post date: [October 14, 2024, 5:46am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/11 "2024-10-14T05:46:14Z")

</div>

Hi @maleadt ,

I’m trying to install your build on my VisionFive 2 board, but I’m encountering a GLIBC compatibility error. Here’s the output I’m getting:

```julia
$ ./julia --version
ERROR: Unable to load dependent library /home/user/julia-0a92fecc12/bin/../lib/julia/libstdc++.so.6
Message:/lib/riscv64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /home/user/julia-0a92fecc12/bin/../lib/ju

$ ldd --version
ldd (Debian GLIBC 2.36-6) 2.36

```

It seems that the version of GLIBC on my system is 2.36, while the build requires GLIBC 2.38. Could you please guide me on how to resolve this issue? Are there any specific versions of Julia that are compatible with GLIBC 2.36, or would it be better to compile Julia from source?

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 14, 2024, 5:49am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/12 "2024-10-14T05:49:09Z")

</div>

That’s what I mentioned in the release notes:

> Built on Debian Trixie, so requires glibc 2.40.

There’s no easy way to build for an older `glibc` version, so I won’t be able to easily provide a more compatible build. Even the cross-build environment I’ve just set-up using [GitHub - riscv-collab/riscv-gnu-toolchain: GNU toolchain for RISC-V, including GCC](https://github.com/riscv-collab/riscv-gnu-toolchain) is already using glibc 2.40. I’ll try downgrading glibc in there, but no guarantees.

---

<div class="post-metadata">

### Author: ![karthick-govindaraj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karthick-govindaraj/32/212492_2.png) [@karthick-govindaraj](https://discourse.julialang.org/u/karthick-govindaraj)
#### Post date: [October 14, 2024, 6:03am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/13 "2024-10-14T06:03:56Z")

</div>

Thank you for the update! Would it be possible for you to generate a compatible version of Julia that supports GLIBC version 2.36 in visionfive? That would be incredibly helpful for us, as compiling the source of Julia directly on the VisionFive 2 board takes more than two days.

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 14, 2024, 8:07am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/14 "2024-10-14T08:07:21Z")

</div>

Not easily; [the build I attempted for glibc 2.36](https://github.com/maleadt/julia/releases/tag/v1.12-dfe2386bfb) doesn’t execute here on device, and I don’t have the time to debug this. You’ll probably have to build it yourself.

---

<div class="post-metadata">

### Author: ![karthick-govindaraj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karthick-govindaraj/32/212492_2.png) [@karthick-govindaraj](https://discourse.julialang.org/u/karthick-govindaraj)
#### Post date: [October 14, 2024, 9:52am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/15 "2024-10-14T09:52:28Z")

</div>

Thanks a lot @maleadt ! I have installed it and tested it with a “Hello, World!” program, which is working fine. I will continue to test further.

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 14, 2024, 9:56am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/16 "2024-10-14T09:56:10Z")

</div>

Interesting; it fails here during module deserialization with a relocation-related error. Glad to see it works for you, at least.

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 14, 2024, 11:37am UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/17 "2024-10-14T11:37:51Z")

</div>

I cannot imagine that build working for you, at least not on a VisionFive2. The build of the JuliaSyntaxHighlighting stdlib (which gets loaded as soon as you start the REPL) contains instructions that are not supported on that device:

```julia
❯ objdump -d share/julia/compiled/v1.12/JuliaSyntaxHighlighting/lOBbc_7PawL.so | grep -i "vlenb"
    cda2:	c2202673 csrr	a2,vlenb

```

Well, the `csrr` as part of Zicsr is, but the `vlenb` CSR is only available with Rvv. I’m not sure where this comes from, as I’m building with `-march` and Julia’s `-C` set to `rv64gc`. Maybe we’re not correctly forwarding `-C` to some of the package image builds…

EDIT: that hypothesis seems correct, [Fix `JULIA_CPU_TARGET` being propagated to workers precompiling stdlib pkgimages by KristofferC · Pull Request #54093 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/54093)

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [October 14, 2024, 1:53pm UTC](https://discourse.julialang.org/t/julia-installation-on-risc-v-build-failing-at-79/121047/18 "2024-10-14T13:53:31Z")

</div>

With the fix from @kristoffer.carlsson applied, here’s a fully-functional (minus bugs, of course) glibc 2.36 build: [Release v1.12-25092a3982 · maleadt/julia · GitHub](https://github.com/maleadt/julia/releases/tag/v1.12-25092a3982)
