[AWS] Setup Environment and Build Native Library (OpenCV, C++)

Developing log of Amazon Web Service (AWS).

Objective:

Deploy a JAVA Web Service on AWS.

Local Environment:

Eclipse Java EE, Tomcat 8.0, JNI native library

AWS Development Environment Setup:

AWS Toolkit for Eclipse:    AWS Toolkit for Eclipse Document

Generate a new RSA key and add it to GitHub: Link

Configure a HTTPS listener on load balancer:

http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-https-load-balancers.html

Build OpenCV 3.2.0 (include OpenCV Java)

Prepare necessary build tools:

# install required tools
sudo yum install git cmake gcc-c++

Clone from OpenCV GitHub repository:

 # get opencv GitHub repository git clone git@github.com:opencv/opencv.git # checkout specific version tag git checkout tags/3.2.0 

Use CMake to build opencv (release version, static library)


cd opencv

mkdir build

cd build

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=NO -DBUILD_opencv_python=OFF ..

make

sudo make install

OpenJDK 1.8:

Amazon Linux contains java-1.8.0-openjdk  but not java-1.8.0-openjdk-devel. In order to build OpenCV Java package, we need to install openjdk-devel. (error message example: Unable to locate tools.jar)


sudo yum install java-1.8.0-openjdk-devel

Ant 1.10.1:

Ant is also required to build OpenCV Java Wrappers. However, the version installed by yum install is no too low (1.8) which doesn’t support java-1.8.0.

Download Ant http://ant.apache.org/bindownload.cgi


wget http://www-eu.apache.org/dist//ant/binaries/apache-ant-1.10.1-bin.zip
unzip apache-ant-1.10.1-bin.zip

Export ANT_HOME as apache-ant folder and add ANT_HOME/bin to PATH

Add the following lines to .bashrc file


export ANT_HOME=~/apache-ant-1.10.1

export PATH=${PATH}:${ANT_HOME}/bin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: