Julia on Raspberry Pi: error building HDF5 package

I’ve installed Julia language on Raspberry Pi as mentioned here:

But then trying to ]add HDF5 the following error appears:

(v1.2) pkg> add HDF5
 Resolving package versions...
 Installed CMakeWrapper ─────── v0.2.3
 Installed OrderedCollections ─ v1.1.0
 Installed Blosc ────────────── v0.5.1
 Installed BinDeps ──────────── v0.8.10
 Installed Parameters ───────── v0.12.0
 Installed BinaryProvider ───── v0.5.6
 Installed Compat ───────────── v2.2.0
 Installed HDF5 ─────────────── v0.12.4
 Installed CMake ────────────── v1.1.2
 Installed URIParser ────────── v0.4.0
  Updating ~/.julia/environments/v1.2/Project.toml
  [f67ccb44] + HDF5 v0.12.4
  Updating ~/.julia/environments/v1.2/Manifest.toml
  [9e28174c] + BinDeps v0.8.10
  [b99e7846] + BinaryProvider v0.5.6
  [a74b3585] + Blosc v0.5.1
  [631607c0] + CMake v1.1.2
  [d5fb7624] + CMakeWrapper v0.2.3
  [34da2185] + Compat v2.2.0
  [f67ccb44] + HDF5 v0.12.4
  [bac558e1] + OrderedCollections v1.1.0
  [d96e819e] + Parameters v0.12.0
  [30578b45] + URIParser v0.4.0
  [2a0f44e3] + Base64 
  [ade2ca70] + Dates 
  [8bb1440f] + DelimitedFiles 
  [8ba89e20] + Distributed 
  [b77e0a4c] + InteractiveUtils 
  [76f85450] + LibGit2 
  [8f399da3] + Libdl 
  [37e2e46d] + LinearAlgebra 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [a63ad114] + Mmap 
  [44cfe95a] + Pkg 
  [de0858da] + Printf 
  [3fa0cd96] + REPL 
  [9a3f8284] + Random 
  [ea8e919c] + SHA 
  [9e88b42a] + Serialization 
  [1a1011a3] + SharedArrays 
  [6462fe0b] + Sockets 
  [2f01184e] + SparseArrays 
  [10745b16] + Statistics 
  [8dfed614] + Test 
  [cf7118a7] + UUIDs 
  [4ec0a83e] + Unicode 
  Building CMake → ~/.julia/packages/CMake/nSK2r/deps/build.log
  Building Blosc → ~/.julia/packages/Blosc/lzFr0/deps/build.log
  Building HDF5 ─→ ~/.julia/packages/HDF5/rF1Fe/deps/build.log
┌ Error: Error building HDF5: 
│ [ Info: Downloading https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.4/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz to /home/pi/.julia/packages/HDF5/rF1Fe/deps/usr/downloads/Zlib.v1.2.11.arm-linux-gnueabihf.tar.gz...
│ ERROR: LoadError: LoadError: MethodError: no method matching iterate(::Nothing)
│ Closest candidates are:
│   iterate(!Matched::Core.SimpleVector) at essentials.jl:604
│   iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:604
│   iterate(!Matched::ExponentialBackOff) at error.jl:214
│   ...
│ Stacktrace:
│  [1] append_any(::Any, ::Vararg{Any,N} where N) at ./essentials.jl:722
│  [2] top-level scope at /home/pi/.julia/packages/HDF5/rF1Fe/deps/build_HDF5.v1.10.5.jl:40
│  [3] include at ./boot.jl:328 [inlined]
│  [4] include_relative(::Module, ::String) at ./loading.jl:1094
│  [5] include(::Module, ::String) at ./Base.jl:31
│  [6] include(::String) at ./client.jl:431
│  [7] top-level scope at /home/pi/.julia/packages/HDF5/rF1Fe/deps/build.jl:2
│  [8] include at ./boot.jl:328 [inlined]
│  [9] include_relative(::Module, ::String) at ./loading.jl:1094
│  [10] include(::Module, ::String) at ./Base.jl:31
│  [11] include(::String) at ./client.jl:431
│  [12] top-level scope at none:5
│ in expression starting at /home/pi/.julia/packages/HDF5/rF1Fe/deps/build_HDF5.v1.10.5.jl:40
│ in expression starting at /home/pi/.julia/packages/HDF5/rF1Fe/deps/build.jl:2

Can you file an issue on the HDF5.jl repository? It sounds like the zlib dependency might not have been built for the RPi’s processor.

But it should be https://github.com/bicycle1885/ZlibBuilder/releases/tag/v1.0.4, no? :thinking:

Isn’t in libhdf5 itself that is not built for ARM:

https://github.com/JuliaPackaging/Yggdrasil/blob/b883454778587adaad49277870ca65585f109880/H/HDF5/build_tarballs.jl#L78-L84

Added issue to HDF5.jl:

https://github.com/JuliaIO/HDF5.jl/issues/588

We will need some help to get HDF5 builds for ARM.

What kind of help you’ll need?

I had a look to the work to do, it doesn’t seem too hard. But I need time, I definitely don’t have this week.

Great. Would love your help on this. Please message me if you need building for the Windows platform. The patches we require are available on the msys2 repo, shoot me a message on slack for them.

Ok, I think I’ll give up as it clearly doesn’t support cross-compilation: HDF5 FAQ - Compile Issues

That was from 4 years ago. I think the situation is improved now?

Mustafa M

No, I found that page after crashing my head for a few minutes to skip all those AC_TRY_RUN, that are still there. I couldn’t even finish ./configure. If what they say about the make stage is still true, there is no work around that.

Maybe this can help?

https://archlinuxarm.org/packages/armv7h/hdf5

https://developer.arm.com/tools-and-software/server-and-hpc/arm-architecture-tools/resources/porting-and-tuning/building-hdf5-with-arm-compiler

No, it doesn’t. I actually started from the Arch Linux ARM page.

The problem is that BinaryBuilder.jl does cross-compilation, but HDF5 specifically cannot work with it.

Currently, the only way to provide a package for the Rasperry Pi is to find a pre-built binary for this platform and use it, which is actually what we do for the few supported platforms.

So, how can I tell HDF5.jl to use prebuilt binary (or more generally, for any other package that usually build 3rd-party binaries from source)?

This is not something that you can easily do on your side without a lot of manual work. This should be rather done in HDF5.jl if we find a pre-built package that can be easily used in our framework.

Found an instructuin for cross-compilation from here: https://github.com/HDFGroup/armed-hdf5/wiki
The link is broken, so I found another copy of that page: http://hdf-forum.184993.n3.nabble.com/Cross-compiling-HDF5-for-a-ARM-platform-td4026501.html

I found that page too, but it’s super old, I’m not sure the instruction still apply.

Hi

I ran into this problem this week and would like to know if you managed to find a solution yet?

I’m almost certain I had used MAT.jl which depends on HDF5.jl on Julia v0.6 in Jul-Sep 2017.

Anyway, my problem seems to be that CMake.jl doesn’t want to build due to compiler versions and/or compiler flags. I logged a issue https://github.com/JuliaPackaging/CMake.jl/issues/24 but wanted to check here if anyone else is seeing similar problems.

HDF5 library does not support cross-compilation, so the only solution is to compile it on RPi and link your cross-compiled code to already compiled libraries. That’s how we did it in our cpp projects. However, I don’t know, how to do that in HDF5.jl