Compiler for System Modeling
The system modeling functionality uses a C++ compiler to build executables for fast simulation of models. Simulation of models requires the installation of a compiler on your computer. If a supported compiler is already installed, it will be automatically detected and used, and no further action has to be taken.
The commands in this tutorial depend on the system modeling functionality being loaded. Please evaluate the following input before any others in the tutorial.
Installation of Supported Compilers
Windows
On Windows, a compiler can be installed evaluating the following command and following the shown steps:
Mac
Instructions for installing are available here.
Linux
On Linux, the functionality has been fully tested with GCC/G++ 8.5 (32-bit and 64-bit). It is likely that System Modeler will work with any C++ compiler that is compatible with that version, i.e. any GCC/G++ ≥ 8.5.
Instructions for installing are available here.
Compiler Verification and Configuration
This section describes the functionality available for verifying and changing the compiler settings. This is advanced functionality that most users will not need.
If the verification is not successful, the result will also contain a log from a test compilation, indicating the problem with the configuration.
The option is a list of rules specifying the compiler command, where it is found on the system, the version and advanced configuration options.
Advanced Compiler Configuration
It is also possible to construct a custom compiler configuration by modifying individual configuration options.
Name | Description |
"Command" | name of the compiler |
"Path" | path to executable |
"Version" | compiler version |
"PlatformSDKPath" | path to Mac SDK |
"TargetArchitecture" | 32- or 64-bit architecture |
"UserCFlags" | custom C compiler flags |
"UserCPPFlags" | custom C++ compiler flags |
When using clang++ from Xcode without installing the command-line tools, it is also necessary to specify "PlatformSDKPath". The platform SDKs are usually located in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs.
Flags given in "UserCFlags" or "UserCPPFlags" as a single string are passed on to the compiler unchanged, allowing very fine-grained control of the selected compiler.
Possible Issues with Antivirus and IT Security Policies
When a SystemModel is simulated, it is done by generating C++ code, which is compiled into an executable file that is running the actual simulation. By default, all of this takes place in the user's temporary directory. This can collide with some antivirus software and/or IT security policies enforced by the operating system.
If System Modeler is also installed, then it is possible to configure the working directory, which is shared between System Modeler and the system modeling functionality in the Wolfram Language.
If there is a directory where it is allowed to generate and execute files, the working directory can be changed in the General section of Global Options in System Modeler; if not, the antivirus and security policies have to be configured in such a way that there is a directory where the System Modeler user is allowed to create and execute executable files.