Problem installing prerequisites for building Julia

The README for the official julia repo links to this 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:

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:

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:

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.

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

I end up getting the following error:

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?

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 …

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).

1 Like

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

2 Likes

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. Specifically, there is this section in the readme:


In the comment section of that gist, we are told to put the following content inside Make.user:

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.

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 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 might also have some folks that know how to fix it?

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 :sweat_smile: it was their build-instructions I started using.