Short version: What's the simplest way to use MacPorts' gcc with CreateLibrary
?
Long version:
CreateLibrary
uses /usr/bin/gcc
by default on OS X. I can get it to use clang
by using the option "CompilerName" -> "clang++"
or "CompilerName" -> "c++"
(I'm using C++).
However, I would like to use MacPorts' gcc because it boosts the performance significantly for this particular program I need to compile. It also supports OpenMP; the system compiler doesn't. "CompilerName" -> "g++-mp-5"
tells me that
CreateLibrary::instl: The compiler installation directive "CompilerInstallation" -> "/usr/bin" does not indicate a usable installation of "GCC"
So I tried "CompilerInstallation" -> "/opt/local/bin"
, which is the location of g++-mp-5
. This results in the same error:
CreateLibrary::instl: The compiler installation directive "CompilerInstallation" -> "/opt/local/bin" does not indicate a usable installation of "GCC"
Is there a simpler solution than using GenericCCompiler?
CCompilerDriver`
package. You might be surprised at how simplistic the checks are for whether a compiler is "usable" or not. No doubt one could arrive at some fairly simple modifications to the package to make it work properly. $\endgroup$CCompilerDriver`
package is not "supplied as an example" (or so one would suppose), modifying it would contravene the Mathematica licence. $\endgroup$CCompilerDriver`
how to interface with the compiler. So, while there isn't an "example" of how to do it, you could learn how by looking at the packages supplied. $\endgroup$"Compiler" -> CCompilerDriver`GCCCompiler`GCCCompiler
, in addition to"CompilerInstallation"
and"CompilerName"
. $\endgroup$