Skip to content

Prerequisites for C Compiler

njpipeorgan edited this page Oct 31, 2019 · 16 revisions

MathCompile depends on a C++ compiler that supports C++17 standard to compile Wolfram Language functions to machine code. The compiler used is often chose automatically, but it can be override by CCompilerDriver`$CCompiler, see the Documentation for more information.

Unix-like

GCC 7 or higher

To manually switch to GCC,

CCompilerDriver`$CCompiler = CCompilerDriver`GCCCompiler`GCCCompiler;

Clang 4 or higher

To enable Clang on Linux, set $CCompiler with the installation path and specify the compiler name, e.g.

CCompilerDriver`$CCompiler = {
  "Compiler" -> CCompilerDriver`GenericCCompiler`GenericCCompiler,
  "CompilerInstallation" -> "/usr/bin",
  "CompilerName" -> "clang++"
};

Intel C++ Compiler 19 or higher

Intel C++ compiler is freely available to students and open source contributors, Intel Parallel Studio XE.

To enable Intel C++, set $CCompiler with the installation path, e.g.

CCompilerDriver`$CCompiler = {
  "Compiler" -> CCompilerDriver`IntelCompiler`IntelCompiler,
  "CompilerInstallation" -> "/opt/intel/bin"
};

Windows

Microsoft Visual C++ 19.20 or higher

MSVC is available as part of Microsoft Visual Studio. MSVC 19.20 corresponds to the initial version of Visual Studio 2019. Alternatively, build tools for Visual Studio (available here) can be installed without the IDE.

To manually switch to MSVC, set $CCompiler with the installation path, e.g.

CCompilerDriver`$CCompiler = {
  "Compiler" -> CCompilerDriver`VisualStudioCompiler`VisualStudioCompiler,
  "CompilerInstallation" ->
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community"
};

Mingw-w64

Mingw-w64 supports GCC on Windows for x86-64 targets. It is freely available through SourceForge.

During the installation, choose GCC version 7 or higher and x86_64 architecture. Be aware that the installation path should not contain spaces.

With a installation path of C:\mingw-w64, set $CCompiler as follows:

CCompilerDriver`$CCompiler = {
  "Compiler" -> CCompilerDriver`GenericCCompiler`GenericCCompiler,
  "CompilerInstallation" -> "C:\\mingw-w64\\mingw64\\bin",
  "CompilerName" -> "g++.exe"};
Clone this wiki locally