worldwidemv / SimulinkBlock_RehaMove3

The RehaMove3 block for the Soft-Realtime Simulink toolbox found at https://github.com/worldwidemv/SimulinkToolchain.
GNU General Public License v3.0
3 stars 3 forks source link

Simulink build fails #2

Closed redgene closed 1 year ago

redgene commented 4 years ago

Hello @worldwidemv !

The toolbox seems to install perfectly in Matlab, but when we try to build the project in Simulink, there is a consistent error. Is there an issue with the makefile / incompatibility with the versions?

Annotation 2020-06-26 050519

Diagnostics:

### Starting build procedure for: test_RehaMove3_block__LowLevel1
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: /home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux
### Invoking Target Language Compiler on test_RehaMove3_block__LowLevel1.rtw
### Using System Target File: /home/utkarsh/Desktop/SimulinkToolchain/ert_linux/ert_linux/ert_linux.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
    ### Writing header file test_RehaMove3_block__LowLevel1_types.h
.
    ### Writing header file test_RehaMove3_block__LowLevel1.h
    ### Writing header file rtwtypes.h
    ### Writing source file test_RehaMove3_block__LowLevel1.cpp
    ### Writing header file test_RehaMove3_block__LowLevel1_private.h
    ### Writing source file test_RehaMove3_block__LowLevel1_data.cpp
    ### Writing header file rtmodel.h
.
    ### Writing source file ert_main.cpp
### TLC code generation complete.
.
### Processing Template Makefile: /home/utkarsh/Desktop/SimulinkToolchain/ert_linux/ert_linux/ert_linux.tmf
Found legacy make variables |>START_MDLREFINC_EXPAND_INCLUDES<|, |>END_MDLREFINC_EXPAND_INCLUDES<|, |>MODELREF_INC_PATH<| in the template makefile /home/utkarsh/Desktop/SimulinkToolchain/ert_linux/ert_linux/ert_linux.tmf. The variables are no longer required. You can remove the variables. [3 similar]
Component:Simulink | Category:Model warning
### Creating /home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux/test_RehaMove3_block__LowLevel1.mk from /home/utkarsh/Desktop/SimulinkToolchain/ert_linux/ert_linux/ert_linux.tmf
### Building test_RehaMove3_block__LowLevel1: /usr/local/MATLAB/R2020a/bin/glnxa64/gmake -f test_RehaMove3_block__LowLevel1.mk OPTS="-DTID01EQ=0 -DWITH_HW"  OPTIMIZATION_FLAGS=-O3 SINGLE_LINE_COMMENTS=1 GENERATE_ASAP2=0 ISPROTECTINGMODEL=NOTPROTECTING
### Build procedure for test_RehaMove3_block__LowLevel1 aborted due to an error.
g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC   -DTID01EQ=0 -DWITH_HW  -O3 -DMODEL=test_RehaMove3_block__LowLevel1 -DNUMST=1 -DNCSTATES=0 -DUNIX -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DMT=0 -I. -I.. -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/home/utkarsh/Desktop/SimulinkToolchain -I/home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2020a/rtw/c/ert -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated       "test_RehaMove3_block__LowLevel1_data.cpp"
g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC   -DTID01EQ=0 -DWITH_HW  -O3 -DMODEL=test_RehaMove3_block__LowLevel1 -DNUMST=1 -DNCSTATES=0 -DUNIX -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DMT=0 -I. -I.. -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/home/utkarsh/Desktop/SimulinkToolchain -I/home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2020a/rtw/c/ert -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated       "/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src/RehaMove3Interface_SMPT32X.cpp"
g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC   -DTID01EQ=0 -DWITH_HW  -O3 -DMODEL=test_RehaMove3_block__LowLevel1 -DNUMST=1 -DNCSTATES=0 -DUNIX -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DMT=0 -I. -I.. -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/home/utkarsh/Desktop/SimulinkToolchain -I/home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2020a/rtw/c/ert -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated       "/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src/block_RehaMove3_01.cpp"
g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC   -DTID01EQ=0 -DWITH_HW  -O3 -DMODEL=test_RehaMove3_block__LowLevel1 -DNUMST=1 -DNCSTATES=0 -DUNIX -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DMT=0 -I. -I.. -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/home/utkarsh/Desktop/SimulinkToolchain -I/home/utkarsh/Desktop/SimulinkToolchain/test_RehaMove3_block__LowLevel1_ert_linux -I/usr/local/MATLAB/R2020a/extern/include -I/usr/local/MATLAB/R2020a/simulink/include -I/usr/local/MATLAB/R2020a/rtw/c/src -I/usr/local/MATLAB/R2020a/rtw/c/src/ext_mode/common -I/usr/local/MATLAB/R2020a/rtw/c/ert -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level -I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated       "test_RehaMove3_block__LowLevel1.cpp"
g++   -o ../test_RehaMove3_block__LowLevel1 RehaMove3Interface_SMPT32X.o block_RehaMove3_01.o test_RehaMove3_block__LowLevel1.o test_RehaMove3_block__LowLevel1_data.o     /home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/lib/libsmpt.a    -lrt -lpthread -lm
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
gmake: *** [../test_RehaMove3_block__LowLevel1] Error 1

Error(s) encountered while building "test_RehaMove3_block__LowLevel1"

MATLAB:

>> srt_InstallSRT

Installation of the Soft-Realtime Simulink Toolbox
===================================================

### Running ERT_Linux installation:
   -> ERT_LINUX Target Path Setup Complete.

### Running install script for "SimulinkBlock_RehaMove3": install_LIB_RehaMove3.m
TODO: copy udev rules
   -> done.

====================================================================
Running the build scripts now. You can run the build script also with the "srt_CreateLib" command.

Building the "Soft-Realtime Simulink Toolbox" ....

   -> Closing the Simulink library (this can take a while) ...  done
   -> Running the individual build scripts ...

** LIB_RehaMove3 *******************************

### Start Compiling sfunc_RehaMove3_01
    mex('-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated', '-c', '-outdir', '/tmp/tp7916fc50_3747_45e3_9eb7_711a2864ba3b', '/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src/RehaMove3Interface_SMPT32X.cpp')
Building with 'g++'.
MEX completed successfully.
    mex('-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated', '-c', '-outdir', '/tmp/tp7916fc50_3747_45e3_9eb7_711a2864ba3b', '/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src/block_RehaMove3_01.cpp')
Building with 'g++'.
MEX completed successfully.
    mex('sfunc_RehaMove3_01.cpp', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/srcRehaMove_LibV3.2/src', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/general', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/low-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/include/mid-level', '-I/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/auto_generated', '/home/utkarsh/Desktop/SimulinkToolchain/SimulinkLib_linux64/SimulinkBlock_RehaMove3/incRehaMove_LibV3.2_lin_x86_64/lib/libsmpt.a', '-cxx', '/tmp/tp7916fc50_3747_45e3_9eb7_711a2864ba3b/RehaMove3Interface_SMPT32X.o', '/tmp/tp7916fc50_3747_45e3_9eb7_711a2864ba3b/block_RehaMove3_01.o')
Building with 'g++'.
MEX completed successfully.
### Finish Compiling sfunc_RehaMove3_01
### Exit

************************************************

Warning: The model name 'xsrt_control_lib' is shadowing another name in the MATLAB workspace or
path. Type "which -all xsrt_control_lib" at the command line to find the other uses of this
name. You should change the name of the model to avoid problems. 
> In srt_CreateLib (line 147)
  In srt_InstallSRT (line 99) 

Building the "Soft-Realtime Simulink Toolbox" is done!

====================================================================
The installation of the "Soft-Realtime Simulink Toolbox" is done.

You can run the build script again with the "srt_CreateLib" command (necessary after upgrades)!
worldwidemv commented 4 years ago

Hello,

yes, there is an issue with the Maltab version you are using.

However, this is not an issue with the block but the Soft-Realtime Simulink Toolbox (https://github.com/worldwidemv/SimulinkToolchain).

Matlab changed the internal structure in Simulink, so the _ertlinux stuff does not work any more.

I myself am still using 2016b but some of my colleges have it some what running on 2019b (MAC). So I will have a look into it and see, if I can get it working with 2020a. However, I can't tell you when or even if that happens....

So what are your options to get going?

  1. use Maltab 2016b,
  2. use Matlab 2017b, you would need a other _ertlinux scripts, which I can give you,
  3. you use the original _ertlinux from https://github.com/aa4cc/ert_linux which should run with 2019b and maybe with 2020a, however my college said that it did not work for him. Maybe because they tested the toolchain for ARM targets.....

How to use another _ertlinux?

  1. go to /home/utkarsh/Desktop/SimulinkToolchain/,
  2. remove the "ert_linux" directory,
  3. copy the other "ert_linux" directory to this location and make sure that there are no sub-directories and that the directory name is "ert_linux",
  4. restart Matlab,
  5. check, if the examples for this new _ertlinux work and then check if any settings in the diagrams are different in this examples...

As an alternative, you can also just remove the old path-entry for the old _ertlinux and add the new path, if you know what the Matlab path is.....

I hope that helps. Let me know how it goes....

Sincerely Markus