You are here: Start » Using Library on Linux
Using Library on Linux
Requirements
Adaptive Vision Library Lite is designed to be used with GCC compiler on Linux x86_64, embedded ARMv7-A and ARMv8‑A systems.
Currently gcc
in version 5.4 is supported,
and corresponding toolchains for embedded linux: arm-linux-gnueabihf-
, aarch64-linux-gnu-
.
Custom build can be prepared upon the earlier contact with Adaptive Vision team.
The Adaptive Vision Library Lite is distributed as .tar.gz
archive.
The library is compatible with Debian-like system, including - but not limited to - Ubuntu distributions.
Common prerequisites
Properly set locale on target computer is important.
Non-existing locale will cause bugs and bad behavior.
To list locale that exists on your computer use: locale -a
,
and currently set: locale
.
Remember that running your application as daemon from ie. systemd may set different locale,
than the one in your user terminal.
Refer to your Linux distribution documentation.
Libraries needed to link programs:
libopenmp
libpthread
librt
libdl
Runtime libraries for libavl:
libudev
For some examples to build, additional libraries listed below may be needed:
libgtk-3-dev / libgtk2.0-dev
libsdl-dev
qt5
To build example in simple manner, GNU Make tool is needed.
To install all development requirements (including examples):
sudo apt-get install libudev1 g++ make libgtk-3-dev libsdl-dev qtbase5-dev
To install only libavl development requirements:
sudo apt-get install libudev1 g++ make
Compilation instructions
Directory structure
Unpacked directory consists of following entries:
examples/
- directory contains source files of example programs written with Adaptive Vision Library Liteinclude/
- this directory contains library header fileslib/
- here the .so file with library is stored, along with any kitsbin/
- directory for additional binaries, like Licensing tool./README
- instruction of library usage/sha512sum
- checksums for all files in archive, check withsha512sum --quiet -c sha512sum
/system
- file containing information about the optimal target system - contains lines for OS, architecture, specific optimizations
Compilation
For compiling with Adaptive Vision Library Lite please remember to:
- add the
include/
subdirectory to the compiler include directories:-I
switch - add the
lib/
subdirectory to the linker directories:-L
switch - link with Adaptive Vision Library Lite:
-lavl
switch - use
-rpath
in linker options,LD_LIBRARY_PATH
orLD_PRELOAD
oflibavl.so
file. - link with dependencies:
-fopenmp -lpthread -lrt -ldl
One can consult makefile in the examples/ directory to see how to compile and link with Adaptive Vision Library Lite.
Licensing and distribution
Licensing
File based licenses are supported on all Linux platforms. Dongle licenses depend on CodeMeter runtime. Currently codemeter runtime is available for x86_64 and ARMV7-A. To develop and debug programs written with Adaptive Vision Library Lite, Library license has to be present. To run compiled binaries linked with Adaptive Vision Library Lite, LibraryRuntime license has to be present.
One can use license_manager
from bin/
directory to list currently installed file or dongle licenses: license_manager -l
File License
To obtain license:
- In a terminal, on the target machine run
license_manager --id
frombin/
directory - Copy the printed Computer ID
- Use that Computer ID to get a
.key
file from User Area on www.adaptive-vision.com website. - Download the key to the target machine
- Run in terminal
license_manager -i downloaded_file.key
Dongle License
Installed CodeMeter Runtime is required, as well as proper license available on plugged in dongle.
Download runtime package from WIBU website,
section "CodeMeter User Runtime for Linux".
"Driver Only" (lite) version recommended for headless (no desktop GUI) installations.
ARMV7-A is available under "CodeMeter User Additional Downloads" as "Raspberry PI" version
Distribution
To distribute program with Adaptive Vision Library Lite, one have to provide license (file or dongle - depending on system used) and the libavl.so
.
To provide the .so
file, one can install SDK on target machine, but this will provide headers etc., which may be unwanted.
In such case, the library file, with any used kits should be copied to suitable system directory,
or the program has to be compiled with -rpath
and relative path to the .so file.
Third option is to provide a boot script,
which will set LD_LIBRARY_PATH
or LD_PRELOAD
with libavl.so
location.
Program development - general advise
The most convenient way to make programs with Adaptive Vision Library Lite for Linux is to develop vision algorithm using Adaptive Vision Studio on Windows and then generating C++ code. This code can be further changed or interfaced with rest of the system and tested on Windows. Then, cross-compiler can be used to prepare Linux build, which will be provided to target machine. It is easy to organize work this way, because:
- developing vision algorithm using plain C++ is hard, troublesome and error prone, but Adaptive Vision Studio makes it easy,
- programs written with Adaptive Vision Library Lite on Windows can be easily debugged using Visual Studio thanks to provided debug visualizers and the Image Watch extensions to Visual Studio,
- cross compilation using virtualization solution, like Vagrant, is easy and fast, and does not force developer to use two systems simultaneously.
Of course, the programs can be also developed on Linux machine directly. Then a dose of work should be put into writing good Makefile. Debugging can be done by GDB, but we do not provide debug symbols for Adaptive Vision Library Lite.