Scilab is an easy programming language associated with a rich collection of numeric algorithms for covering most aspects of computational and scientific problems.
- 1 Cloning
- 2 Compiling
- 3 Using Scilab with Hybrid Graphics and Ubuntu
- 4 Examples
- 5 Hacking
- 6 Collaborators within Lab Macambira
Cloning the Scilab repository. It is a large project - you will be downloading over 300MB of code.
$ git clone git://git.scilab.org/scilab
After cloning the git repository, a good approach for installing the required dependencies is:
$ sudo apt-get build-dep scilab
$ sudo aptitude build-dep scilab
Probably there will be a couple of dependencies which are required to be more recent than the installed one. Look around the internet for them.
For the master branch, I had problems with libjgraphx (latest one was not available in Ubuntu 11.10).
- Download it from official site.
- Extract and enter jgraphx/lib/
$ sudo cp jgraphx.jar /usr/share/java/jgraphx-22.214.171.124.jar $ sudo ln -sf /usr/share/java/jgraphx-126.96.36.199.jar /usr/share/java/jgraphx.jar
The master branch also asked for updated flexdock >= 0.5.3, jrosetta and jlatexmath. The graphic branch asked for scirenderer:
- Download them from
- The remaining steps are like those given above for jgraphx.
If configure complains of missing arpack, download from the link shown by configure, then compile and install it as usual. Type 'ldconfig' and then get back to compiling Scilab. If there is still any problems related to arpack/arpack-ng, try the dirty fixes in these bug reports:
- http://forge.scilab.org/index.php/p/arpack-ng/issues/689/ (comment 1)
If the proposed solutions above do not work, you can disable the compilation of ARPACK. Instead of using ". / Configure", do this:
$ ./configure --without-arpack-ng
If configure complains of missing jogl2, this is a recently introduced problem in Scilab master branch. See
- You might have to compile jogl and gluegen from source by following this: http://jogamp.org/jogl/doc/HowToBuild.html
$ make $ sudo make install
Build the documentation
$ make doc
Warning: this takes a long time! go sip a cup of acerola juice while you wait.
If the run scilab this error appears on the screen:
"Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap","
To fix, do this:
$ sudo apt-get install gtk2-engines-pixbuf
If you switch branches, e.g., from 5.3 and master (6.0), and then type 'make', you will obtain some crazy random errors; do not forget to type 'make distclean' after every branch switch ans start it *all* again.
Mac OS X
These instructions were tested in Mountain Lion (10.8.3) on a early 2013 macbook pro.
Basically follow most fink instructions from . Then when you run the ./configure script you might have to omit the HDF flags. Also, many of the required java dependencies (.jar files) are met by following similar instructions to the Linux instructions above.
When compiling gluegen/jogl you might have to do this work-around fix for a bug in finding java:
- Note, however, that I had to use the cheating method below because the latest jogl2 from git breaks Scilab API compatibility (gives a compile error)
Cheating: Getting dependency jar's from nightly build
You can download a nightly build for OS X, then install it. You can then steal the .jar's from this nightly build to be used with your own build, for instance if configure complains of jhall our javahelp2 you can just do something like this:
sudo cp -i /Applications/scilab-master-1369319834.app/Contents/MacOS/thirdparty/jhall.jar /usr/share/java
Certain dependencies are installed by hand.
- arpack-ng: I had to do the work-around edit of Makefile.am's as indicated in http://forge.scilab.org/index.php/p/arpack-ng/issues/1220/ then typing "automake" then "./configure" etc
- I used macports to install some dependencies. Some of them needed changing in order to be detected by scilab, e.g., for docbook I had to manually add a suitable path
for dir in $with_docbook $SCI_SRCDIR_FULL/thirdparty/docbook/ /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/docbook2X/xslt/ma then typing autoconf prior to the next ./configure
- In Mavericks I switched compilers.. not sure if it was needed, but I was able to compile scilab by choosing gcc:
port install gcc_select port select --list gcc port select --set gcc mp-llvm-gcc42
Using Scilab with Hybrid Graphics and Ubuntu
Hybrid Graphics is a concept where the machine works with integrated graphics and discrete graphics of a GPU at the same time (switching between the both). Some machines and GPUs(graphical cards) are shipped with such concept, e.g. NVidia cards with Optimus Tech. If you wanna your machine with Linux to work properly with such tech, including running programs like Scilab, until the date( ~ 07/2012) you have few options, one then is provided by the Bumblebee Project.
The proper initialization of Scilab, under bumblebee daemon, is >optirun scilab
- See the code organization at: http://doxygen.scilab.org/master_wg/
- We work at the master branch (future 5.4), but you can try YaSp (future 6.x)
- See a description of the branches 
- You might have to setup a working branch with the scilab team for pushes. If the agreed upon branch is, e.g., gsoc2012-interactions, then you must do:
mv .git/hooks /tmp/ cd .git/ ln -s ../git_hooks/ hooks
The .git/config should look like something like that (substitute your user name)
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = ssh://firstname.lastname@example.org:29418/scilab push = gsoc2012-interactions:refs/for/gsoc2012-interactions [branch "gsoc2012-interactions"] remote = origin merge = refs/heads/gsoc2012-interactions rebase = true
See some additional Git settings at http://wiki.scilab.org/gerrit
Debugging e Profiling
See Debugging Scilab 5 at the Scilab wiki
They suggest KDbg as a graphical debugger, but it doesn't seem to be in synaptic. Therefore, ddd continues to be the best graphical debugger in our opinion.
Also see some useful kcachegrind tips in User:v1z's blog.
Searching the source code
There is a simple utility scisearch to search inside scilab code, see Utils.
Hacking Journal - xgetmouse
- xgetmouse is written in Java. The file is in scilab/modules/gui/src/java/org/scilab/modules/gui/events/Jxgetmouse.java
- very useful: If you change Jxgetmouse.java, you only have to type "make" inside scilab/modules/gui/src. this will recompile only this part. Then you invoke './bin/scilab' inside the scilab top directory, and you're all set! No need for a time-consuming toplevel make or make install!!
- scilab core calls xgetmouse java from C++
- a JVM gets started in C++ at scilab/modules/gui/src/jni/Jxgetmouse.cpp
- developer writes the .java, as well as a .xml (scilab/modules/gui/src/jni/Jxgetmouse.giws.xml) to interface it with scilab (enabling a scilab language call xgetmouse to get java)
- the tool to get the xml and generate the .cpp and is called GIWS, developed by the Sciab team to ease calling Java inside C++
- there are other files which Im not sure if they are automagically generated:
- /scilab/modules/graphics/sci_gateway/c/sci_xgetmouse.c and /scilab/modules/gui/includes/CallJxgetmouse.h