DEV Question! Use library/object files from windows or ubuntu/centos on Alpine Linux

Hey
I have downloaded an SDK, and there are some compiled librarys for windows (dll) and/or centos/linux (so)… there is no source, so i cant recompile them for Alpine Linux (HassOS)

I’m no dev, but is there no way to use those files and make it work on Alpine? maybe in somekind of emulator or something?

thx in advance

linux is linux, be it centos or alpine.
What you have to check is whether the dependencies of the library is met on Alpine. The ldd command is used for that.

But first of all: What do you plan to do with the libraries if you are not a dev?

I have a python script, it works , its using those .so files, i have created an HA addon for that
But the Addon is based on centos or ubuntu, taking space

Want to make it work for Alpine

below output of ldd command

➜  ~ ldd /addons/hikvision/lib/libhcnetsdk.so
        /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        libhpr.so => /addons/hikvision/lib/libhpr.so (0x7f729b37b000)
        libHCCore.so => /addons/hikvision/lib/libHCCore.so (0x7f729aa8b000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f729a8ea000)
        libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f729a8d0000)
        libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        libpthread.so.0 => /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        librt.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        libdl.so.2 => /lib/ld-musl-x86_64.so.1 (0x7f729be6e000)
        libuuid.so.1 => /lib/libuuid.so.1 (0x7f729a8c7000)

In case it was not clear, you have to run the ldd under alpine in the addon environment.
But besides that, if the dependencies are met, it should work.

yeah, but it doesnt work :slight_smile:
in system requirements of the SDK, they say clearly that it only works under redhat/centos/ubuntu
so i want to make it work in Alpine , is there no such thing as an emulator? :slight_smile:

You’d have to do the same transitively for all libs, ofc, so e.g., /addons/hikvision/lib/libhpr.so and /addons/hikvision/lib/libHCCore.so here

What “doesn’t work”? Do you have errors? logs?

There is no such thing as distro emulators per se. You normally use a VM or docker for that, which is not applicable to an addon, ofc.

You might get somewhere with chroot if you are really motivated :wink:

ok, gonna google chroot :slight_smile:
is this python code i’m using : GitHub - laszlojakab/hikvision-intercom-python-demo: Hikvsion intercom Python demo

its using a shared library (hikvision camera/intercom devices)

so that python scripts tries to login on the hikvision device, but then it throws out some error code 29 , meaining , that library is not compatible