- Compiling Scilab 5.X and 6.X under Mac OS X
- Installation of necessary dependencies
- Getting the Scilab code and running the build
FAQ: Mac OS X issues
- Cannot locate tools.jar
- Since Scilab 5.3, only 64 bits is supported. Why that ?
- What is done to ensure the 64 bits build ?
- I have installed all Scilab dependencies through fink 32 bits and it fails
- The configure fails on the detection of libxml2
- Trying to install a package through fink with a Mac OS X 10.5, I get an error about xcode
- Scilab 5.3.0 beta 5 crashes on the startup
- JVM launched in a dedicated thread
- G77 troubleshooting
- Symbol not exported
- Running ant, I get ''Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher''
- Running ant, I get ''XML parser factory has not been configured correctly: Provider -n gnu.xml.aelfred2.JAXPFactory not found''
- If Scilab.app does not start
- I did some changes in the Info.plist of Scilab but my changes are not taken in account
- Installing gfortran using fink I get ''Can't resolve dependency "fink (>= 0.28.0)" for package "gettext-tools-0.14.5-4"''
- How Java paths are handled under Mac OS X ?
- While building, I get 'ld: codegen problem, can't use rel32 to external symbol'
- Java is failing to build on a basic class
- On startup, Scilab complains about the JNI version
- Trouble with pkg-config and matio
- Wrong version of libintl / conflict between versions
- Handle Mac OS X mouse
- Shortcut with Mac OS X
- Fink 64 bits
- I can't get matio with fink
- strace equivalent
- Error in the creation of the Java VM: JNI version error
- Howto to get information about library being loader by the linker
- Howto remove some archs from a dylib library
- Howto change the hardcoded paths in a dylib library
- Howto change the id of a dylib library
- Debugging on MacOS Sierra
- Running Scilab 6.0.1 on MacOS Mojave
Compiling Scilab 5.X and 6.X under Mac OS X
The instructions below apply to both 5.x and 6.x. They may not be complete, please feel free to add comments at the end.
Installation of necessary dependencies
Install the "Command Line Tools for Xcode" tools. It's in fact explained in the fink install page, so see next step
Installing fink will install XQuartz ; if not, install it by hand from http://xquartz.macosforge.org/landing/
- You can accept default configuration options.
- It will take some time...
- It may not be completely trivial to set up Fink to use XCode, but you can find help on Fink websites.
sudo fink index -f;fink selfupdate
sudo fink update-all
Change Fink to manage latest packages
sudo fink selfupdate-rsync
- Install ocaml
Optional, only needed to build the Scicos modelica compiler for XCos. Install from fink:
sudo fink install ocaml # which install ocaml-4.02.1-1
If ocaml isn't packaged in your package manager yet, you may install it from source at https://ocaml.org/releases/4.02.html
Otherwise, add --without-modelica to the ./configure command below.
Source control tools
svn is installed by default with Snow Leopard 10.6.4 (Subversion command-line client, version 1.6.5), or install from Fink:
sudo fink install svn
or as a Fink package:
sudo fink install git
A JDK is needed, as a lot of Scilab's code is in Java. For Scilab 5.5 and previous, the JDK is 1.6, which is present on Mac by default.
For Scilab 6, the JDK must be 1.8, and installed from Oracle's site at http://www.oracle.com/technetwork/java/javase/downloads/index.html .
You will then need to provide the build with the JDK's location. The easiest is to run:
export JAVA_HOME=`/usr/libexec/java_home -v '1.8*'`
Libraries needed by Scilab
See Dependencies of Scilab 5.X for details. All dependencies are available as Fink packages.
- Umfpack / FFTW3
sudo fink install suitesparse fftw3
sudo fink install libmatio2 libmatio2-shlibs
sudo fink install hdf5-18 hdf5-18-shlibs
- or for Mavericks/Yosemite:
sudo fink install hdf5.9 hdf5.9-shlibs
- If you get a '"/lib/cpp" does not pass the sanity check' error, you need to create a symbolic link from "/lib/cpp" to "/sw/bin/cpp-5" or whichever version of g++ you embark
sudo fink install libpcre1
sudo fink install ant
But that list is probably not complete. A complete list of library dependencies that worked recently is:
sudo fink install suitesparse sudo fink install fftw3 sudo fink install libmatio2 sudo fink install libmatio2-shlibs sudo fink install hdf5.8 sudo fink install hdf5.8-shlibs sudo fink install libpcre1 sudo fink install ant sudo fink install gettext-bin-0.19.3-1 sudo fink install gettext-tools-0.19.3-1 sudo fink install arpack-ng-3.1.5-3 sudo fink install pkgconfig-0.28-1 sudo fink install libcurl4-7.42.0-1+10.8 sudo fink install libmatio2-1.5.2-2
Getting the Scilab code and running the build
Get the source
- The source itself from Git
git clone git://git.scilab.org/scilab
- Some dependencies from SVN
cd scilab/scilab svn checkout --username anonymous --password Scilab svn://svn.scilab.org/scilab/trunk/Dev-Tools/SE/Prerequirements/macosx/bin bin svn checkout --username anonymous --password Scilab svn://svn.scilab.org/scilab/trunk/Dev-Tools/SE/Prerequirements/macosx/lib lib svn checkout --username anonymous --password Scilab svn://svn.scilab.org/scilab/trunk/Dev-Tools/SE/Prerequirements/macosx/thirdparty thirdparty svn checkout --username anonymous --password Scilab svn://svn.scilab.org/scilab/trunk/Dev-Tools/SE/Prerequirements/macosx/include include svn checkout --username anonymous --password Scilab svn://svn.scilab.org/scilab/trunk/Dev-Tools/SE/Prerequirements/macosx/java java
(note that the branch macosx has been merged with the master and is not used)
Select the right branch
- for 6.X: the code is on the 'master' branch so nothing to do
- for 6.0.X: the branch is '6.0', so run:
git checkout 6.0
Run the build
cd scilab # Use Fink to get the right tools & libraries . /sw/bin/init.sh # for Scilab 6 (branch master) don't forget to use java 6 (see above) export JAVA_HOME=`/usr/libexec/java_home -v '1.8*'` # (alternatively, adding this option to the ./configure command: # --with-jdk=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home # should do the job) # Some useful options for the command below: # - CC=gcc-5 CXX=g++-5 if you want to use GCC because Apple has the great idea of shipping a version of clang as /usr/bin/gcc! so specifying a version number will ensure that the Gnu gcc (in /sw/bin), not clang, is used. # - CFLAGS=-fdiagnostics-color=always CXXFLAGS=-fdiagnostics-color=always will color the output (warnings/errors/etc) # - --without-tk because Scilab includes tcl/tk by default, and (at least on Scilab 5.5) # there is an incompatibility between tcl/tk's threading model and the MacOS's # (probably an incompatibility of TK with the Apple Java VM, or more generally with Cocoa - to investigate) # - --with-eigen_include=`pwd`/lib/Eigen/includes to specify where to find the eigen libraries (added as third-party) # - If you don't have ocaml, you can add '--without-modelica' # The real thing! ./configure --without-openmp --without-tk --with-eigen_include=`pwd`/lib/Eigen/includes && make
If you used gcc-5 or -4 and are having an error in an Apple header (located in /usr/include/ or in /System/Library/), please edit modules/console/Makefile & modules/localization/Makefile to replace occurrences of "gcc-5" (/"gcc-4") by "clang". This is only a workaround at the moment, until one day Apple make their headers gcc-compatible.
At Scilab startup on Yosemite/El Capitan, if you have an error "JavaVM: Failed to load JVM: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/libserver.dylib", you need to create a symbolic link from "libserver" to "libjvm":
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/libserver.dylib or, should it not work: sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/libserver.dylib
In the line above, you may replace both "jdk1.8.0_102" with your installed Java version, found in "/Library/Java/JavaVirtualMachines/jdk1.8.*".
Packaging (Mac OS X style)
mkdir -p /path/to/Scilab.app/Contents/MacOS/ /path/to/Scilab.app/Contents/Resources/ ./configure --prefix=/path/to/Scilab.app/Contents/MacOS/ ... make install
Copy the etc/Info.plist to /path/to/Scilab.app/Contents/
Copy the icons/puffin.icns to /path/to/Scilab.app/Contents/Resources
FAQ: Mac OS X issues
Cannot locate tools.jar
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.4.2-gcj-220.127.116.11/lib/tools.jar Buildfile: build.xml
gcj is not supported by Scilab. Please try with the OpenJDK 6 or 7.
Since Scilab 5.3, only 64 bits is supported. Why that ?
Because Apple does not really care about their Mac OS X previous releases.
To have best performances and because it fixes many bugs, Scilab (since version 5.3) depends on a Java Virtual Machine (JVM) 1.6. This version of the JVM is only available as 64 bits (not 32 bits or PPC) and since Scilab needs to link against libjvm.dylib, Scilab needs also to be 64 bits ready.
What is done to ensure the 64 bits build ?
When a user/developer is building Scilab under Mac OS X, in the configure, we add the argument -arch x86_64 to gcc and g++ to make sure that the libraries are 64 bits.
I have installed all Scilab dependencies through fink 32 bits and it fails
You have to install fink running in 64bit-only mode. Basically, you have to do:
rm -rf /sw path/to/fink/bootstrap [...] Your hardware is a 64bit-compatible intel processor, so you have the option of running Fink in 64bit-only mode. This is not recommended for most users, since many more packages are available for the default mode (which is mostly 32bit but includes some 64bit packages). Which mode would you like to use? (1) Default (mostly 32bit) (2) 64bit-only Choose a mode:  2 [...] # Select the 64-bit only mode
The configure fails on the detection of libxml2
configure: error: libxml2 : library missing. (Cannot find symbol xmlReaderForFile). Check if libxml2 is installed and if the version is correct
In the configure, linking against libxml2 is one of the first test on third party libraries. Usually, if the library is available, that means that the library is not available in x86_64 mode. For example, with fink:
file $(dpkg -L libxml2-shlibs|grep dylib) /sw/lib/libxml18.104.22.168.dylib: Mach-O dynamically linked shared library i386 # should be /sw/lib/libxml22.214.171.124.dylib: Mach-O dynamically linked shared library x86_64
Trying to install a package through fink with a Mac OS X 10.5, I get an error about xcode
Can't resolve dependency "xcode (>= 3.1.2)" for package "gcc44-4.4.1-1000" (no matching packages/versions found)
Download a more recent version of Xcode. For example from:
Scilab 5.3.0 beta 5 crashes on the startup
If the error message is the following:
Symbol not found: _libiconv_open Referenced from: /Applications/scilab-5.3.0-beta-5.app/Contents/MacOS/lib/thirdparty//libintl.3.dylib Expected in: /Applications/scilab-5.3.0-beta-5.app/Contents/MacOS/lib/thirdparty//libiconv.2.dylib
try a nightly build or a more recent version. See bug #8460 for more information
JVM launched in a dedicated thread
Under Mac OS X, launching a JVM from a C code requires the dedicated thread Example. This is done in modules/shell/src/c/others/mainscic.c (see #ifdef APPLE)
- Seems my Mac is seen as a 64-b CPU and need a clever Fortran compiler.
- g77 seems not to be so good.
- Install g95 :
fink install g95
- Install g95 :
Symbol not exported
Mac OS X linker handles library's symbols differently from GNU/Linux. See bug 3740 for more information.
Running ant, I get ''Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher''
should fix your issue.
Running ant, I get ''XML parser factory has not been configured correctly: Provider -n gnu.xml.aelfred2.JAXPFactory not found''
fixes the problem.
If Scilab.app does not start
Have a look to /var/log/system.log to see if there are any error messages.
I did some changes in the Info.plist of Scilab but my changes are not taken in account
Try to touch the directory: touch Scilab.app it should flush the Info.plist.
Installing gfortran using fink I get ''Can't resolve dependency "fink (>= 0.28.0)" for package "gettext-tools-0.14.5-4"''
Try fink index -f
How Java paths are handled under Mac OS X ?
While building, I get 'ld: codegen problem, can't use rel32 to external symbol'
We had this issue once. It was due to a file built but unused. We just removed the symbol and it fixed the issue. Don't ask why!
Java is failing to build on a basic class
[javac] /Users/sylvestreledru/git/scilab/scilab/modules/gui/src/java/org/scilab/modules/gui/utils/WebBrowser.java:15: cannot find symbol [javac] symbol : class Desktop [javac] location: package java.awt [javac] import java.awt.Desktop;
This is usually caused because, for some reasons, the Java used by an version 1.5 while it should be 1.7. The following command should fix it:
On startup, Scilab complains about the JNI version
This occurs in some cases when Scilab is built with the option -framework JavaVM. This option is linking Scilab against the library /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM which is Java 1.5. Since Scilab is built with Java 1.6, it conflicts on the JNI version.
Erreur lors de la création de la Machine Virtuelle Java : Erreur de version JNI
Trouble with pkg-config and matio
if you have not installed pkg-config (try in command line 'which pkg-config'), install it:
- sudo fink install pkgconfig
Wrong version of libintl / conflict between versions
dyld: Library not loaded: /sw/lib/libintl.8.dylib Referenced from: /sw/bin/tar Reason: Incompatible library version: tar requires version 10.0.0 or later, but libintl.8.dylib provides version 9.0.0
This probably comes from the update of fink, in case you use it. The solution is to copy /sw/lib/libintl.x.x.x.dylib (latest version of the library) to scilab.app/Content/MacOSX/lib/thirdparty/. At startup, the PATH order is changed to /sw/bin;/usr/bin, so when looking for tar, it goes straight to sw. fink (which maintains the sw folder) being updated, the version between the libintl that /sw/bin/tar uses and the one packaged in Scilab differ, and we can't load an already loaded library. Tar doesn't see its version of libintl, so refuses to load.
Handle Mac OS X mouse
Shortcut with Mac OS X
Fink 64 bits
I can't get matio with fink
In the file /sw/etc/fink.conf, add stable/crypto unstable/main unstable/crypto to the Trees line :
Trees: local/main stable/main stable/crypto unstable/main unstable/crypto
sudo dtruss -f <program> sudo dtruss -f <program> 2> trace.log
Error in the creation of the Java VM: JNI version error
under 10.5, you may have this error. launch java preferences, uncheck java 10.5 and relaunch scilab.
Howto to get information about library being loader by the linker
will display which libraries are being loaded.
Howto remove some archs from a dylib library
lipo -remove <arch>
Howto change the hardcoded paths in a dylib library
install_name_tool -change /sw/lib/libintl.3.dylib @executable_path/../lib/thirdparty/libintl.3.dylib lib/scilab/libscilab.dylib
Howto change the id of a dylib library
install_name_tool -id @executable_path/../lib/thirdparty/libmatio.2.dylib libmatio.2.dylib
Debugging on MacOS Sierra
At the moment, gdb & apple-gdb have trouble with Sierra, so lldb is favored to debug Scilab.
For bin/scilab -nwni -debug to launch lldb instead of gdb, you need to replace in bin/scilab:
line "$SCI"/libtool --mode=execute gdb $SCILAB_GDB_OPT --args "$SCILABBIN" "$@"
by "$SCI"/libtool --mode=execute lldb $SCILAB_GDB_OPT -- "$SCILABBIN" "$@"
install_name_tool -id @executable_path/../lib/thirdparty/libmatio.2.dylib libmatio.2.dylib
Mac OS X Scilab 6.0.1 - MacOSX 64 bits, (scilab-6.0.1-x86_64.dmg - 224M) (dmg)
Running Scilab 6.0.1 on MacOS Mojave
You have to remove some libraries bundled with Scilab. In order that you just have to copy/paste the following commands in the terminal, make sure that you have copied scilab 6.0.1 to the /Applications folder:
After removing these libraries, Scilab should start. However, you may be prompted to install an old Java version, which is available at the following url: