Topic: Shared libraries

I have been using Pianoteq for a few years on Linux and am now considering moving to FreeBSD [Unix]. FreeBSD has a Linux Compatibility mode. I have installed the Pianoteq [7] files on my FreeBSD system and when I try to run the executable Pianoteq 7 STAGE I receive, as expected, the message "error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory". (This is long before I am asked to activate the copy of Pianoteq on this machine.)

As directed by the FreeBSD handbook, I have copied Pianoteq's shared libraries to the Linux Compatibility directory, but the handbook says I should also set up symbolic links to these libraries. The Linux 'ldd' command shows the links having the exact same name as the original shared libraries, e.g. libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2. I have tried placing the links in the same directory (Pianoteq 7 STAGE/x86-64bit/) as the executable Pianoteq file but I still receive the above error message.

Can anyone please tell me in which directory these links, e.g. libasound.so.2 on the left of the above '=>', should be placed? Or is there something else that I am missing?

Any help gratefully received.

Re: Shared libraries

On my Linux Mint 18.3 system libasound.so.2 is not a file but a symbolic link to libasound.so.2.0.0 (which is a file)

So :

ldd "Pianoteq 7"
    libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007faebf81e000)

ls -lap /usr/lib/x86_64-linux-gnu/libasound.so.2

lrwxrwxrwx 1 root root 18 Oct 19  2016 /usr/lib/x86_64-linux-gnu/libasound.so.2 -> libasound.so.2.0.0

ls -lap /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0

-rw-r--r-- 1 root root 1048248 Jan  4  2016 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0

Not sure if that helps, but don't assume ldd is pointing to a real object.  Also check it's libasound's dependencies exist.  You may need more symbolic links to other files.  Check permissions as well.

StephenG

Re: Shared libraries

Interesting, didn't know, that FreeBSD has a "Linux Compatibility mode"!

On a common Linux (Debian Buster) the libasound.so.2.0.0 is a content of the (Debian) package libasound2:

# dpkg --search libasound.so.2.0.0
libasound2:amd64: /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0

After installation of this package a softlink is created as sjgcit already described:

# ls -la /usr/lib/x86_64-linux-gnu/libasound.so.2
lrwxrwxrwx 1 root root 18 Jan 27  2019 /usr/lib/x86_64-linux-gnu/libasound.so.2 -> libasound.so.2.0.0

If you have to do such things manually under the compatibility mode of FreeBSD eventually just the single command ldconfig without further options might work. But I just remember doing it in the past on Linux systems, when I manually linked some libs.

Would be cool if you get PTQ running with FreeBSD!

PS: late edit

Last edited by groovy (02-08-2021 16:08)

Re: Shared libraries

Thank you sjgcit and groovy for your prompt reply.

At first I thought the problem was that there might be a string or environment variable specifying the directories to be searched for shared libraries, and that turns out to be true. The line

ldconfig_paths="<space-separated list of directories to search>"

in the file /etc/defaults/rc.conf does the job. However, one of the directories so specified is /usr/local/lib and in there we find:

/usr/local/lib/libasound.so.2 -> libasound.so.2.0.0
/usr/local/lib/libasound.so.2.0.0

and similarly for the other shared libraries that Pianoteq requires. I am still seeing the error while loading shared libraries so it seems that I need to do some further investigation.

Re: Shared libraries

ldconfig didn't help?

Re: Shared libraries

groovy wrote:

ldconfig didn't help?

No, I did try ldconfig but it didn't help.

I also tried copying the executable "Pianoteq 7 STAGE" file to /compat/linux/bin [where all the linux binaries live], plus all the shared libraries in "Pianoteq 7 STAGE/x86-64bit/libs" to /compat/linux/bin/libs/ but still get the error while loading shared libraries.