Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6090791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:15:16+00:00 2026-05-23T12:15:16+00:00

I’m running Mathematica 8 on a MacOSX, trying to compile even the simplest program

  • 0

I’m running Mathematica 8 on a MacOSX, trying to compile even the simplest program to C. Anything having to do with C simply doesn’t work in Mathematica. I have GCC 4.2 installed; I’ve even reinstalled it multiple times with XCode. Here’s what I’m doing and the errors I’m getting:

First, I always evaluate the command

Needs["CCompilerDriver`"]

If I set the compilation target to C,

c = Compile[ {{x}}, x^2 + Sin[x^2], CompilationTarget -> "C"];

I get an error that reads: Compile::nogen : A library could not be created from the compiled function.

If I try to create a library,

demoFile = FileNameJoin[{$CCompilerDirectory,"SystemFiles","CSource","createDLL_demo.c"}];
lib = CreateLibrary[{demoFile},"testLibrary"]

I get an message $Failed. Wolfram says that this is because I don’t have a C compiler installed. I find that hard to believe because when I run

CCompilers[]

It tells me that I’ve got GCC installed: {{“Name” -> “GCC”,
“Compiler” -> CCompilerDriver’GCCCompiler`GCCCompiler,
“CompilerInstallation” -> “/usr/bin”, “CompilerName” -> Automatic}}

What’s more, terminal says I have GCC installed too!! Any help would be appreciated. I’d really like to compile Mathematica to C.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:15:16+00:00Added an answer on May 23, 2026 at 12:15 pm

    In this answer I’ll collect some debugging steps for similar problems, for future reference. Feel free to edit/improve them.

    If compiling to C code does not work from Mathematica 8,

    1. Check that you have a supported C compiler installed and it works (the obvious).

      Note that the compiler does not necessarily have to be in the PATH, at least on Windows/Visual Studio it doesn’t.

    2. Check that Mathematica recognizes the compiler

      << CCompilerDriver`
      CCompilers[]
      

      will list the compilers known to Mathematica.

    3. Check what commands Mathematica executes to compile the generated C code:

      Compiler`$CCompilerOptions = {"ShellCommandFunction" -> Print};
      Compile[{{x}}, x^2, CompilationTarget -> "C"];
      

      Note that with "ShellCommandFunction" -> Print the commands will not be executed, so you’ll need to re-set Compiler`$CCompilerOptions to {} after this step is complete to allow command execution again.

    4. Check the output/errors from the compiler:

      Compiler`$CCompilerOptions = {"ShellOutputFunction" -> Print};
      Compile[{{x}}, x^2, CompilationTarget -> "C"];
      

    These last two steps will hopefully give you enough clues to proceed. With this information you can check if the correct library / include paths are passed to the compiler (in the case of gcc/icc, look at the -L option which specifies library paths and the -I option which specifies include paths). Then check if the required include and library files are present at those paths.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.