Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia 0.4.5: libz fails to load on Ubuntu

While I was attempting to use Requests in Julia, the following error was output:

julia> using Requests
INFO: Precompiling module Requests...
ERROR: LoadError: LoadError: error compiling version: could not load library "libz"
libz: cannot open shared object file: No such file or directory
while loading /home/michael/.julia/v0.4/Libz/src/lowlevel.jl, in expression starting on line 110
while loading /home/michael/.julia/v0.4/Libz/src/Libz.jl, in expression starting on line 11
ERROR: LoadError: Failed to precompile Libz to /home/michael/.julia/lib/v0.4/Libz.ji
while loading /home/michael/.julia/v0.4/Requests/src/Requests.jl, in expression starting on line 27
ERROR: Failed to precompile Requests to /home/michael/.julia/lib/v0.4/Requests.ji
in compilecache at ./loading.jl:400

I'm not knowledgeable enough in Julia to discern exactly what is happening, but here is the code from Libz.jl (line 11)...

include("lowlevel.jl")

...from lowlevel.jl (lines 103-110)...

# Functions
# ---------

function version()
    return unsafe_string(ccall((:zlibVersion, zlib), Ptr{UInt8}, ()))
end

const zlib_version = version()

...and from Requests.jl (line 27)

using Libz

This problem has persisted after I've removed then reinstalled Libz, MbedTLS, and Requests, and after I've Pkg.update()'ed and restarted julia and my computer. Is anyone well enough versed in Julia to know how to fix this?

like image 364
Michael Greenburg Avatar asked Jan 20 '26 10:01

Michael Greenburg


1 Answers

Per the comment by Gnimuc K and a tiny bit more research:

sudo apt-get install zlib1g-dev

installs zlib, which Julia needed. Once it was installed...

julia> Pkg.update()
julia> Pkg.build("Libz")

worked all the kinks out.

like image 70
Michael Greenburg Avatar answered Jan 22 '26 19:01

Michael Greenburg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!