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.
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
I tried to add /opt/lib to LD_LIBRARY_PATH environment variable but it doesn't work. Turns out that LD_LIBRARY_PATH has /opt/lib by default-
print(os.environ.get("LD_LIBRARY_PATH"))
output
/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib