JeffFessler / Sound.jl

Provide `sound` & `record` functions for playing & recording audio in Julia. Also Julia version of phase vocoder.
MIT License
25 stars 1 forks source link

'Sound' package fails to install properly #29

Open sergstesh opened 3 months ago

sergstesh commented 3 months ago

I am trying to install 'Sound' package using self-built julia-1.10.2 and the installation fails.

Output of 'uname -a':

Linux slaptop 6.5.0-0.deb12.4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.10-1~bpo12+1 (2023-11-23) x86_64 GNU/Linux .

Julia was downloaded from https://github.com/JuliaLang/julia/releases/download/v1.10.2/julia-1.10.2-full.tar.gz , unpacked the usual way, and was built using

nice -n 19 make test 1>make_test.log 2>&1

command line.

Then I made sure that ~/.julia directory doesn't exist and after invoking Julia the usual way (no command line arguments) I tried to install "Sound" package the usual way:

using Pkg
Pkg.add("Sound")

. Installation process ended with the following messages:

Precompiling project...
  ✗ PortAudio
  ✗ Sound
  113 dependencies successfully precompiled in 407 seconds. 9 already precompiled.
  1 dependency had output during precompilation:
┌ MKL_jll
│   Downloading artifact: MKL
│  
│  [pid 35566] waiting for IO to finish:
│   Handle type        uv_handle_t->data
│   timer              0x5596605cd330->0x7f8f1674ed70
│  This means that a package has started a background task or event source that has not finished running. For precompilation to complete successfully, the event source needs to be closed explicitly. See the developer documentation on fixing precompilation hangs for more help.
│  
│  [pid 35566] waiting for IO to finish:
│   Handle type        uv_handle_t->data
│   timer              0x5596605cd330->0x7f8f1674ed70
│  This means that a package has started a background task or event source that has not finished running. For precompilation to complete successfully, the event source needs to be closed explicitly. See the developer documentation on fixing precompilation hangs for more help.
└  
  2 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

. If I exit REPL using the exit() function and try again to install 'Sound', I'm getting the following screen output:

julia> using Pkg

julia> Pkg.add("Sound")
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.10/Project.toml`
  No Changes to `~/.julia/environments/v1.10/Manifest.toml`

julia> 

.

However, trying to use the 'Sound' package produces the following:

julia> using Sound
Precompiling Sound
        Info Given Sound was explicitly requested, output will be shown live 
ERROR: LoadError: InitError: could not load library "/home/sergei/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so"
libavcodec.so.58: cannot open shared object file: No such file or directory
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ alsa_plugins_jll ~/.julia/packages/alsa_plugins_jll/hnVoe/src/wrappers/x86_64-linux-gnu.jl:49
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1134
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1122
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1067
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1581
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1938
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [11] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [12] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [14] macro expansion
    @ ./loading.jl:1790 [inlined]
 [15] macro expansion
    @ ./lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [17] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [18] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [19] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [20] include
    @ ./Base.jl:495 [inlined]
 [21] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
    @ Base ./loading.jl:2222
 [22] top-level scope
    @ stdin:3
during initialization of module alsa_plugins_jll
in expression starting at /home/sergei/.julia/packages/PortAudio/HNBv4/src/PortAudio.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d] to "/home/sergei/.julia/compiled/v1.10/PortAudio/jl_GB2upu".io
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:2468
  [3] compilecache
    @ ./loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base ./loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:93
  [6] #mkpidlock#6
    @ /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:111
  [8] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [9] invokelatest
    @ ./essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:2983
 [11] maybe_cachefile_lock
    @ ./loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [14] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [17] macro expansion
    @ ./loading.jl:1790 [inlined]
 [18] macro expansion
    @ ./lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [20] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [23] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [24] include(x::String)
    @ Sound ~/.julia/packages/Sound/caDfb/src/Sound.jl:8
 [25] top-level scope
    @ ~/.julia/packages/Sound/caDfb/src/Sound.jl:10
 [26] include
    @ ./Base.jl:495 [inlined]
 [27] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [28] top-level scope
    @ stdin:3
in expression starting at /home/sergei/.julia/packages/Sound/caDfb/src/soundsc.jl:3
in expression starting at /home/sergei/.julia/packages/Sound/caDfb/src/Sound.jl:1
in expression starting at stdin:3
  ✗ PortAudio
  ✗ Sound
  0 dependencies successfully precompiled in 4 seconds. 122 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Sound [afe32e48-2646-410f-a1df-ae97debbc86b]

Failed to precompile Sound [afe32e48-2646-410f-a1df-ae97debbc86b] to "/home/sergei/.julia/compiled/v1.10/Sound/jl_Z7rEyu".
ERROR: LoadError: InitError: could not load library "/home/sergei/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so"
libavcodec.so.58: cannot open shared object file: No such file or directory
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ alsa_plugins_jll ~/.julia/packages/alsa_plugins_jll/hnVoe/src/wrappers/x86_64-linux-gnu.jl:49
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1134
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1122
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1067
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1581
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1938
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [11] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [12] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [14] macro expansion
    @ ./loading.jl:1790 [inlined]
 [15] macro expansion
    @ ./lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [17] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [18] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [19] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [20] include
    @ ./Base.jl:495 [inlined]
 [21] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
    @ Base ./loading.jl:2222
 [22] top-level scope
    @ stdin:3
during initialization of module alsa_plugins_jll
in expression starting at /home/sergei/.julia/packages/PortAudio/HNBv4/src/PortAudio.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d] to "/home/sergei/.julia/compiled/v1.10/PortAudio/jl_GB2upu".
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:2468
  [3] compilecache
    @ ./loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base ./loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:93
  [6] #mkpidlock#6
    @ /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:111
  [8] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [9] invokelatest
    @ ./essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:2983
 [11] maybe_cachefile_lock
    @ ./loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [14] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [17] macro expansion
    @ ./loading.jl:1790 [inlined]
 [18] macro expansion
    @ ./lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [20] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
 [23] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [24] include(x::String)
    @ Sound ~/.julia/packages/Sound/caDfb/src/Sound.jl:8
 [25] top-level scope
    @ ~/.julia/packages/Sound/caDfb/src/Sound.jl:10
 [26] include
    @ ./Base.jl:495 [inlined]
 [27] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [28] top-level scope
    @ stdin:3
in expression starting at /home/sergei/.julia/packages/Sound/caDfb/src/soundsc.jl:3
in expression starting at /home/sergei/.julia/packages/Sound/caDfb/src/Sound.jl:1
in expression starting at stdin:
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
  [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…})
    @ Pkg.API /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
  [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
    @ Pkg.API /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
  [4] precompile
    @ /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
  [5] #precompile#114
    @ /media/sergei/4c7aa17d-44cf-423c-b211-ce583883925c/home/sergei/Downloads/julia-1.10.2/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
  [6] #invokelatest#2
    @ ./essentials.jl:894 [inlined]
  [7] invokelatest
    @ ./essentials.jl:889 [inlined]
  [8] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1963
  [9] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [10] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [11] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [12] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [13] macro expansion
    @ ./loading.jl:1790 [inlined]
 [14] macro expansion
    @ ./lock.jl:267 [inlined]
 [15] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [16] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [17] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [18] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
Some type information was truncated. Use `show(err)` to see complete types.

julia> 

. In the above long screen output the first actual error message is:

ERROR: LoadError: InitError: could not load library "/home/sergei/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so"
libavcodec.so.58: cannot open shared object file: No such file or directory

.

Using 'find' command I see:

sergei@slaptop:~$ find ~/.julia/ -name "libavcodec*"
/home/sergei/.julia/artifacts/b1158959679bd9be00bd4fbf143a50e9c60e77e0/include/libavcodec
/home/sergei/.julia/artifacts/b1158959679bd9be00bd4fbf143a50e9c60e77e0/lib/libavcodec.so
/home/sergei/.julia/artifacts/b1158959679bd9be00bd4fbf143a50e9c60e77e0/lib/libavcodec.so.60
/home/sergei/.julia/artifacts/b1158959679bd9be00bd4fbf143a50e9c60e77e0/lib/libavcodec.so.60.31.102
/home/sergei/.julia/artifacts/b1158959679bd9be00bd4fbf143a50e9c60e77e0/lib/pkgconfig/libavcodec.pc
sergei@slaptop:~$ 

, .i.e. 'libavcodec.so.60' file exists, but for some reason instead of loading the file which exists 'libasound_module_pcm_a52.so' DLL tries to load the non-existing 'libavcodec.so.58' file - probably en error in dependencies.

JeffFessler commented 3 months ago

Sorry! I just added Sound package on a Ubuntu server:

uname -a
Linux ir74 5.15.0-102-generic #112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

and it installed fine with Julia 1.10.2, except for some warning messages:

│  ALSA lib confmisc.c:855:(parse_card) cannot find card '0'

probably because this is a server without a sound card. I don't have any Linux boxes with sound cards in them.

Sound.jl is just a layer on top of PortAudio so please try ]add PortAudio next. If that fails then report the issue to that repo after checking the issues there to see if anyone else has the same problems.

JeffFessler commented 3 months ago

Also please look at the advice given here: https://jefffessler.github.io/Sound.jl/dev/#PortAudio-on-Linux

sergstesh commented 3 months ago

please try ]add PortAudio next

in the snippet of screen output from Julia REPL at the very top one case see:

Precompiling project... ✗ PortAudio

, i.e. PortAudio is added automatically.

sergstesh commented 3 months ago

Also please look at the advice given here: https://jefffessler.github.io/Sound.jl/dev/#PortAudio-on-Linux

I have just read it. I do not think what is said in the text pointed to by link is relevant. If to very much shorten my report, it would be: "for some reason libavcodec.so.58 instead of readily available libavcodec.so.60 is wanted". What does this particular problem (58 <-> 60) has to do with what's written in https://jefffessler.github.io/Sound.jl/dev/#PortAudio-on-Linux ?

JeffFessler commented 3 months ago

I was trying to be helpful. I will try one last time. I think the in ✗ PortAudio means that package install did not go well. Your issue is likely with PortAudio. The link shows that others have also had issues with PortAudio on Linux.

sergstesh commented 3 months ago

I think the ✗ in ✗ PortAudio means that package install did not go well. Your issue is likely with PortAudio.

If the 'Sound' package is meant to be cross-platform, why do you build it on top of package ('PortAudio') which doesn't work under Linux ?

Looking at https://jefffessler.github.io/Sound.jl/stable/ I do not see a list of supported/unsupported OSes. Could you please update the page to reflect what OSes are supported ?

tp2750 commented 1 month ago

@sergstesh , PortAudio depends on alsa_plugins, which needs updating. I'm trying to fix it: https://github.com/JuliaPackaging/Yggdrasil/pull/8863, but there is still something preventing it from building. Help will be appreciated.