Help
Contents
1. Compilation problems
1.1. Error when compiling MATLAB
1.1.1. Windows
Under Windows, if the BCVTB is compiled using the Microsoft compiler, then the MATLAB libraries also need to be compiled with the Microsoft compiler. If, however, the gcc compiler has been used when compiling the BCVTB, then the following compilation error may be obtained when compiling the MATLAB libraries:
Writing library for establishBSDSocket.mexw32 c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_establishclientsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_exchangewithsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_closeipc'
To fix this problem, open Matlab, run
mex -setup
and select the Microsoft Visual C++ compiler from the menu. This need to be done only once as it updates your Matlab settings.
1.1.2. Linux Ubuntu 10.10 64-bit
In MATLAB R2010b, the command
cd lib/matlab ant all
may fail with the error message
Warning: You are using gcc version "4.4.4-14ubuntu5)". The version [exec] currently supported with MEX is "4.3.4". [exec] For a list of currently supported compilers see: [exec] http://www.mathworks.com/support/compilers/current_release/ [exec] [exec] /usr/bin/ld: cannot find -lstdc++ [exec] collect2: ld returned 1 exit status [exec] [exec] mex: link of ' "establishBSDSocket.mexa64"' failed. [exec] [exec] ??? Error using ==> mex at 208 [exec] Unable to complete successfully. [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simuli>> nk/+legacycode/@LCT/compile.p>compile [exec] at 264 [exec] [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simulink/+legacycode/@LCT/legacyCodeImpl.p>legacyCodeImpl [exec] at 84 [exec] [exec] [exec] Error in ==> legacy_code at 87 [exec] [varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, [exec] varargin{1:end}); [exec] [exec] Error in ==> compile at 90 [exec] legacy_code('compile', def, ... [exec]
This problem is caused by /usr/bin/ld not finding the stdc++ library. As a work-around, proceed as follows:
Type
sudo emacs ~/.matlab/R2010b/mexopts.sh
In the section glnxa64) , change the line
CLIBS="$CLIBS -lstdc++"
to
CLIBS="$CLIBS"
Now, the command ant all should work and produce the files libbcvtb_thunk_glnxa64.so, establishBSDSocket.mexa64, exchangeDoublesWithBSDSocket.mexa64 and closeBSDSocket.mexa64.
2. Runtime problems
The following steps typically help analyzing problems if a simulation program does not work as expected.
2.1. Check program output
By default, the Simulation actor in Ptolemy writes a copy of the console output of the simulation program to a file called simulation.log. This file can typically be found in the directory from which the simulation program has been started.
2.2. Check log files
If something goes wrong during the simulation, check the files simulation.log, utilSocket.log and utilClient.log. They contain log messages that may indicate the cause of the problem. If these files do not exist, go to the directory bcvtb/lib, open the file defines.h and add the line
#define NDEBUG
Then, from the directory bcvtb/lib/util compile the libraries using
ant clean all
and rerun the simulation. Now the log files should be written to the directory from which you started the BCVTB.
2.3. Memory problem
If the following error occurs:
java.lang.OutOfMemoryError: Java heap space
then increase the Java heap space by running vergil with the command
java -jar path_to_bcvtb\bin\BCVTB.jar -Xmx1024m system.xml
The argument -Xmx1024m declares how much memory is allocated. The default for Java is -Xmx128m
2.4. Wrong Java version
The following error occurs if a too old Java version is used:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
To fix this problem, update your Java.