Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"InitError: could not load library" during precompilation on Linux x86 #126

Closed
denglerchr opened this issue May 10, 2024 · 11 comments
Closed

Comments

@denglerchr
Copy link

I am having an error during precompilation on Linux x86 on two different PCs. versioninfo():

Julia Version 1.10.2
Commit bd47eca2c8* (2024-03-01 10:14 UTC)
Build Info:

    Note: This is an unofficial build, please report bugs to the project
    responsible for this build and not to the Julia project unless you can
    reproduce the issue using official builds available at https://julialang.org/downloads

Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: 4 × Intel(R) N100
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

The error appears as soon as the package (v1.3.0) is added. What is weird, isfile(raw"/home/christiand/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so") returns true...

ERROR: LoadError: InitError: could not load library "/home/christiand/.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] macro expansion
   @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library_generators.jl:63 [inlined]
 [2] __init__()
   @ alsa_plugins_jll ~/.julia/packages/alsa_plugins_jll/hnVoe/src/wrappers/x86_64-linux-gnu.jl:49
 [3] top-level scope
   @ stdin:3
during initialization of module alsa_plugins_jll
in expression starting at /home/christiand/.julia/packages/PortAudio/HNBv4/src/PortAudio.jl:1
in expression starting at stdin:3
  ✗ PortAudio
  0 dependencies successfully precompiled in 1 seconds. 120 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d]

Failed to precompile PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d] to "/home/christiand/.julia/compiled/v1.10/PortAudio/jl_hvLYJu".
ERROR: LoadError: InitError: could not load library "/home/christiand/.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] macro expansion
   @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library_generators.jl:63 [inlined]
 [2] __init__()
   @ alsa_plugins_jll ~/.julia/packages/alsa_plugins_jll/hnVoe/src/wrappers/x86_64-linux-gnu.jl:49
 [3] top-level scope
   @ stdin:3
during initialization of module alsa_plugins_jll
in expression starting at /home/christiand/.julia/packages/PortAudio/HNBv4/src/PortAudio.jl:1
in expression starting at stdin:
Stacktrace:
 [1] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool})
   @ Pkg.API /usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
 [2] precompile
   @ /usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined]
 [3] #precompile#114
   @ /usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined]
@ssfrr
Copy link
Contributor

ssfrr commented May 17, 2024

the problem doesn't appear to be finding libasound_module_pcm_a52.so, it's that that library seems to be dependent on libavcodec.so.58, which it's not finding.

what version of alsa_jll, alsa_plugins_jll, libportaudio_jll, and FFMPEG_jll do you have installed? In particular, that libasound module is provided by alsa_plugins_jll, and the libavcodec should be provided by FFMPEG_jll.

It looks like the latest version of FFMPEG_jll builds libavcodec.so.60, so maybe alsa_plugins_jll needs to be updated to match.

I'm pretty out of touch with how the binary build system works these days, so it may be worth filing an issue on the Yggdrasil repo, they may have a better idea.

@denglerchr
Copy link
Author

denglerchr commented May 17, 2024

It happens on a completely new project with only PortAudio added. Attached also the Manifest.toml in a Zip.

  • alsa_jll : version = "1.2.5+0"
  • alsa_plugins_jll : version = "1.2.2+0"
  • libportaudio_jll : version = "19.7.0+0"
  • FFMPEG_jll : version = "6.1.1+0"

Under Windows, with the same versions of packages, PortAudio works well.

Manifest.zip

@tp2750
Copy link

tp2750 commented May 19, 2024

I have the same problem on Ubuntu 24.04.

There appears to be a number of libraries missing:

$ ldd /home/tp_test/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so
	linux-vdso.so.1 (0x00007ffe53518000)
	libavcodec.so.58 => not found
	libavutil.so.56 => not found
	libavresample.so.4 => not found
	libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007577d15de000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007577d14f5000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007577d14ee000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007577d14e9000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007577d14e4000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007577d0e00000)
	/lib64/ld-linux-x86-64.so.2 (0x00007577d1703000)

The versions installed on my system are:

/lib/x86_64-linux-gnu/libavcodec.so.60
/lib/x86_64-linux-gnu/libavutil.so.58
/lib/x86_64-linux-gnu/libswresample.so.4

(the last one is the closest I could find).

But I do not know how to fix it :-(

@tp2750
Copy link

tp2750 commented Jun 8, 2024

I managed to build alsa_plugin locally by restricting the number of architectures and pinning FFMPEG to version 4.4: JuliaPackaging/Yggdrasil#8863

This is not enough to make PortAudio install, but if I explicitly use FFMPEG_jll@4.4.0 it works.

So I suppose if we go this route, we need to add a compat of FFMPEG_jll to restrict it to ~4.4.

However, on my host system (Ubuntu 20.24) I have a copy of libasound_module_pcm_a52.so that links to libavcodec.so.60, so there does not seem to be a reason we can not build alsa_plugin using the newer libraries.

@tp2750
Copy link

tp2750 commented Jun 8, 2024

Oh, there is a new version of alsa-plugins: 1.2.7.1. That builds with the current version of FFMPEG.
I'll update my PR.

@KronosTheLate
Copy link

I just wanted to add that I also ran into this issue just now in a fresh environment under julia 10.4.

@mashu
Copy link

mashu commented Jul 16, 2024

Same problem on GNU/Linux Debian (sid):

PkgPrecompileError: The following 1 direct dependency failed to precompile:

PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d]

Failed to precompile PortAudio [80ea8bcb-4634-5cb3-8ee8-a132660d1d2d] to "/home/mateusz/.julia/compiled/v1.10/PortAudio/jl_1GnANP".
ERROR: LoadError: InitError: could not load library "/home/mateusz/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_a52.so"
/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_ot_color_has_paint
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::Nothing)
    @ Base ./loading.jl:2222
 [22] top-level scope
    @ stdin:3
during initialization of module alsa_plugins_jll
in expression starting at /home/mateusz/.julia/packages/PortAudio/HNBv4/src/PortAudio.jl:1
in expression starting at stdin:

This is Julia 1.10.4 and clean Pkg.generate("mwe") environment with just PortAudio package.
Portaudio libraries on the system are

ii  libportaudio2:amd64                                19.6.0-1.2+b2                            amd64        Portable audio I/O - shared library
ii  libportaudiocpp0:amd64                             19.6.0-1.2+b2                            amd64        Portable audio I/O C++ bindings - shared library
ii  portaudio19-dev:amd64                              19.6.0-1.2+b2                            amd64        Portable audio I/O - development files

Looks like this Julia package is completely broken, are there any alternatives for Julia to read sound device ?

Thanks

@jariji
Copy link

jariji commented Jul 16, 2024

I'm hoping PortAudio.jl can support PipeWire systems as well since that's a popular choice for the Linux audio server. It was suggested

to build Pipewire with binary builder and then make alsa-plugins aware of it:

JuliaPackaging/Yggdrasil@master/A/alsa_plugins/build_tarballs.jl

@tp2750
Copy link

tp2750 commented Sep 28, 2024

It works for me now, after the merge of JuliaPackaging/Yggdrasil#9105.
Thank you very much @ViralBShah

@giordano
Copy link

Same problem on GNU/Linux Debian (sid):

How did you install Julia? Pulling a system library (/lib/x86_64-linux-gnu/libpango-1.0.so.0) looks like a problem (probably on your side, since that's not expected to happen) and unrelated to the issue discussed above.

There appears to be a number of libraries missing:

Using ldd is fairly useless, since it has no clue of the libraries loaded by julia through artifacts. Using https://github.com/giordano/DependencyWalker.jl appropriately would be more useful.

@denglerchr
Copy link
Author

It works for me now, after the merge of JuliaPackaging/Yggdrasil#9105. Thank you very much @ViralBShah

Same here. I guess I can close this one, build is working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants