RTI Connector: Installing on Windows using npm

RTI Connector for Connext DDS is a convenient way of using scripting languages (JavaScript, Python, or Lua) to access a DDS Database. This article describes how to install it for the various programming languages. 

RTI Connector is available through the RTI Labs website (https://www.rti.com/labs), from the RTI github account(https://github.com/rticommunity/rticonnextdds-connector), or can be installed quickly using npm, the Node(.js) Package Manager.

Some extra steps may be needed when installing RTI Connector on a Windows PC:

Windows System Preparation:

1. Install Node.js (https://nodejs.org).

Ensure the node and npm binaries are included in your system's PATH environment variable. 
This can be easily checked by opening a command window and entering:

where node.exe

If found in your PATH, it should return something like: C:\Program Files\nodejs\node.exe
If not found, add the install location of Node.js to the PATH. 

 

2. Install the correct version of the RTI DDS Windows Target Libraries

As this is an experimental product, it supports specific combinations of Host OS and Target Libraries.
These are:
32-bit Windows Versions: i86Win32VS2010
64-bit Windows Versions: x64Win64VS2013
Be certain the environment variables are set correctly:
    NDDSHOME = RTI Installation directory
    PATH = %NDDSHOME%\bin;%NDDSHOME%\lib\[target lib dir];%PATH%

 

3. Python (v2) and Microsoft Visual Studio:

These tools are required by the npm package installation for RTI Connector. 
Complete installations of Python and Visual Studio may be done if desired, or a reduced set of build tools can be installed using the following steps: 
(skip these steps if your system already has Visual Studio and Python installed).

  • Install Microsoft .NET Framework (version 4.5.1 or greater).
  • Install "Windows Build Tools" using npm.
    • Open a command window in Administrator mode
    • Run the command: 
        npm install --global --production windows-build-tools
    • This will install (as of this writing)
      • Python (v2.7.13)
      • Windows Build Tools (v14)
        • NOTE that installation of Windows Build Tools normally takes a few minutes and may present a GUI for installation/status.  The installation may silently fail if its requirements are not met.   See "Error MSB3411" below.

4. Use npm to install RTI Connector

With the above completed, setting up RTI Connector using npm is easy:

  • Open a command window.
  • create an empty directory and cd into it (using command prompt).
  • Enter the command: npm init
    • This creates a json file for the project
  • Enter the command: npm install rticonnextdds-connector
    • This will install and build RTI Connector and some example projects.  A few warnings may be present, but no errors:

Successful npm build of connector

  • cd into the directory: node_modules\rticonnextdds-connector\examples\nodejs
  • open a second command window
    • An easy way to do this: enter the command: start
  • In the first command window:
    • Enter the command: node simple\writer
    • You should see:
C:\devl\c2\node_modules\rticonnextdds-connector\examples\nodejs>node simple\writer
Writing...
Writing...
Writing...   

This indicates that the DDS writer is publishing.

  • In the second command window:
    • Enter the command: node simple\reader
    • You should see:
C:\devl\c2\node_modules\rticonnextdds-connector\examples\nodejs>node simple\reader
Waiting for samples...
Waiting for samples...
{"color":"BLUE","x":7,"y":14,"shapesize":30}
 Waiting for samples...
{"color":"BLUE","x":8,"y":16,"shapesize":30}

 This indicates the DDS reader has subscribed and is receiving data from the publisher.

 

If something did not go as planned:


Error MSB3411 during "npm install rticonnextdds-connector"
npm install error msb3411
The npm install & build process cannot find the Windows build tools (VCBuild.exe), which could mean the tools are not installed, or they're not found in the PATH.

If Visual Studio has been installed: run the 'vcvarsall.bat' script (located in the Visual Studio installation folders) in your npm command window to properly set up the environment for code building

If Windows Build Tools have been installed (per the above steps), the installation might have silently failed, and the tools are not actually installed.

The BuildTools_Full.exe installer program can be run manually to help determine the cause of the installation trouble.  The location for this installer is typically found in:
     [user's home dir]\.windows-build-tools\BuildTools_Full.exe


Run this installer program -- it may reveal the cause of the trouble, such as if the .NET framework was not installed:

Build tools installation error

This (above) error is fixable by installing the Microsoft .NET framework, as earlier explained.


Running the example fails with a 'Dynamic Linking Error'

For example:

C:\devl\c2\node_modules\rticonnextdds-connector\examples\nodejs>node simple\writer
C:\devl\c2\node_modules\ffi\lib\dynamic_library.js:74
 throw new Error('Dynamic Linking Error: ' + err)
 ^
 Error: Dynamic Linking Error: Win32 error 126
 at new DynamicLibrary (C:\devl\c2\node_modules\ffi\lib\dynamic_library.js:74:11)
 at Object.Library (C:\devl\c2\node_modules\ffi\lib\library.js:45:12)
 at Object.<anonymous> (C:\devl\c2\node_modules\rticonnextdds-connector\rticonnextdds-connector.js:51:16)
 at Module._compile (module.js:635:30)
 at Object.Module._extensions..js (module.js:646:10)
 at Module.load (module.js:554:32)
 at tryModuleLoad (module.js:497:12)
 at Function.Module._load (module.js:489:3)
 at Module.require (module.js:579:17)
 at require (internal/module.js:11:18)

This indicates that the Correct RTI Target Library (DLL) cannot be found in the present environment.
Ensure that the instructions above (2. Install the correct version of the RTI DDS Windows Target Libraries) have been followed and the correct libraries and environment variables have been set up.

 


Error: Cannot find module './build/Release/node_sleep.node

If running the simple\writer or reader application results in an error:

C:\devl\c2\node_modules\rticonnextdds-connector\examples\nodejs>node simple\writer
module.js:471
   throw err;
   ^ 
Error: Cannot find module './build/Release/node_sleep.node'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\devl\connector-tmp\node_modules\sleep\index.js:1:75)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

 This can be caused by attempting a build before the corect components (such as .NET) are installed.

This can be fixed by a performing a clean/rebuild:

  • Delete the node_modules directory in your project directory.
  • Enter the command npm install

Now you can reinstall using npm (it will rebuild):

  • Enter the command: npm install rticonnextdds-connector

Try to run the simple/writer & reader example program again.
If it results in the same error, it may be necessary to remove the offending component from the node cache.
This can be done by:

  • Enter the command: npm cache clean --force
    • This command will give warnings about 'are you sure you know what you're doing?' 
    • This command will empty the contents of the node cache, which can affect other node application on your system -- Proceed with Caution.