Issues Specific to Programming on Sage
There are these certain question bothering me and my friend.
- How do you use the gcc compiler in sage?
- How do you know if compilation has been successful?
- What happens when a source file is recompiled?
Compiling changes to Sage is as simple as
- Changing code
- Running sage -b
- Trying your new code
See the developer guide, though that is focused more on making patches. Compilation is successful if it says compilation was successful. If the file is just a Python file, it is copied and bytecode-compiled to a different directory (local/lib/python/site-packages/sage/, I think); otherwise the Cython file is first translated to C, then compiled, then sent where it belongs.
Now, if you are interested in just happening to use the gcc in Sage, you would have to first know if it had actually been built (as opposed to using your system gcc), which only happens if gcc is "too old" or in some cases "too new", and then call that binary (I'm not exactly sure where it installs), and then do whatever you normally do.
If that is all a little vague, it's because your question is likewise vague; I'm sure someone will be happy to answer a followup. For instance, many people create new Cython files and use the notebook to profile them. See the Sage documentation for more about all of these things.
Regarding gcc compiler in Sage: it is mainly there, as kcrisman says, because certain versions of gcc on certain platforms are known to be buggy (for example gcc in the recent releases of Xcode on OS X Lion). It is mainly used to build the various components of Sage: when you run make, if the Sage installation procedure decides that your platform requires a build of gcc, it builds gcc as early as possible, and then uses it to build everything else.
If Sage builds gcc, then it is also used when (re)compiling Cython files. (If Sage doesn't build gcc, then the system gcc is used instead.)
When you ask "how do you know if compilation has been successful?" do you mean compilation of Sage itself? The best thing to do is
$ export SAGE_CHECK=yes $ make ptestlong
The first line turns on self-tests for every Sage package which has them. The second line builds Sage and then runs its "long" test suite, in parallel. (If you mean compilation of any program using Sage's gcc, this is not really Sage-specific. Sage's installation of gcc should be a fully functional version of gcc.)