LabVIEW Failed to Load Shared Library to a Real-Time Target

Updated May 11, 2023

Reported In

Hardware

  • CompactRIO Controller
  • CompactRIO Controller (Legacy)
  • PXI Controller

Software

  • LabVIEW Real-Time Module

Driver

  • NI-RIO
  • NI CompactRIO

Operating System

  • PharLap
  • VxWorks
  • NI Linux Real-Time

Issue Details

When deploying code to a Real-Time controller (CompactRIO, PXI, sbRIO, roboRIO, etc.), it fails with an error similar to the following:

<VI name>.vi loaded with errors on the target and was closed. LabVIEW: Failed to load shared library <Name of the Library>.*:RSIModule_PropBatch:C. Ensure that the library is present on the RT target. Use MAX to install NI software or FTP to transfer custom libraries to the RT target.​

Solution

Try out the below troubleshooting steps to resolve the Failed to Load Shared Library error:
  1. Make sure that your RT target has all the necessary drivers installed using Measurement & Automation Explorer (MAX). 
    1. For example if your application uses a serial driver and NI SoftMotion, make sure NI-Serial and NI-SoftMotion are installed on the controller. Try to redeploy or run the VI after installing software onto the RT target.
  2. If the software you need is not listed, please check in the Custom Installation option in the Software Wizard shown below.
    1. Toolkits like NI Sound and Vibration, NI SystemLink, and NI EtherNet/IP do not appear under the Recommend Software sets, but can be installed to real-time targets.
  1. If the software is still not listed, make sure that it is a toolkit or module that is compatible with LabVIEW Real-Time Module and your Real-Time Target.
  2. If the software is still not listed but it is part of a supported toolkit or add-on, it is possible that the toolkit is not installed properly on the development machine and so we need to correct the development software first. For example: some toolkits will have a Real-Time support option during installation.
  3. If you are building a shared library in a environment external to LabVIEW (from C++ Code, for example) make sure that all software dependencies are installed on the RIO. If you are using the Linux RTOS, you can do this using the OPKG package manager .
If the above steps do not resolve the error or you do not have any custom libraries or toolkits to install, please continue with the steps in LabVIEW: Failed to load shared library on RT Target. If the library referenced in the Failed to Load Shared Library error is a DLL, please continue with the steps in Failed to Load Shared Library DLL on a Real-Time Target Device.

Additional Information

  • This error usually occurs when code is deployed to a Real-Time target that does not have NI-RIO IO Scan installed.
  • Similar errors will also occur whenever your code contains VIs that rely on specific NI software that is not contained in the Run-Time Engine or not already installed on the real-time target.
  • Common missing components include the NI-RIO IO Scan, Network Variable Engine, Industrial Communciations, and Network Streams.
    • The missing component is typically indicated in the error description.
    • If you are implementing communication protocols, make sure you enable raw socket calls on the RIO.
  • If you have created a custom DLL in C/C++, make sure you are using the proper syntax. See the document in Related Links on Calling C/C++ DLLs in LabVIEW for examples of how to handle different datatypes.