The error "fl:filesystem:PathNotFound" during the build for a Simulink Real-Time (SLRT) model that contains an FMU can be due to one of the following reasons
1) Missing binary for Simulink Real-Time:
The cross-compiled binaries for SLRT must exist in a specific folder within the FMU file before generating code. Because of the different RTOS used by SLRT across releases, the expected binary type and location depend on the MATLAB version used:
- In R2026a and later, SLRT uses a 64-bit Linux-based RTOS. The Linux-compatible binary is expected inside the FMU in: /binaries/slrt_x64/<fmuFileName>.so
- In R2020b through R2025b, SLRT uses the 64-bit POSIX-compliant QNX® Neutrino® RTOS. The binary must be compiled with the proprietary QNX C/C++ compiler (qcc) and is expected inside the FMU in: /binaries/slrt_x64/<fmuFileName>.so
- In R2020a and earlier, SLRT uses the Win32 API-compatible 32-bit On-Time RTOS. The binary must be compiled with Visual Studio and is expected inside the FMU in: /binaries/win32/<fmuFileName>.dll
To obtain the SLRT-compatibly binary in the expected location, you need to do the following:
1. If the FMU includes no source code (located inside the "sources" folder in the FMU), contact the FMU supplier to either provide the SLRT-compatible binary as explained above, or to repackage the FMU with added (obfuscated) sources, so you can cross-compile the SLRT-compatible library on your end (see next step).
2. If the FMU includes source code, you can cross-compile the FMU for SLRT as follows:
- In R2022a and later, you can use the built-in slrealtime.fmu.compileFMUSources function. It automatically cross-compiles the FMU sources for SLRT and repackages the FMU with the ".so" library file in the expected location.
- In R2021b and earlier, you can use the attached 'compileFMU_slrt.m' file to achieve the same. Download the file attached at the top of the answer, and execute the following command to add the binaries required for Simulink Real-Time. This script will also work for R2020a and earlier.
>> compileFMU_slrt('fmuFileName.fmu',1)
2) Incorrect binary name:
The error can also occur if the name of the binary file does not match the name of the FMU. Change the binary file name to '<fmuFileName>.dll" (R2020a and earlier) or "<fmuFileName>.so" (R2020b and later) in the FMU file.
Further Reading:
See the following MATLAB Answers for more information about FMU support and creating compatible binaries for SLRT: