Build .so On Target

The LabVIEW run-time engine on the target (BBB/RPI) runs inside a chroot, which is a Linux construct that is similar to a virtual machine. This allows the LV run-time to be installed and run safely on many different Linux operating systems. Shared objects must be built to run inside the chroot to be accessible from LabVIEW. The easiest way to ensure the shared object is built correctly is to build it inside the chroot on the target.

  • SSH into the target as a user with root privileges.

  • Run the following command to enter the chroot:
    sudo schroot --run-session -c lv


    Note that all of the following commands until exiting the chroot must be run inside the chroot or they will fail.

  • Install the build tools:
    sudo opkg update
    sudo opkg install packagegroup-core-buildessential


  • Optionally install git and gdb:
    sudo opkg install git
    sudo opkg install gdb


  • Build the .so

    • The actual process of building the .so will vary based on the project/source. There are many good tutorials for building shared objects on Linux available online.
  • Copy the .so to /usr/lib.
    Note that this is the /usr/lib directory inside the chroot. Outside of the chroot this directory is /srv/chroot/labview/usr/lib.

  • Call the .so from LabVIEW using the Call Library Function Node
    • Since /usr/lib is in the LabVIEW search path simply specify the .so name under Library name or path. For example 'myfirstobject.so'.
    • Under Thread choose Run in any thread to allow the .so to run in any thread rather than just the main thread.
  • Exit the chroot
    exit

Debugging

The .so will be loaded into memory the first time it is called using the CLFN in LabVIEW. To debug the .so attach to it using GDB before running the a VI.