title: Loading linux libraries inside FreeBSD program (Python script)
body: <p>I'm trying to use some Linux libs under FreeBSD/PC-BSD, and I have some doubts about how Linux binary compatibility on FreeBSD works.</p>
  
  <p>I have installed the required kernel module for this task, with the additional linux_base package containing the Linux libraries.</p>
  
  <p>The library itself is libspotify, which can be downloaded here (there are no libspotify  builds available for FreeBSD, so the Linux one must be used):
  <a href="https://developer.spotify.com/technologies/libspotify/#download" rel="nofollow noreferrer">https://developer.spotify.com/technologies/libspotify/#download</a></p>
  
  <p>Running this Python code snipped fails:</p>
  
  <pre><code>import ctypes
  lib_path = './libspotify.so'
  lib = ctypes.cdll.LoadLibrary(lib_path)
  </code></pre>
  
  <p>It says the following:</p>
  
  <pre><code>OSError: Shared object "libpthread.so.0" not found, required by "libspotify.so"
  </code></pre>
  
  <p>The handbook says that linux binaries must be tagged using <code>brandelf</code>, and I did so:
  <a href="http://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html#idp74327472" rel="nofollow noreferrer">http://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html#idp74327472</a></p>
  
  <p>But it does not work yet.</p>
  
  <p><strong>So the question is:</strong> Linux binary compatibility is only for Linux executables or is also suitable for loading Linux libraries inside FreeBSD executables?</p>
  
  <p><strong>EDIT:</strong> I'm aware that this may require changing the linker configuration as stated on an answer to <a href="https://stackoverflow.com/a/2339321/28581">this similar question</a>, but since the library is going to be loaded inside a Python script, it doesn't seem a suitable approach.</p>
  
  <p>Thanks in advance.</p>