Building liboni#

Build in Linux#

For build options, look at the top level Makefile. The Makefile is self-documenting. You can examine options using:

$ make help

To build and install liboni use

$ make <options>
$ make install PREFIX=/path/to/install

to place build artifacts in whatever path is specified by PREFIX. PREFIX defaults to /usr/lib/include. You can uninstall (delete headers and libraries) via

$ make uninstall PREFIX=/path/to/uninstall

To make a particular driver, navigate to its location within the drivers subdirectory and:

$ make <options>
$ make install PREFIX=/path/to/install

Then update the dynamic library cache via:

$ ldconfig

Performance Testing#

Install google perftools:

$ apt-get install google-perftools

Check what library is installed:

$ ldconfig -p | grep profiler

If libprofiler.so is not there, but libprofiler.so.x exists, create a softlink:

$ sudo ln -rs /path/to/libprofiler.so.x /path/to/libprofiler.so

Link the profiler into test the programs during compilation using:

$ cd liboni-test
$ make profile

Run the firmware program to serve fake data. Provide a numerical argument specifying the number of fake frames to produce. It will tell you how long it takes host to sink all these frames. This is host processing time + UNIX pipe read/write.

$ cd bin
$ ./firmware 10e6

Run the host program while dumping profile info:

$ env CPUPROFILE=/tmp/host.prof ./host

Examine output

$ pprof ./host /tmp/host.prof

Memory Testing#

Run the firmware and host programs as described above with valgrind using full leak check on host:

$ valgrind --leak-check=full ./host

Build in Windows#

Open the included Visual Studio Community solution and press play. For whatever reason, it seems that the selected startup project is not consistently saved with the solution. So make sure that it is set to oni-repl in the solution properties.