Accelerator error: "cannot find -lstdc++" @linux

3 views (last 30 days)
To reproduce the issue I have a blank SIMULINK model with the block "Transport Delay" with activated "Accelerator". When I try to simulate, I get this Error while compiling model : "cannot find -lstdc++"
  • MATLAB r2017b
  • Ubuntu 16.04.4.LTS
  • gcc 4.9.4
Verbose MEX build:
### Generating code into build folder: /home/production/lacasa/lac_projects/slprj/accel/untitled
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: /opt/MATLAB/R2017b/rtw/c/accel/accel.tlc
### Loading TLC function libraries
....
### Initial pass through model to cache user defined code
.
### Caching model source code
........
### Writing header file untitled_acc_types.h
### Writing header file untitled_acc.h
### Writing header file rtwtypes.h
.
### Writing header file multiword_types.h
### Writing source file untitled_acc.c
### Writing header file untitled_acc_private.h
### Writing header file rt_defines.h
### TLC code generation complete.
.
### Processing Template Makefile: /opt/MATLAB/R2017b/rtw/c/accel/accel_unix.tmf
### untitled.mk which is generated from /opt/MATLAB/R2017b/rtw/c/accel/accel_unix.tmf is up to date
### Building untitled: /opt/MATLAB/R2017b/bin/glnxa64/gmake -f untitled.mk ISPROTECTINGMODEL=NOTPROTECTING
/opt/MATLAB/R2017b/bin/glnxa64/mex -c COPTIMFLAGS="-O0 -fPIC -DNDEBUG -ansi -pedantic -Wno-long-long -fwrapv -fPIC" -I. -I../../.. -I/opt/MATLAB/R2017b/simulink/include -I/opt/MATLAB/R2017b/extern/include -I/opt/MATLAB/R2017b/rtw/c/src -I/home/production/lacasa/lac_projects -I/home/production/lacasa/lac_projects/slprj/accel/untitled "untitled_acc.c"
Building with 'gcc'.
MEX completed successfully.
### Linking ...
/opt/MATLAB/R2017b/bin/glnxa64/mex COPTIMFLAGS="-O0 -fPIC -DNDEBUG -ansi -pedantic -Wno-long-long -fwrapv -fPIC" -MATLAB_ARCH=glnxa64 -silent -outdir ../../.. untitled_acc.o -L/opt/MATLAB/R2017b/bin/glnxa64 -lut -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwmathutil -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwipp -ldl -lm -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsl_fileio -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsigstream -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsl_AsyncioQueue -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwslexec_simbridge -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsimulink -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsl_simtarget_core -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsl_simtarget_instrumentation -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwslio_core -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwslio_clients -L/opt/MATLAB/R2017b/bin/glnxa64 -lmwsl_services
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
gmake: *** [../untitled_acc.mexa64] Error 255
### Build procedure for model: 'untitled' aborted due to an error.
gcc version:
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.4-2ubuntu1~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1~14.04.1)

Accepted Answer

Timo Dörsam
Timo Dörsam on 10 Mar 2018
fixed, I had to delete and install these old gcc & g++ again.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!