Encountering Error 258 at create_lib_dir When Building Simulink Model for Linux RT with VeriStand

Updated Jun 3, 2021

Reported In

Software

  • VeriStand
  • Simulink

Issue Details

I'm attempting to build a Simulink model with VeriStand for deployment on a Linux Real-Time target, but am encountering the below error when executing the build:

line 0: syntax error near unexpected token `('
line 0: `if not exist "C:\VeriStand\<Version>\ModelInterface\tmw\lib\x86_64\gcc\4.9.2\<Simulink
Version>\RELEASE"\ (mkdir "C:\VeriStand\<Version>\ModelInterface\tmw\lib\x86_64\gcc\4.9.2\<Simulink Version>\RELEASE")' cs-make: *** [create_lib_dir] Error 258

What is the cause of this error?

Solution

This error is generally caused by IT or security measures on the build computer causing conflicts with the cross compilation being attempted by gcc during the build of your model. Preventing this error for all models usually requires an analysis of security software and IT policies in place on the build computer to detect programs that could be interfering with the build, but some quicker steps that can be taken to address the issue for a single build or as follows:

  1. Ensure that you're running MATLAB and VeriStand as an administrator when attempting to build your model.
  2. Attempt to run the .bat file for your build directly using the command prompt. The .bat file should be named <model name>.bat or something similar - you can run it by navigating to its file location in command prompt and entering the name of your .bat file.
  3. Edit your .bat file to remove references to the create_lib_dir command, and its definition. You should comment out the below code block in the .bat file:
create_lib_dir :

               @if not exist "$(subst /,\,$(NIVERISTAND_LIB_DIR))"\ (mkdir "$(subst
/,\,$(NIVERISTAND_LIB_DIR))")

and delete any other references to create_lib_dir in the .bat file. once this is done, try building your model again.

Additional Information

The line commented out of the .bat file in step 3 above is used to create a directory for build libraries for the model in case it doesn't exist. This location usually already exists, so removing this line, which causes the error, does not impact the functionality of the build.