Skip to content

Problems with musl's ldso on 1.6Β #40556

@jpsamaroo

Description

@jpsamaroo

For some reason, musl's loader refuses to reuse libraries that it's already loaded to service later requests for those same libraries. For example, libbz2.so from Bzip2_jll can be successfully dlopen'd on its own, but when trying to dlopen libfreetype.so from FreeType2_jll, we can see (through strace) musl's loader looking through entries in LD_LIBRARY_PATH instead. Trying to modify JLLWrappers.jl to do a withenv("LD_LIBRARY_PATH"=>join(LIBPATH_list, ':')) do ... around the dlopen does not seem to affect the search path, but I can set LD_LIBRARY_PATH manually outside of Julia as usual (so I hypothesize that the environment is cached when ld is first loaded?).

Of course, this doesn't always happen. For me on Alpine Linux, JLLs that do not depend on Bzip2_jll (and a few other problematic JLLs) seem to work fine. @giordano hypothesizes that it's because of a difference between the SONAME and NEEDED entries between dependent libraries, but I've found that even by using patchelf to change these entries, nothing of benefit happens (when it does work, it's only because the loader instead found a matching system library). However, it's totally possible I'm doing this wrong.

If anyone has suggestions on other things to look at or try, please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler:muslSupport for musl linked binaries on linux instead of glibc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions