Skip to main content
Skip table of contents

Building and testing

linux
CODE
apt-get update && apt-get install -y gcc g++ cmake ca-certificates valgrind libssl-dev libcrypto++-dev

Building for your local development platform

To build the library, run the following command in the terminal:

CODE
sh buildScripts/build.sh local

That will produce the following artefacts:

  • build/build/NativeInsightAgent-X.X.X-Platform-CPU.tar.gz - Static version of the library and headers

  • build/bin - Binary dummy/reference application that uses the library

Passing GCC Flags to the build

You may pass as many GCC flags to the build system through the GCC_FLAGS environment variable, as shown in the example below:

CODE
export GCC_FLAGS="-fstack-protector-all -pipe -Wl,-z,combreloc -Wa,--noexecstack -z`

Building for your target device using your platform toolchain

You will need two things:

  • Build OpenSSL using your toolchain and let the build system know where it is located.

  • Create a cmake toolchain file and let the build system know where it is located.

Build OpenSSL

Currently, the build system does not automatically download and build OpenSSL with your custom toolchain, so you will have to do it on your own.

Download OpenSSL

CODE
mkdir -p ~/cross-openssl/compiled-openssl && cd ~/cross-openssl
curl https://www.openssl.org/source/openssl-1.1.1h.tar.gz | tar -xz 
cd openssl-1.1.1h

Build OpenSSL with your toolchain

CODE
export INSTALL_DIR=~/cross-openssl/compiled-openssl
export TOOLCHAIN_BIN_DIR=/path/to/your/toolchain/bin

Set your OS name, for example, linux-armv4, and build OpenSSL

CODE
export TARGET_PLATFORM=linux-armv4
./Configure $TARGET_PLATFORM shared \
--prefix=$INSTALL_DIR --openssldir=$INSTALL_DIR/openssl \
--cross-compile-prefix=$CROSS_DIR/arm-linux-gnueabihf-
make depend
make install

Set the environment variable CMAKE_OPENSSL_ARGS so that the Insight Agent build system knows where to locate it

CODE
export CMAKE_OPENSSL_ARGS="-DOPENSSL_SSL_LIBRARY=~/cross-openssl/compiled-openssl/lib/libssl.a -DOPENSSL_CRYPTO_LIBRARY=~/cross-openssl/compiled-openssl/lib/libcrypto.a -DOPENSSL_INCLUDE_DIR=~/cross-openssl/compiled-openssl/include"

Building the Insight Agent with your toolchain

To build the library using a custom toolchain you must create a custom toolchain-file.cmake with the information about your toolchain. You can find some examples in the toolchain folder. You must also set the environment variable TOOLCHAIN_CMAKE_FILE with the path to such toolchain. For example:

CODE
export TOOLCHAIN_CMAKE_FILE=/path/to/toolchain/file/linux-arm32.cmake

Now that you have set up the toolchain file and the references to your build of OpenSSL with your toolchain in the environment variables, you may call:

CODE
sh buildScripts/build.sh device

That will produce the following artefacts:

  • build/build/NativeInsightAgent-X.X.X-Platform-CPU.tar.gz - Static version of the library and headers.

  • build/bin - Binary dummy/reference application that uses the library.

How to Test

To build and run the unit tests, run the command below in the terminal

CODE
sh buildScripts/test.sh
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.