Menu

#235 Respect LD_LIBRARY_PATH for handler loading

open
nobody
None
5
2025-01-01
2023-11-22
No

Howdy!

I recently had some trouble with sox support flac files, when leveraging sox (and friends) unpacked into a directory and pointing LD_LIBRARY_PATH to the scratch-library directory.

From what I can gather, handler loading is done here: https://sourceforge.net/p/sox/code/ci/master/tree/src/formats.c#l112 with PKGLIBDIR as some static path provided by automake (/usr/local/x86_64-linux-gnu/sox on my machine I believe).

From the documentation looks like lt_dlforeachfile just searches the provided path, and doesn't try to handle the "system library search path".

I don't think the fix is obvious. Perhaps sox could instead switch to loading individual handlers using lt_dlopen ad-hoc instead of scraping a hard-coded search path? Alternative construct the argument to lt_dlforeachfile by appending PACKAGE to the system library search path?

Discussion

  • Martin Guy

    Martin Guy - 2024-10-01

    SoX looks for its effect/format dl's in whatever PKGLIBDIR was set to when it was compiled so if you want to install it in a scratch directory you need to recompile it using ./configure --prefix=$HOME or whereever

     
  • Martin Guy

    Martin Guy - 2025-01-01

    You could make this happen at runtime by modifying src/formats.cto

    if (lt_dlforeachfile(PKGLIBDIR, init_format, NULL) != 0)
            lt_dlforeachfile(getenv("LD_LIBRARY_PATH"));
    

    https://codeberg.org/sox_ng/sox_ng/issues/295

    Should LD_LIBRARY_PATH override PKGLIBDIR or vice versa?

     

Log in to post a comment.

MongoDB Logo MongoDB