title: How to import .so files (shared libraries) in AWS Lambda?
body: <p>I'm trying to deploy .so files on Lambda using layers. The files are compiled using Amazon Linux docker image. I uploaded the layer as a zip with required files in /lib/. However my code is not able to read the files.</p>
  
  <pre class="lang-py prettyprint-override"><code>from ctypes.util import find_library
  def lambda_handler(event, context):
      liblept=find_library('lept') # present in /opt/lib
      libpng=find_library('png') # present in Lambda's default library
      print(liblept) # gives None
      print(libpng) # gives libpng.so.4
  </code></pre>
  
  <p>I tried to add /opt/lib to <strong>LD_LIBRARY_PATH</strong> environment variable but it doesn't work. Turns out that LD_LIBRARY_PATH has /opt/lib by default-</p>
  
  <pre class="lang-py prettyprint-override"><code>print(os.environ.get("LD_LIBRARY_PATH"))
  
  </code></pre>
  
  <p><strong>output</strong></p>
  
  <pre><code>/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
  </code></pre>