JeVois  1.16
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Compiling JeVois core software from source

JeVois core software is in a repository called jevois and located at https://github.com/jevois

Compiling JeVois core software from source is only supported on Ubuntu Linux (version 16.10 amd64 recommended).

Before you attempt to compile JeVois, you should go through the INSTALL instructions at least once. As part of this, you will download all JeVois core software and all necessary Ubuntu packages.

Theory

The JeVois core software is written in C++-17. It provides code for video capture from a camera sensor, video output to a USB link, serial communications, basic low-level image processing functions, support for creating more advanced machine vision algorithms from collections of components with runtime-tunable parameters, and support for loading/unloading machine vision modules at runtime.

The JeVois core software is configured and compiled using CMake.

It can be compiled natively on your Linux computer (host mode), in which case video will be captured from any connected camera, and video output will be to your computer's display. It can also be cross-compiled for the CPU inside the JeVois smart camera (platform mode), in which case video will be captured from the video sensor inside the JeVois camera, and video output will be streamed over the USB link.

Getting the source code from GitHub

cd
git clone https://github.com/jevois/jevois.git

We also strongly recommend that you get the other JeVois source code repositories from GitHub:

git clone https://github.com/jevois/jevoisbase.git
git clone https://github.com/jevois/samplemodule.git
git clone https://github.com/jevois/samplepythonmodule.git
git clone https://github.com/jevois/jevois-tutorials.git

and, for JeVois-A33:

git clone https://github.com/jevois/jevois-sdk.git

or, for JeVois-Pro:

git clone https://github.com/jevois/jevoispro-sdk.git

SDK needed to cross-compile code

To compile jevois, jevoisbase, samplemodule, etc for host, you can just proceed to the next section.

To cross-compile these for platform, you first need the JeVois SDK installed, as it will provide ARM libraries needed to cross-compile. The easiest is to install jevois-sdk-dev or jevoispro-sdk-dev debian files, as detailed in JeVois Ubuntu packages and source code repositories

JeVois-A33: Full reconfiguration and compilation

There are two ways to compile software for JeVois-A33:

  • host: compiles natively on your amd64 desktop for execution on that amd64 desktop. Use this during development as it allows you to compile your code on your desktop and then test it immediately using a regular webcam. Of course, some modules will not work on desktop, for example if they use ARM-specific NEON instructions. But in general this is the fastest way to develop and debug new machine vision modules.
  • platform: cross-compiles on your desktop code for ARM target processor, which is the architecture used in JeVois-A33. The cross-compiled files will be stored in a staging area (/var/lib/jevois-build and /var/lib/jevois-microsd) that can then be flashed to microSD.

Scripts are provided to recompile everything:

  • rebuild-host.sh will
    • Compile natively for your computer's CPU
    • Object files will be in hbuild/ which the script creates
    • Executables will be installed to /usr/bin
    • Include files to be used by module developers will be installed in /usr/include/jevois
    • JeVois config files will be installed in /jevois (to match their location on the platform hardware). This is also where you should install machine vision modules for JeVois.
    • Thus, all files and executables are ready to use immediately on your computer.
  • rebuild-platform.sh will
    • Cross-compile for the ARM CPU inside the JeVois smart camera
    • Object files will be in pbuild/ which the script creates
    • Config files used by JeVois at runtime will be staged into /var/lib/jevois-microsd/config/ and will later be installed into /jevois/config/ on the actual microSD card.
    • Executables including jevois-daemon will be staged into /var/lib/jevois-build/usr/bin/ and will later be installed into /usr/bin/ on the actual microSD card.
    • Include files will be staged into /var/lib/jevois-build/usr/include/jevois/ and will later be installed into /usr/include/jevois/ on the actual microSD card.
    • The core JeVois library (libjevois.so) will be staged into /var/lib/jevois-build/usr/lib/ and will later be installed into /usr/lib/ on the actual microSD card.
    • Documentation files are staged into /var/lib/jevois-build/usr/share/doc/jevois-platform/ and will be installed into /usr/share/doc/jevois-platform/ on the actual microSD card.
    • Thus, because all target files are stored into the staging area, they will be ready to be flashed to microSD that can then be inserted into your JeVois smart camera.

The main executable that is created is jevois-daemon, which basically implements a JeVois Engine that will orchestrate the flow of data from camera sensor to machine vision processing to video streaming over USB. See The jevois-daemon executable for more info.

JeVois-Pro: Full reconfiguration and compilation

There are three ways to compile software for JeVois-Pro:

  • host: compiles natively on your amd64 desktop for execution on that amd64 desktop. Use this during development as it allows you to compile your code on your desktop and then test it immediately using a regular webcam. Of course, some modules will not work on desktop, for example if they use the NPU. But in general this is the fastest way to develop and debug new machine vision modules.
  • platform: cross-compiles on your desktop code for arm64 target processor, which is the architecture used in JeVois-Pro. Typically, you would only need to run this if you want to place support files in a staging area (/var/lib/jevoispro-build and /var/lib/jevoispro-microsd) that can then be referenced when you compile other modules that will need to link against or otherwise use those files.
  • platform-pdeb: cross-compiles on your desktop code for arm64 target processor of JeVois-Pro, and creates a native arm64 deb package that you can later copy to your microSD and install on JeVois-Pro. Typically, you would do this once you have tested and debugged a new machine vision module in host mode, and you are now ready to try it out on the JeVois-Pro camera.

Scripts are provided to recompile everything:

  • rebuild-pro-host.sh will
    • Compile natively for your computer's CPU
    • Object files will be in phbuild/ which the script creates
    • Executables will be installed to /usr/bin
    • Include files to be used by module developers will be installed in /usr/include/jevois
    • JeVois config files will be installed in /jevoispro and this is also where machine vision modules and shared data for JeVois-Pro will be installed later.
    • Thus, all files and executables are ready to use immediately on your computer.
  • rebuild-pro-platform.sh will
    • Cross-compile for the ARM CPU inside the JeVois-Pro smart camera
    • Object files will be in ppbuild/ which the script creates
    • Config files used by JeVois at runtime will be staged into /var/lib/jevoispro-microsd/config/
    • Executables including jevois-daemon will be staged into /var/lib/jevoispro-build/usr/bin/
    • Include files will be staged into /var/lib/jevoispro-build/usr/include/jevois/
    • The core JeVois library (libjevoispro.so) will be staged into /var/lib/jevoispro-build/usr/lib/
    • Documentation files are staged into /var/lib/jevoispro-build/usr/share/doc/jevoispro-platform/
    • Thus, because all target files are stored into the staging area, they will be ready to be used as dependencies when you try to compile jevoisbase or new custom machine vision modules.
  • rebuild-pro-platform-pdeb.sh will
    • Cross-compile for the ARM CPU inside the JeVois-Pro smart camera
    • Object files will be in ppdbuild/ which the script creates
    • A deb package will be created that should be installed on the camera while logged on the camera.
    • File locations are the same as above for host.

The main executable that is created is jevoispro-daemon, which basically implements a JeVois Engine that will orchestrate the flow of data from camera sensor to machine vision processing to video display over HDMI. See The jevois-daemon executable for more info.

Here is a walkthrough of what you should see when compiling jevois and jevoisbase from source for JeVois-Pro:

Partial re-compilation

The scripts rebuild-host.sh, rebuild-platform.sh, etc clear and recompile everything. This takes a while.

You should run them at least once.

Then, if you are just changing a few files, you can only recompile what is needed, as follows:

  • JeVois-A33: for host
    cd hbuild
    make -j
    sudo make install
    make doc     # optional; if desired
    
  • JeVois-A33: for platform
    cd pbuild
    make -j
    sudo make install
    
  • JeVois-Pro: for host
    cd phbuild
    make -j
    sudo make install
    make doc     # optional; if desired
    
  • JeVois-Pro: for platform support files
    cd ppbuild
    make -j
    sudo make install
    
  • JeVois-Pro: for platform native deb
    cd ppdbuild
    make -j
    sudo make install
    sudo cpack # will re-generate the deb package into ppdbuild/jevoispro-platform_XXX_arm64.deb with arm64 arch.
    # You can then copy this file to microSD, switch JeVois-Pro to console boot, then
    # `apt remove jevoispro-platform` to nuke the existing version and then `dpkg -i <your_new_deb>`.
    
Note
When you apt remove jevoispro-platform it will also remove jevoisprobase-platform. So make sure you have compiled it and packed it as a deb ready to install, using the instructions at Compiling JeVoisBase software from source

Advanced configuration flags

The scripts rebuild-host.sh, rebuild-platform.sh, etc pass down any command-line arguments to cmake. Available flags include (see CMakeLists.txt in jevois/ for the latest):

  • -DJEVOIS_LDEBUG_ENABLE=ON Enable debug-level messages. Those are turned off by default so that they do not use any CPU and do not slow down operations. Turning them on is useful for low-level debugging. Beware that some sections of the USB streaming code are time-critical and may fail (i.e., give USB errors) when LDEBUG is enabled. Note that This just enables LDEBUG statements to be compiled. To see them at runtime, you also need to set the loglevel parameter to debug level, see UserCli for info about the loglevel parameter.
  • -DJEVOIS_TRACE_ENABLE=ON Enable function tracing, which will issue a message (at the LDEBUG level) each time a particular function is entered, and another when it is exited. Functions that you want to trace need to have a JEVOIS_TRACE(level) statement in them. Because trace messages are at the LDEBUG level, if LDEBUG is not enabled (see above), trace messages will not be seen.
  • -DJEVOIS_USE_SYNC_LOG=ON Uses synchronous logging, i.e., we wait until each log message is printed out before continuing execution. This interferes with time-critical code sections, such as anything related to USB streaming. Hence, by default, logging in JeVois is asynchronous, messages are just pushed into a queue without waiting for them to be printed out, and a separate thread then prints them out. This asynchronous logging eliminates most slowdown due to logging, but it may be confusing when debugging things that interact with the Linux system or kernel, as the order in which JeVois messages versus syslog messages will appear may not reflect the true ordering of what happened.
  • -DJEVOIS_LOG_TO_FILE=ON Enable sending all log messages to file jevois.log instead of console. Only works with async logging.