Building .so on target
This article is a stub. You can help LabVIEW Wiki by expanding it. Please improve this article if you can. |
This article or section needs to be wikified to meet LabVIEW Wiki's quality standards. Please help improve this article with relevant internal links. |
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.
1. SSH into the target as a user with root privileges.
2. 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. 3. Install the build tools:
- opkg update
- opkg install packagegroup-core-buildessential
4. Optionally install git and gdb:
- opkg install git
- opkg install gdb
5. If building updated versions of the Linx target libraries, install the additional development dependencies:
- opkg install --force-depends libc6-dev
- opkg install --force-depends libgcc-s-dev
- opkg install libstdc++-staticdev
6. 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.
6. 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.
7. 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.
8. 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.