Skip to content

Instantly share code, notes, and snippets.

@d2rk
Created December 4, 2016 11:37
Show Gist options
  • Save d2rk/2b4b0d40b2587d5816987f7e103e4410 to your computer and use it in GitHub Desktop.
Save d2rk/2b4b0d40b2587d5816987f7e103e4410 to your computer and use it in GitHub Desktop.
dlib for AWS lambda
$ wget --no-check-certificate -P /tmp http://flydata-rpm.s3-website-us-east-1.amazonaws.com/patchelf-0.8.tar.gz
$ tar xvf /tmp/patchelf-0.8.tar.gz -C /tmp
$ cd /tmp/patchelf-0.8 && ./configure && make && sudo make install
$ sudo yum install -y blas-devel boost-devel lapack-devel gcc-c++ cmake python-devel git
$ git clone https://github.com/davisking/dlib.git
$ cd dlib/python_examples/
$ mkdir build && cd build
$ cmake -D USE_SSE4_INSTRUCTIONS:BOOL=ON ../../tools/python
$ cmake --build . --config Release --target install
$ cd ..
$ mkdir ~/dlib
$ cp dlib.so ~/dlib/__init__.so
$ cp /usr/lib64/libboost_python-mt.so.1.53.0 ~/dlib/
$ touch ~/dlib/__init__.py
$ patchelf --set-rpath '$ORIGIN' ~/dlib/__init__.so
@bobmoff
Copy link

bobmoff commented Feb 20, 2018

Hi, I am trying to get dlib running with openblas/blas support on aws lambda but keep getting these errors:

libblas.so.3: cannot open shared object file: No such file or directory

or

libopenblas.so.0: cannot open shared object file: No such file or directory

i guess it has something to do with me not compiling dlib correctly, and perhaps i am by mistake compiling it as a shared library or, at least the openblas library is not getting compiled into the dlib package. i am a total noob to c++ and this world so i was wondering if you would have any tips on how to get rid of this issue.

when building the library i get this message at the end that makes me believe that the dependencies are not built statically.
Linking CXX shared library libdlib.so
[100%] Built target dlib_shared

if i dont install any blas library i can access the dlib in my lambda function without any problem, but then the performance of the face detection is decreased 20x.

any ideas? any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment