# Problem installing prerequisites for building Julia

**URL:** <https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128>\
**Category:** General Usage\
**Tags:** build\
**Created:** [October 18, 2023, 2:41pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128 "2023-10-18T14:41:04Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 18, 2023, 2:41pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/1 "2023-10-18T14:41:04Z")

</div>

The [README](https://github.com/JuliaLang/julia#building-julia) for the official julia repo links to [this](https://github.com/JuliaLang/julia/blob/master/doc/src/devdocs/build/build.md#required-build-tools-and-external-libraries) set of instructions for building julia. The latter link states that

> On Debian-based distributions (e.g. Ubuntu), you can easily install them with `apt-get`:  
> `sudo apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config curl`

However, when I run those commands (on a raspberry pi) I get the following error:

```julia
pi@raspberrypi:~/julia $ sudo apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python-is-python3 2to3

E: Package 'python' has no installation candidate

```

When I call `python` from the command line, python 3.11.2 opens up just fine:

```python
pi@raspberrypi:~/julia $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

```

Should the error that occurs when installing prerequisites just be ignored? The build later went on to fail, and I keep getting errors of the type seen in the screenshot below:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/c/2c762fd0e6e87c8a8d53f9169a817d001d0aa407.png)

My use-case is that I need a later version of julia on a raspberry pi on order to use functionality implemented after 1.6.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [October 18, 2023, 3:05pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/2 "2023-10-18T15:05:09Z")

</div>

Perhaps a symlink for python3 in /usr/bin? I think that is how the build tools call it. Or perhaps in your apt install line, just change `python` to `python3`?

Raspberry Pi does a lot of custom things … but then again so do most distros. On WSL2 (specifically, the Ubuntu one), calling `python3` gives you a symlink to `/usr/bin/python3.10`

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 18, 2023, 3:08pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/3 "2023-10-18T15:08:49Z")

</div>

I end up getting the following error:

> ****
>
> ```julia
> Copying in usr/share/man/man1/julia.1
> /home/pi/julia/contrib/install.sh 755 /home/pi/julia/contrib/julia-config.jl /home/pi/julia/usr/share/julia/
> PERL base/pcre_h.jl
> PERL base/errno_h.jl
> PERL base/build_h.jl.phony
> PERL base/features_h.jl
> PERL base/features_h.jl
> PERL base/features_h.jl
> PERL base/file_constants.jl
> PERL base/uv_constants.jl
> PERL base/version_git.jl.phony
> CC cli/loader_exe.o
> CC cli/loader_lib.o
> CC cli/loader_trampolines.o
> LINK usr/lib/libjulia.so.1.9
> LINK usr/lib/libjulia.so.1
> LINK usr/lib/libjulia.so
> LINK usr/bin/julia
> CC src/support/hashing.o
> CC src/support/timefuncs.o
> CC src/support/ptrhash.o
> CC src/support/operators.o
> CC src/support/utf8.o
> CC src/support/ios.o
> CC src/support/htable.o
> CC src/support/bitvector.o
> CC src/support/int2str.o
> CC src/support/libsupportinit.o
> CC src/support/arraylist.o
> CC src/support/strtod.o
> CC src/support/rle.o
> LINK src/support/libsupport.a
> CC src/flisp/flisp.o
> CC src/flisp/builtins.o
> CC src/flisp/string.o
> CC src/flisp/equalhash.o
> CC src/flisp/table.o
> CC src/flisp/iostream.o
> CC src/flisp/julia_extensions.o
> LINK src/flisp/libflisp.a
> CC src/flisp/flmain.o
> LINK src/flisp/flisp
> FLISP src/julia_flisp.boot
> FLISP src/julia_flisp.boot.inc
> CC src/jltypes.o
> CC src/gf.o
> CC src/typemap.o
> CC src/smallintset.o
> CC src/ast.o
> CC src/builtins.o
> CC src/module.o
> CC src/interpreter.o
> CC src/symbol.o
> CC src/dlload.o
> CC src/sys.o
> CC src/init.o
> CC src/task.o
> CC src/array.o
> CC src/staticdata.o
> CC src/toplevel.o
> CC src/jl_uv.o
> CC src/datatype.o
> CC src/simplevector.o
> CC src/runtime_intrinsics.o
> CC src/precompile.o
> CC src/jloptions.o
> CC src/threading.o
> CC src/partr.o
> CC src/stackwalk.o
> /home/pi/julia/src/stackwalk.c: In function 'jl_rec_backtrace':
> /home/pi/julia/src/stackwalk.c:903:24: error: 'bt_context_t' {aka 'struct unw_tdep_context'} has no member named 'uc_mcontext'
> 903 | mcontext_t *mc = &c.uc_mcontext;
> | ^
> make[1]: *** [Makefile:225: stackwalk.o] Error 1
> make: *** [Makefile:78: julia-src-release] Error 2
> 
> ```

Doing into `/usr/bin` and doing `ls` reveals that “python”, “python3” and “python3.11” are defined. Do you think that I need to add another excecutable inside `bin`? Would that explain the error that occurs?

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [October 18, 2023, 7:23pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/4 "2023-10-18T19:23:19Z")

</div>

The error you copied does not look like a Python error … seems like what happened is that `apt` just warned you that it couldn’t find a package named `python` to install, but it didn’t matter, because Raspbian has Python3 installed anyhow. From what you say about `/usr/bin` you don’t need to make any changes there.

The error you listed seems to indicate that the source for stackwalk.c has a problem somewhere near it. I’m running the latest from github, so my source will be different, but the `uc_mcontext` field appears to be a member of `_JUMP_BUFFER`. Grep’ing in the source for that string only yields two files: `win32_ucontext.c` and `stackwalk.c`, but neither appear to define it. Really not sure where it is defined?

How are you downloading and building? I usually just `git clone` the link in GitHub and then `make -j4` to get an executable …

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [October 18, 2023, 10:48pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/5 "2023-10-18T22:48:27Z")

</div>

You should file an issue for this, it sounds like maybe 32-bit ARM is missing an implementation in libunwind (where I suspect `uc_mcontext` comes from).

---

<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 19, 2023, 1:14am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/6 "2023-10-19T01:14:48Z")

</div>

32-bit arm platforms have been broken for a while:

> <https://github.com/JuliaLang/julia/issues/47345>
>
> While trying to update \`libjulia\_jll\` for the latest Julia \`master\` / \`1.9-DEV\` …(see https://github.com/JuliaPackaging/Yggdrasil/pull/5506 resp. 9afd74785845accfb93e4b7c88edc35b59f56f9c), we discovered that support for ARM 32bit builds on Linux is broken, as in: Julia does not compile anymore. This seems to go back to PR #45110 by @vtjnash.
> 
> I'll summarize the error here, further details can be found on the Yggdrasil PR linked above.
> \`\`\`
> \[23:16:44\] /workspace/srcdir/julia/src/stackwalk.c: In function 'jl\_rec\_backtrace':
> \[23:16:44\] /workspace/srcdir/julia/src/stackwalk.c:903:24: error: 'bt\_context\_t {aka struct unw\_tdep\_context}' has no member named 'uc\_mcontext'
> \[23:16:44\] mcontext\_t \*mc = &c.uc\_mcontext;
> \[23:16:44\] ^
> \`\`\`

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 19, 2023, 8:57am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/7 "2023-10-19T08:57:33Z")

</div>

> [@frylock](#):
>
> How are you downloading and building? I usually just `git clone` the link in GitHub and then `make -j4` to get an executable …

I tried installing dependencies, cloning, doing `git checkout v1.9.3`, and running `make`. When that did not work, I tried what is recommended in [jlcross](https://github.com/Julia-Embedded/jlcross). Specifically, there is this section in the readme:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/1/915ab375560c662d865999ad15fe12dace87c12d.png)  
In the comment section of that gist, we are told to put the following content inside `Make.user`:

```julia
MARCH="armv7-a"
LDFLAGS=-latomic
prefix=~/binary_0407

```

That however produces `error: '-mfloat-abi=hard': selected architecture lacks an FPU`.

But it seems like building on raspberry pi has been broken for a year, as seen in the post marked as a solution. I guess I should not expect to get 1.9 or 1.10 running anytime soon.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [October 19, 2023, 12:11pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/8 "2023-10-19T12:11:56Z")

</div>

Hmm, I’m sorry to hear that you are running in to so many problems with that. My RPi is still in a box somewhere … I have a Pi3 … [this blogger](https://funprojects.blog/2022/01/02/julia-programming-on-a-raspberry-pi/) seems to have installed Julia 1.5.3 from the repository on RPi. Perhaps it might be good enough for you though?

Also, I’m sure your search-engine kung-fu is as good as mine, but [this project](https://juliaberry.github.io/) might also have some folks that know how to fix it?

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [October 26, 2023, 4:42am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/9 "2023-10-26T04:42:17Z")

</div>

> [@frylock](#):
>
> [this blogger](https://funprojects.blog/2022/01/02/julia-programming-on-a-raspberry-pi/) seems to have installed Julia 1.5.3 from the repository on RPi. Perhaps it might be good enough for you though?

The official binaries are for 1.6.7, ao the problem is getting a later version than that.

Regarding JuliaBerry, I happen to be the one who made the latest significant commit to the installation instructions 😅 it was their build-instructions I started using.

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 16, 2024, 11:30pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/10 "2024-10-16T23:30:04Z")

</div>

> [@TheLateKronos](#):
>
> ```julia
> /home/pi/julia/src/stackwalk.c: In function 'jl_rec_backtrace':
> /home/pi/julia/src/stackwalk.c:903:24: error: 'bt_context_t' {aka 'struct unw_tdep_context'} has no member named 'uc_mcontext'
> 903 | mcontext_t *mc = &c.uc_mcontext;
> | ^
> make[1]: *** [Makefile:225: stackwalk.o] Error 1
> make: *** [Makefile:78: julia-src-release] Error 2
> 
> ```

I have same the problem when I build Julia v1.10, 1.11 for RaspberryPi3.

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 20, 2024, 8:12am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/11 "2024-10-20T08:12:39Z")

</div>

The following Make.user

```julia
# Make.user
MARCH="armv7-a+neon-vfpv4"

```

and the following patch may solve our problem.

```diff
diff --git a/src/processor_arm.cpp b/src/processor_arm.cpp
index 0d069b085a..6b7279cd21 100644
--- a/src/processor_arm.cpp
+++ b/src/processor_arm.cpp
@@ -1649,13 +1649,15 @@ static void ensure_jit_target(bool imaging)
         auto &features0 = jit_targets[t.base].en.features;
         // Always clone when code checks CPU features
         t.en.flags |= JL_TARGET_CLONE_CPU;
- static constexpr uint32_t clone_fp16[] = {Feature::fp16fml,Feature::fullfp16};
+ /*
+	static constexpr uint32_t clone_fp16[] = {Feature::fp16fml,Feature::fullfp16};
         for (auto fe: clone_fp16) {
             if (!test_nbit(features0, fe) && test_nbit(t.en.features, fe)) {
                 t.en.flags |= JL_TARGET_CLONE_FLOAT16;
                 break;
             }
         }
+	*/
         // The most useful one in general...
         t.en.flags |= JL_TARGET_CLONE_LOOP;
 #ifdef _CPU_ARM_
@@ -1834,7 +1836,7 @@ JL_DLLEXPORT jl_value_t *jl_cpu_has_fma(int bits)
 #else
     TargetData<feature_sz> target = jit_targets.front();
     FeatureList<feature_sz> features = target.en.features;
- if (bits == 32 && test_nbit(features, Feature::vfp4sp))
+ if (bits == 32 && test_nbit(features, Feature::vfp4))
         return jl_true;
     else if ((bits == 64 || bits == 32) && test_nbit(features, Feature::vfp4))
         return jl_true;
diff --git a/src/runtime_intrinsics.c b/src/runtime_intrinsics.c
index ff479a4d30..e4126498ff 100644
--- a/src/runtime_intrinsics.c
+++ b/src/runtime_intrinsics.c
@@ -256,9 +256,11 @@ JL_DLLEXPORT float julia_half_to_float(uint16_t param) {
      (defined( __clang__ ) && __clang_major__ > 14)) && \
     !defined(_CPU_PPC64_) && !defined(_CPU_PPC_) && \
     !defined(_OS_WINDOWS_)
- #define FLOAT16_TYPE _Float16
- #define FLOAT16_TO_UINT16(x) (*(uint16_t*)&(x))
- #define FLOAT16_FROM_UINT16(x) (*(_Float16*)&(x))
+ // otherwise, pass using floating-point calling conventions
+ #define FLOAT16_TYPE float
+ #define FLOAT16_TO_UINT16(x) ((uint16_t)*(uint32_t*)&(x))
+ #define FLOAT16_FROM_UINT16(x) ({ uint32_t tmp = (uint32_t)(x); *(float*)&tmp; })
+
 // on older compilers, we need to emulate the platform-specific ABI
 #elif defined(_CPU_X86_) || (defined(_CPU_X86_64_) && !defined(_OS_WINDOWS_))
     // on x86, we can use __m128; except on Windows where x64 calling
diff --git a/src/stackwalk.c b/src/stackwalk.c
index 37f2396095..e12fc139d1 100644
--- a/src/stackwalk.c
+++ b/src/stackwalk.c
@@ -915,6 +915,8 @@ static void jl_rec_backtrace(jl_task_t *t) JL_NOTSAFEPOINT
         context = &t->ctx.ctx;
 #elif defined(JL_HAVE_UCONTEXT)
         context = jl_to_bt_context(&t->ctx.ctx);
+#elif defined(_OS_LINUX_) && defined( __GLIBC__ )
+	context = jl_to_bt_context(&t->ctx.ctx);
 #elif defined(JL_HAVE_ASM)
         memset(&c, 0, sizeof(c));
      #if defined(_OS_LINUX_) && defined( __GLIBC__ )

```

---

<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 20, 2024, 9:24am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/12 "2024-10-20T09:24:48Z")

</div>

Did you look at [Fixes for armv7l buildbots by staticfloat · Pull Request #51945 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/51945)?

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [October 25, 2024, 11:08am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/13 "2024-10-25T11:08:22Z")

</div>

Thank you!!! I’ll check!!!

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [November 30, 2024, 12:02pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/14 "2024-11-30T12:02:39Z")

</div>

> <https://github.com/Julia-Embedded/jlcross/blob/master/local_build/build_v1.11.1-arm32bit-patch-2024-11-04.sh>

With a little/messy modification, I could build Julia for 32-bit Raspberry Pi OS.

It’s time to feedback staticfloat’s PR.

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [December 6, 2024, 8:40am UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/15 "2024-12-06T08:40:39Z")

</div>

Amazing! Are you good with standing behind the push to get those changes to the build process into the official build scripts, so that no hacking is needed after?

---

<div class="post-metadata">

**Author:** ![terasakisatoshi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/terasakisatoshi/32/9187_2.png) [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Post date:** [December 6, 2024, 12:46pm UTC](https://discourse.julialang.org/t/problem-installing-prerequisites-for-building-julia/105128/16 "2024-12-06T12:46:39Z")

</div>

Yes, I agree.
