Search Unity

Bug Issues using so-libs with SONAME set

Discussion in 'Linux Editor' started by elmir-jagudin, Feb 6, 2019.

  1. elmir-jagudin

    elmir-jagudin

    Joined:
    Jun 7, 2016
    Posts:
    6
    I have run into a problem using the SO-libraries where the SONAME
    is set to a string that does not end in .so.

    For example, consider I have a library 'foo', which includes a version number
    into it's SONAME. When I build it I'll get these two files:

    libfoo.so -> libfoo.so.1
    libfoo.so.1

    the SONAME will be set to 'libfoo.so.1'. For the record, this is a common way to handle library versioning on Linux.

    When I build a second library 'bar' and link it agains 'foo', it will create a link
    to libfoo.so.1 file.

    $ ldd libbar.so
    libfoo.so.1 => ./libfoo.so.1 (0x00007feabceee000)
    ...

    If I use the libbar outside of Unity, all works as expected, when loading
    'libbar', linker will look for 'libfoo.so.1' file, and via symlink load the
    libfoo.so file.

    However, if I put libfoo.so, libfoo.so.1 and libfoo.so inside unity project's
    Assets/Plugins directory and try to use code in libbar, it does not work.
    I'll get following error:

    Plugins: Couldn't open Assets/Plugins/libbar.so, error: libfoo.so.1: cannot open shared object file: No such file or directory

    Here is an example project that demonstrates this problem:

    https://github.com/elmirjagudin/soname

    It looks like unity only consideres *.so files as library files, thus when SONAME does not
    end in '.so', it does not work.

    Have anyone run into this problem? Is there any work-arounds?
     
    Last edited: Feb 6, 2019