ChrlTsr
ChrlTsr

Reputation: 149

Failed to precompile JLD

I had a code that used to work using Julia 0.6, and I have been recently trying to use it again, however I am having different troubles using JLD. I tried to use the most recent Julia version and it still does not work. In 0.6 version, here is what I have :

using JLD

INFO: Precompiling module JLD. WARNING: could not import Base.lastindex into HDF5 WARNING: could not import Base.iterate into HDF5 ERROR: LoadError: ArgumentError: Module Libdl not found in current path. Run Pkg.add("Libdl") to install the Libdl package.

Pkg.add("Libdl")

ERROR: unknown package Libdl

I don't really understand what is going on, I saw similar problems on the Julia blog and also in stackoverflow but no proposed solutions seem to work in my case.. I would be ok to modidify my code si it could work with a newer version of Julia but I still can't make JLD work in any version.

Any advice? Thanks !

Upvotes: 0

Views: 687

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42194

For Julia 1.0.0 use the package JLD2.jl.

Press ] to go to the package manager: add JLD2

Sample code:

using JLD2
obja = (a=5, b=[1,2,3]);
objb = "hello world";
save("dat.jld2","obja",obja,"objb",objb);

Now running

load("dat.jld2")

yields

Dict{String,Any} with 2 entries:
  "obja" => (a = 5, b = [1, 2, 3])
  "objb" => "hello world"

Upvotes: 1

Related Questions