Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mathematica does not recognize C Compiler

733 views
Skip to first unread message

Joao

unread,
Jul 16, 2013, 5:54:28 AM7/16/13
to
Hi, I would like to ask for some help regarding C Compilers in Mathematica.

The problem I have is that Mathematica does not recognize the presence of a C Compiler.

When I do CCompilers[Full] it returns:

{{Name->Intel Compiler,Compiler->CCompilerDriver`IntelCompiler`IntelCompiler,CompilerInstallation->None,CompilerName->Automatic},{Name->Generic C Compiler,Compiler->GenericCCompiler,CompilerInstallation->None,CompilerName->Automatic}}

And when I do CCompilers[ ] it returns { }

Also,

DefaultCCompiler[]

NVCCCompiler

I have Windows 7 Ultimate 64 bits.

I followed this thread:
http://mathematica.stackexchange.com/questions/5487/how-do-i-get-mathematica-to-recognize-a-c-compiler-on-a-64-bit-windows-machine

and installed two C Compilers: one via .NETFramework and Windows SDK 7.1, the other one was the 64 bit MinGW.
Unfortunetely Mathematica 8 still does not recognize any C Compiler.

I tried
$CCompiler = {"Compiler" -> GenericCCompiler,
"CompilerInstallation" -> "C:……Path",
"CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};

After this i tried CCompiler[ ] and the output was:

{"Compiler" -> GenericCCompiler,
"CompilerInstallation" -> "C:……Path",
"CompilerName" -> "x86_64-w64-mingw32-gcc.exe"}

Nevertheless, when I do CCompiler [ ] the result shows nothing again.

Regarding the Microsoft CCompiler, I’m not sure what executable file is appropriate, I read somewhere that it should be cl.exe but I can’t find this file anywhere. As you can see I am not very familiar with this subject.

Could you let me know what I am doing wrong here?

I really need to speed up some code.

Thanks in advance

Joao

Joel Klein

unread,
Jul 17, 2013, 1:46:31 AM7/17/13
to
On 7/16/2013 4:57 AM, Joao wrote:
> Hi, I would like to ask for some help regarding C Compilers in Mathematica.

I'll be glad to help.

>
> The problem I have is that Mathematica does not recognize the presence of a C Compiler.

It is convenient if Mathematica recognizes compiler installations, but
not strictly necessary. You can set $CCompiler, as you did, and then use
it. Let's debug what you tried.

> I have Windows 7 Ultimate 64 bits.
>
> I followed this thread:
> http://mathematica.stackexchange.com/questions/5487/how-do-i-get-mathematica-to-recognize-a-c-compiler-on-a-64-bit-windows-machine
>
> and installed two C Compilers: one via .NETFramework and Windows SDK 7.1, the other one was the 64 bit MinGW.

Which version of Visual Studio did you install? And what is the exact
file path that you installed it to?

> Unfortunetely Mathematica 8 still does not recognize any C Compiler.
>
> I tried
> $CCompiler = {"Compiler" -> GenericCCompiler,
> "CompilerInstallation" -> "C:……Path",
> "CompilerName" -> "x86_64-w64-mingw32-gcc.exe"};

If you set $CCompiler, then you can just try using it -- try a hello,
world example like CreateExecutable["#include <stdio.h\nint main(){
printf(\"Hello!\\n\"); }", "hello"]. Did you try using it with this setting?

> Regarding the Microsoft CCompiler, I’m not sure what executable file is appropriate, I read somewhere that it should be cl.exe but I can’t find this file anywhere. As you can see I am not very familiar with this subject.

Yes, cl.exe is the right executable. But you shouldn't need to specify
that for Visual Studio.

There is a known bug in Mathematica 8's CCompilerDriver when using
non-latin characters in any of the file paths: compiler location, user
home directory, or any explicitly provided file path. I wonder if that
is part of your difficulties.

--Joel Klein, Kernel Developer
Wolfram Research


João Paulo Pereira

unread,
Aug 8, 2013, 12:05:33 AM8/8/13
to

Hi, Joel,

Thanks for your comment. First of all I apologize for the late reply. Work
and then holidays got in the way.

The immediate thing I noticed from your comment was the problem with the
path name. In fact my path included the string "Joao" with a tilde in the *a
*. I already changed that.

The version of Visual C++ I have installed is the 2008 one. At least that's
what appears in the control panel.

However the cl executable is at:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin

I setup the CCompiler with the visual studio

$CCompiler = {"Compiler" -> GenericCCompiler,
"CompilerInstallation" ->
"C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin",
"CompilerName" -> "cl.exe"};

Which it recognizes when I do $CCompiler it returns

{"Compiler" -> GenericCCompiler,
"CompilerInstallation" ->
"C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\bin",
"CompilerName" -> "cl.exe"}

It seems fine but when I do the hello example it fails

In fact CCompilers[] returns nothing

There is still something I am missing here.

tks

Joao


















On Wed, Jul 17, 2013 at 6:50 AM, Joel Klein <jfk...@wolfram.com> wrote:

> On 7/16/2013 4:57 AM, Joao wrote:
> > Hi, I would like to ask for some help regarding C Compilers in
> Mathematica.
>
> I'll be glad to help.
>
> >
> > The problem I have is that Mathematica does not recognize the presence
> of a C Compiler.
>
> It is convenient if Mathematica recognizes compiler installations, but
> not strictly necessary. You can set $CCompiler, as you did, and then use
> it. Let's debug what you tried.
>
> > I have Windows 7 Ultimate 64 bits.
> >
> > I followed this thread:
> >
> http://mathematica.stackexchange.com/questions/5487/how-do-i-get-mathematica-to-recognize-a-c-compiler-on-a-64-bit-windows-machine
> >
> > and installed two C Compilers: one via .NETFramework and Windows SDK
> 7.1, the other one was the 64 bit MinGW.
>
> Which version of Visual Studio did you install? And what is the exact
> file path that you installed it to?
>
> > Unfortunetely Mathematica 8 still does not recognize any C Compiler.
> >
> > I tried
> > $CCompiler = {"Compiler" -> GenericCCompiler,
> > "CompilerInstallation" -> "C:=85=85Path",
0 new messages