title: Error loading libpthread.so on Android
body: <p>I'm using the android-NDK-r10 to compile my C++ code that wraps the functions of libspotify.</p>
  
  <p>In my app, I include two libraries in <code>onCreate()</code> method of a class extending <code>Service</code> like this:</p>
  
  <pre><code>System.loadLibrary("spotify");
  System.loadLibrary("spotifywrapper");
  </code></pre>
  
  <p>In my C++ code (compiled to "libspotifywrapper.so"), I include libpthread as usual:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;pthread.h&gt;
  #include &lt;string&gt;
  #include &lt;api.h&gt;
  </code></pre>
  
  <p>Compiling with ndk-build works, I'm not getting any errors.</p>
  
  <p>When I start my android app, dalvik crashes with the following message:</p>
  
  <blockquote>
    <p>09-26 08:18:18.941: E/dalvikvm(11820): dlopen("/data/app-lib/com.example.myApp-1/libspotify.so") failed: dlopen failed: could not load library "libpthread.so.0" needed by "libspotify.so"; caused by library "libpthread.so.0" not found</p>
  </blockquote>
  
  <p>I copied <a href="https://github.com/embeddedarm/linux-2.6.35.3-imx28/blob/master/cross-toolchain/arm-fsl-linux-gnueabi/arm-fsl-linux-gnueabi/multi-libs/armv7-a/lib/libpthread-2.11.1.so" rel="nofollow">this</a> version of libpthread into <code>libs/armeabi/</code>, renamed it to <code>libpthread.so</code>, and included it like the two libs above. When I'm running the app, it then produces an error, that <code>libc.so.6</code> isn't found.<br>
  Afaik, the libc isn't included in Android, isn't it?</p>
  
  <p>Asking Google, I read that libpthread is included in libc, but as Android uses Bionic, I don't know if libpthread is included in it.</p>
  
  <p>The actual question is: How do I get rid of this error, that libpthread isn't found?<br>
  I think it can't be that difficult, and as compiling works fine, it could not be a bug in my code. Are my Android-devices (4.4.4 and 4.4.2) the reason?</p>
  
  <p>I hope you can help me,<br>
  Lukas</p>