Доброго времени суток!
Проблема:
увязать все четыре компонента Ubuntu 9.04, Matlab 7.10 (R2010a), Simulink 7.5 и компилятор GNU gcc/g++ 4.2.3.Неоходимо во время моделирования в среде Simulink перед этапом симуляции конвертировать существующую модель в C-код для ускорения последующего этапа. Конвертация происходит автоматически при выборе опции Accelerator или Rapid Accelerator из меню Simulation окна модели.
Пример:
Имеется простая модель, состоящая из интегратора, охваченного единичной обратоной связью. На вход модели подаётся единичный ступенчатый сигнал. Выход модели соединён со входом блока Scope. Используются принятые по умолчанию параметры моделирования (время моделирования 10 сек, метод ode45). При задании режима Normal всё работает. Однако, при выборе режима моделирования Accelerator после запуска модели на исполнение появляется диалоговое окно с сообщениями об ошибках
Error(s) encountered while building model "first_try"
Message | Source | Reported By | Summary
1. Build Error | first_try | Simulink | Error(s) encountered while building model "first_try"
2. Model error | Unknown | Simulink | Error(s) encountered while building model "first_try"
3. Model error | first_try | Simulink | Problem creating Accelerator MEX file for model "first_try". Error returned is: Error(s) encountered ...
В командное окно выводится дополнительная информация по ошибкам:
----------------------------------------------------------------------------------------
Warning: Using a default value of 0.2 for maximum step size. The simulation step size will be equal to or less than this value.
You can disable this diagnostic by setting 'Automatic solver parameter selection' diagnostic to 'none' in the Diagnostics page
of the configuration parameters dialog
### Building the Accelerator target for model: first_try
/home/alex/matlabXa/bin/mex -c COPTIMFLAGS="-O0 -fPIC -DNDEBUG " -I. -I../../.. -I/home/alex/matlabXa/simulink/include -I/home/alex/matlabXa/extern/include -I/home/alex/matlabXa/rtw/c/src -I/home/alex/matlabXa/work/slprj/accel/first_try -I/home/alex/matlabXa/work "first_try_acc.c"
Warning: You are using gcc version "4.3.3-5ubuntu4)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release//home/alex/matlabXa/bin/mex -c COPTIMFLAGS="-O0 -fPIC -DNDEBUG " -I. -I../../.. -I/home/alex/matlabXa/simulink/include -I/home/alex/matlabXa/extern/include -I/home/alex/matlabXa/rtw/c/src -I/home/alex/matlabXa/work/slprj/accel/first_try -I/home/alex/matlabXa/work "first_try_acc_data.c"
Warning: You are using gcc version "4.3.3-5ubuntu4)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/### Linking ...
/home/alex/matlabXa/bin/mex COPTIMFLAGS="-O0 -fPIC -DNDEBUG " -MATLAB_ARCH=glnxa64 -silent -outdir ../../.. first_try_acc.o first_try_acc_data.o -L/home/alex/matlabXa/bin/glnxa64 -lut -L/home/alex/matlabXa/bin/glnxa64 -lmwmathutil -L/home/alex/matlabXa/bin/glnxa64 -lippmwipt -L/home/alex/matlabXa/bin/glnxa64 -lmwsl_fileio
Warning: You are using gcc version "4.3.3-5ubuntu4)". The version
currently supported with MEX is "4.2.3".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release//usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
mex: link of ' "../../../first_try_acc.mexa64"' failed.
gmake: *** [../first_try_acc.mexa64] Error 1
### Real-Time Workshop build procedure for model: 'first_try' aborted due to an error.
---------------------------------------------------------------------------------
По умолчанию в Ubuntu 9.04 используется компилятор gcc 4.3.3, а Matlab R2010a для компиляции моделей необходим gcc 4.2.3.
Matlab R2010a поддерживает Ubuntu 8.04, 8.10, 9.04, and 9.10. (Может перейти на более раннюю версию?)
При попытке выполнить настройку компилятора из командной строки Matlab выдаётся следующее сообщение:
----------------------------------------------------------------------------------------
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mex -setup' command selects an options file that is
placed in ~/.matlab/R2010a and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in ~/.matlab/R2010a.
To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).
The options files available for mex are:
1: /home/alex/matlabXa/bin/gccopts.sh :
Template Options file for building gcc MEX-files
2: /home/alex/matlabXa/bin/mexopts.sh :
Template Options file for building MEX-files via the system ANSI compiler
0: Exit with no changes
Enter the number of the compiler (0-2):
0
-----------------------------------------------------------------------
Какие существуют варианты установки ещё одного компилятора в Ubuntu 9.04, чтобы использовать его только для Matlab?