Failed to precompile LibSndFile

I’m trying to use LibSndFile.jl, but I get a following error:

julia> using LibSndFile
[ Info: Precompiling LibSndFile [b13ce0c6-77b0-50c6-a2db-140568b8d1a5]
ERROR: LoadError: LibSndFile not properly installed. Please run Pkg.build("LibSndFile")
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/kogadmbp/.julia/packages/LibSndFile/2R0fx/src/LibSndFile.jl:40
 [3] include(::Function, ::Module, ::String) at ./Base.jl:380
 [4] include(::Module, ::String) at ./Base.jl:368
 [5] top-level scope at none:2
 [6] eval at ./boot.jl:331 [inlined]
 [7] eval(::Expr) at ./client.jl:467
 [8] top-level scope at ./none:3
in expression starting at /Users/kogadmbp/.julia/packages/LibSndFile/2R0fx/src/LibSndFile.jl:37
ERROR: Failed to precompile LibSndFile [b13ce0c6-77b0-50c6-a2db-140568b8d1a5] to /Users/kogadmbp/.julia/compiled/v1.5/LibSndFile/yIqel_jUpOa.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923

So I tried to build LibSndFile, but I got more error.

(@v1.5) pkg> build LibSndFile
   Building SpecialFunctions → `~/.julia/packages/SpecialFunctions/ne2iw/deps/build.log`
   Building Conda ───────────→ `~/.julia/packages/Conda/3rPhK/deps/build.log`
   Building FFTW ────────────→ `~/.julia/packages/FFTW/2okGQ/deps/build.log`
   Building WinRPM ──────────→ `~/.julia/packages/WinRPM/Y9QdZ/deps/build.log`
   Building Homebrew ────────→ `~/.julia/packages/Homebrew/NtxoA/deps/build.log`
   Building LibSndFile ──────→ `~/.julia/packages/LibSndFile/2R0fx/deps/build.log`
┌ Error: Error building `LibSndFile`: 
│ ERROR: LoadError: ArgumentError: Package Compat not found in current path:
│ - Run `import Pkg; Pkg.add("Compat")` to install the Compat package.
│ 
│ Stacktrace:
│  [1] require(::Module, ::Symbol) at ./loading.jl:893
│  [2] include(::String) at ./client.jl:457
│  [3] top-level scope at none:5
│ in expression starting at /Users/kogadmbp/.julia/packages/LibSndFile/2R0fx/deps/build.jl:2
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

I added Compat, but I got the same error.
How could I solve this problem?

Here is my versioninfo() and Pkg> status.

ulia> versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, icelake-client)
Environment:
  JULIA_NUM_THREADS = 4

(@v1.5) pkg> status
Status `~/.julia/environments/v1.5/Project.toml`
  [6e4b80f9] BenchmarkTools v0.5.0
  [9e28174c] BinDeps v0.8.10
  [159f3aea] Cairo v1.0.5
  [34da2185] Compat v2.2.1
  [a81c6b42] Compose v0.9.1
  [717857b8] DSP v0.6.0
  [31a5f54b] Debugger v0.6.6
  [7a1cc6ca] FFTW v0.3.0
  [5789e2e9] FileIO v1.4.3
  [186bb1d3] Fontconfig v0.4.0
  [a2cc645c] GraphPlot v0.3.1
  [4c0ca9eb] Gtk v1.1.5
  [d9be37ee] Homebrew v0.6.4 `https://github.com/JuliaPackaging/Homebrew.jl.git#master`
  [7073ff75] IJulia v1.21.3
  [c8e1da08] IterTools v1.3.0
  [b13ce0c6] LibSndFile v2.0.0
  [093fc24a] LightGraphs v1.3.3
  [f57c4921] MusicProcessing v1.8.1 `https://github.com/JuliaMusic/MusicProcessing.jl#master`
  [91a5bcdd] Plots v0.27.1
  [80ea8bcb] PortAudio v1.1.0 `https://github.com/JuliaAudio/PortAudio.jl#master`
  [bd7594eb] SampledSignals v2.0.0
  [2913bbd2] StatsBase v0.32.2
  [8149f6b0] WAV v1.0.3
  [0818e8b4] WORLD v0.6.0
  [10745b16] Statistics

Can you try using v2.3.0 of LibSndFile.jl?

]add LibSndFile@v2.3.0

I tried it and got this error.

(@v1.5) pkg> add LibSndFile@v2.3.0
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package FFTW [7a1cc6ca]:
 FFTW [7a1cc6ca] log:
 ├─possible versions are: [0.1.0-0.1.2, 0.2.0-0.2.4, 0.3.0, 1.0.0-1.0.1, 1.1.0, 1.2.0-1.2.4] or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions [0.1.0-0.1.2, 0.2.0-0.2.4, 0.3.0, 1.0.0-1.0.1, 1.1.0, 1.2.0-1.2.4]
 ├─restricted by compatibility requirements with WORLD [0818e8b4] to versions: [0.1.0-0.1.2, 0.2.0-0.2.4, 0.3.0]
 │ └─WORLD [0818e8b4] log:
 │   ├─possible versions are: 0.6.0 or uninstalled
 │   └─restricted to versions * by an explicit requirement, leaving only versions 0.6.0
 └─restricted by compatibility requirements with SampledSignals [bd7594eb] to versions: [1.1.0, 1.2.0-1.2.4] — no versions left
   └─SampledSignals [bd7594eb] log:
     ├─possible versions are: [2.0.0, 2.1.0] or uninstalled
     ├─restricted to versions * by PortAudio [80ea8bcb], leaving only versions [2.0.0, 2.1.0]
     │ └─PortAudio [80ea8bcb] log:
     │   ├─possible versions are: 1.1.0 or uninstalled
     │   └─PortAudio [80ea8bcb] is fixed to version 1.1.0
     └─restricted by compatibility requirements with LibSndFile [b13ce0c6] to versions: 2.1.0
       └─LibSndFile [b13ce0c6] log:
         ├─possible versions are: [2.0.0, 2.1.0, 2.2.0, 2.3.0] or uninstalled
         └─restricted to versions 2.3.0 by an explicit requirement, leaving only versions 2.3.0

As a general remark, try to not put too many package in the global environment and use instead local environments, this will save you from 99% of incompatibilities issues in the future.

For the specific case, it looks like WORLD (which I assume is https://github.com/r9y9/WORLD.jl and looks fairly old) is preventing you from installing a more recent FFTW version. Do you need both WORLD and LibSndFile in the same environment? If not, remove WORLD and then you should be able to update LibSndFile to the latest version (which shouldn’t have the problem you were experience originally). Even better, keep in the global environment as small as possible and install LibSndFile in a local environment

1 Like

Thank you for your advice! It’s really helpful for me because I’m occasionally in trouble over compatibilities.

Removing WORLD,I was able to use l LibSndFile. However, I was thinking of using both. Is there no way to use them at the same time?

Not as WORLD.jl is now. It needs to be updated. I might have the time to open a pull request this weekend (no promises!), but then the maintainer needs to agree with the changes and merge it

I will be glad if you open a pull request. I hope the maintainer will merge it.
Thank you very much, giordano!

https://github.com/r9y9/WORLD.jl/pull/37

1 Like