Skip to content

Commit 892ca29

Browse files
committed
update build and readme
1 parent ed418dc commit 892ca29

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

.screenshots/buildwithEC2.jpg

54 KB
Loading

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ The goal here is to use EC2 to create a lambda packge using AWS linux, zip it up
3939
### Option 2: without an existing EC2 instance
4040
(this autoterminates and deletes its EBS after it finishes)
4141

42+
<video src=".screenshots/buildwithEC2.mp4" poster=".screenshots/buildwithEC2.jpg" controls preload></video>
43+
4244
In the EC2 console, launch a new instance with:
4345
- Amazon Linux AMI
4446
- Role with S3 write permission

build.sh

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,31 @@ sudo yum install -y git cmake gcc-c++ gcc python-devel chrpath
66
mkdir -p lambda-package/cv2 lambda-package/dlib build/numpy build/dlib
77

88
# download and make patchelf - this will let us quickly update dlib.so's LD_LIBRARY path
9-
#mkdir -p build/patchelf
10-
#(
11-
#cd build/patchelf
12-
#wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2 #https://github.com/NixOS/patchelf/archive/0.9.zip
13-
#tar xvfj patchelf-0.9.tar.bz2
14-
#cd patchelf-0.9 && ./configure && make && sudo make install
15-
#)
9+
mkdir -p build/patchelf
10+
(
11+
cd build/patchelf
12+
wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2 #https://github.com/NixOS/patchelf/archive/0.9.zip
13+
tar xvfj patchelf-0.9.tar.bz2
14+
cd patchelf-0.9 && ./configure && make && sudo make install
15+
)
1616

1717
# Build numpy
18-
pip install --install-option="--prefix=$PWD/build/numpy" numpy
18+
sudo yum -y install blas
19+
sudo yum -y install lapack
20+
sudo yum -y install atlas-sse3-devel
21+
pip install -U --install-option="--prefix=$PWD/build/numpy" numpy
1922
cp -rf build/numpy/lib64/python2.7/site-packages/numpy lambda-package
23+
mkdir lambda-package/lib
24+
cp /usr/lib64/atlas-sse3/liblapack.so.3 lambda-package/lib/.
25+
cp /usr/lib64/atlas-sse3/libptf77blas.so.3 lambda-package/lib/.
26+
cp /usr/lib64/atlas-sse3/libf77blas.so.3 lambda-package/lib/.
27+
cp /usr/lib64/atlas-sse3/libptcblas.so.3 lambda-package/lib/.
28+
cp /usr/lib64/atlas-sse3/libcblas.so.3 lambda-package/lib/.
29+
cp /usr/lib64/atlas-sse3/libatlas.so.3 lambda-package/lib/.
30+
cp /usr/lib64/atlas-sse3/libptf77blas.so.3 lambda-package/lib/.
31+
cp /usr/lib64/libgfortran.so.3 lambda-package/lib/.
32+
cp /usr/lib64/libquadmath.so.0 lambda-package/lib/.
33+
#find "lambda-package/numpy/" -name "**.so" | xargs strip
2034

2135
# Build OpenCV 3.2
2236
(
@@ -55,15 +69,15 @@ sudo yum install -y blas-devel boost-devel lapack-devel
5569
cd build
5670
git clone https://github.com/davisking/dlib.git
5771
cd dlib/python_examples/
58-
mkdir build && cd build
72+
mkdir build
73+
cd build
5974
cmake -D USE_SSE4_INSTRUCTIONS:BOOL=ON ../../tools/python
6075
cmake --build . --config Release --target install
6176
)
6277
cp build/dlib/python_examples/dlib.so lambda-package/dlib/__init__.so
6378
cp /usr/lib64/libboost_python-mt.so.1.53.0 lambda-package/dlib/
64-
chrpath -r '$ORIGIN' lambda-package/dlib/__init__.so
6579
touch lambda-package/dlib/__init__.py
66-
#patchelf --set-rpath '$ORIGIN' lambda-package/dlib/__init__.so
80+
patchelf --set-rpath '$ORIGIN' lambda-package/dlib/__init__.so
6781

6882
# This shape_predictor for dlib is useful for face recognition
6983
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2

0 commit comments

Comments
 (0)