On 22 Oct 2024, at 07:27, Khem Raj via lists.openembedded.org 
<[email protected]> wrote:
> find_library API depends on platform to provide ldconfig, ld, gcc, objdump
> etc, so either we add these dependencies or avoid them by computing the
> libarchive library name during build, which we can be done.

OH GOD THAT IS HORRIBLE.

"On Linux, find_library() tries to run external programs (/sbin/ldconfig, gcc, 
objdump and ld) to find the library file. It returns the filename of the 
library file.”

> +DEPENDS += "patchelf-native libarchive"
> +# Avoid using find_library API which needs ldconfig and ld/objdump
> +# https://docs.python.org/3/library/ctypes.html#ctypes-reference
> +#
> +do_configure:append() {
> +    sed -i -e "s|find_library('archive')|'${libdir}/$(patchelf 
> --print-soname ${STAGING_LIBDIR}/libarchive.so)'|" ${S}/libarchive/ffi.py
> +}

Can we patch the source instead:

-libarchive_path = os.environ.get('LIBARCHIVE') or find_library('archive')
+libarchive_path = @LIBARCHIVE_SONAME@

And then just sed that expression with the right value?  I don’t like magic 
seds because they can transparently not apply and regress in the future.

Also, thoughts on a solution that doesn’t involve ldconfig so it works on musl 
would be appreciated.  Can you tell the musl loader to dump its search paths 
somehow?  We should really file a bug with python…

Ross

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206447): 
https://lists.openembedded.org/g/openembedded-core/message/206447
Mute This Topic: https://lists.openembedded.org/mt/109147889/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to