MATLAB codegen: /lib64/libstdc++.so.6: version: 'GLIBCXX_3.4_20' not found - matlab

Trying to run codegen with MATLAB 2019a on a linux box and got the error:
... /lib64/libstdc++.so.6: version: 'GLIBCXX_3.4_20' not found ...
I have /lib64/libstdc++.so.6, just (apparently) not the right version. How can I resolve this?

Here is a list of supported compilers for your version of MATLAB.
Apparently MATLAB R2019a on Linux requires GCC 6.3.x. Make sure you have that version installed.

Related

CMake Error at HW1_generated_student_func.cu [duplicate]

I'm currently trying to compile Darknet on the latest CUDA toolkit which is version 11.1. I have a GPU capable of running CUDA version 5 which is a GeForce 940M. However, while rebuilding darknet using the latest CUDA toolkit, it said
nvcc fatal : Unsupported GPU architecture 'compute_30'
compute_30 is for version 3, how can it fail while my GPU can run version 5
Is it possible that my code detected my intel graphics card instead of my Nvidia GPU? if that's the case, is it possible to change its detection?
Support for compute_30 has been removed for versions after CUDA 10.2. So if you are using nvcc make sure to use this flag to target the correct architecture in the build system for darknet
-gencode=arch=compute_50,code=sm_50
You may also need to use this one to avoid a warning of architectures are deprecated.
-Wno-deprecated-gpu-targets
I added the following:
makefiletemp = open('Makefile','r+')
list_of_lines = makefiletemp.readlines()
list_of_lines[15] = list_of_lines[14]
list_of_lines[16] = "ARCH= -gencode arch=compute_35,code=sm_35 \\\n"
makefiletemp = open('Makefile','w')
makefiletemp.writelines(list_of_lines)
makefiletemp.close()
right before the
#Compile Darknet
!make
command. That seemed to work!

Installing openCV on MATLAB with mex and MinGW64

I'm trying to install OpenCV on MATLAB2015b using mexopencv. I have downloaded and successfully installed MATLAB support for MinGW-w64 C/C++ Compiler add-on in MATLAB. This is MATLAB's suggested compiler when I type mex -setup. However, when I run mexopencv.make in MATLAB, I get the following error:
Error using mexopencv.make>pkg_config (line 333)
OpenCV library path not found: D:\opencv\build\x64\mingw\lib
Error in mexopencv.make>mex_options (line 265)
[cv_cflags, cv_libs] = pkg_config(opts);
Error in mexopencv.make (line 82)
mex_flags = mex_options(opts);
I have already added mexopencv-master directory to my MATLAB's Path. And I have already checked that I have downloaded the correct version of opencv for mexopencv (which is 3.4.1 as of now).
I don't know why \build\x64\mingw\lib\ doesn't exist. I have seen different tutorials but most of them use Microsoft Visual Studio 2013/2015 C++ to compile mexopencv. How can I compile OpenCV with MinGW-w64 on my own? Or is there another github package that I should've downloaded instead of this one?
I have tried to uninstall my current version of Visual Studio and install the 2013 version to use its C/C++ compiler. However, MATLAB doesn't recognize this compiler when I issue mex -setup.
Any help is appreciated. Also, I cannot use MATLAB's computer vision toolkit because I want to use a function that is not supported by it (Namely, the probabilistic Hough transform).

cplex would not run on matlab due to invalid mex-file

I'm trying to use cplex on matlab but I'm getting the following error:
Error using cplexlp (line 256)
Invalid MEX-file 'C:\Program
Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64\cplexlink1271.mexw64': The specified
procedure could not be found.
Error in cplex_example (line 12)
[x,fval,exitflag,output] = cplexlp(f,A,b,Aeq,beq,lb,ub,options);
I have already added the paths as follows:
addpath ('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64')
addpath('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\examples\src\matlab')
savepath
My laptop runs on Windows 10 64-bit, my matlab is R2013a 64-bit and cplex is cplex 12.7.1 win-x86-64.
I saw an answer to a similar question and they said it must be checked by dependency walker. Dependency walker showed that a whole bunch of API-MS-WIN-CORE, EVENTING, SECURITY, SERVICE, EXT-MS-WIN-GDI etc. dll files where missing.
I looked at a few posts implying that these are included in Visual C++ Redistributable packages, so I installed all editions of Microsoft Visual C++ Redistributable (both x86 and x64 just to be sure).
But I still have the problem. What am I missing here? Any help would be greatly appreciated.
MATLAB R2013a is not supported with CPLEX 12.7.1 (see the detailed system requirements). You'll either have to use a newer version of MATLAB or an older version of CPLEX.

Matlab 2013 rapid accelerator fails after update (Debian 7 to Debian 8)

I have a simulink model created with Matlab 2013, which was working fine in the rapid accelerator mode on Debian 7 machine.
However, after an update to Debian 8 (and Matlab 2013) the simulation fails with a compilation warning and an error:
Warning:
matlab Warning: You are using gcc version 4.9.2 The version currently supported with MEX is 4.4.x. For a list of currently supported compilers see:...
Fatal error:
matlab 2013 /usr/bin/ld: cannot find -lstdc++collect2: error: ld returned 1 exit statusmex: link of ' "TestModel_sfun.mexa64"' failed.gmake Error 1
A related post is here, which is also a failure at the link step. However the solution, which for me is to install the package libstdc++-4.8-dev did not help, so something else seems to be missing.
Solution: install the build-essential package.
Turns out a colleague had the same problem earlier.

which configuration option is used by Mex to compile using matlab?

say, if choose mexopts.sh as the configuration files for mex,
then how does mex decide which option listed in the mexopts.sh is used for compiling?
for example, using 32bit matlab on 64bit mac os x:
mexopts.sh looks like:
,,maci
........
,,maci64
......
Then, maci or maci64 is used when compiling?
What commands or way can I do in order to compile 32bit lib instead of 64bit lib?
Further explanation of my process and the error message I got :
I am using mac os x 10.8 (64bit) with matlab R2010a (32bit) to produce a binary mex-file.
The Xcode is 4.6 version, I installed Command Line Tools on my machine. Then I downloaded the patch from matlab for 2011 and 2012 version anyway. (if I don't install the patch, I got a lot of link errors saying some header files are missing).
After I installed the patch ( I believe it changes my mexopts.sh file), when I run mex a.cpp, I got error message saying that /Applications/MATLAB_R2010a.app/bin/maci64 cannot be found. Of course, it cannot find the maci64 folder, it is 32bit, there is only maci folder.
So Anyone knows what I should do in order to make matlab look for maci folder instead of maci64 folder? Thanks a lot!
MATLAB does not support cross compilation of MEX files. So your 32-bit MATLAB installation should be producing 32-bit MEX files even though the OS is 64-bit.
Also, from the article I've linked
Further, beginning with R2010b, a 32-bit version of MATLAB is no longer produced for the Mac.
If you're running R2010b or later, your MATLAB is not 32-bit anyway.
To see what switches the MEX script is invoking the compiler with, use the -v option.
You can also use the file tool to check whether the generated binary is 32 or 64-bit.
As its been explained, MATLAB produces MEX files of the same bit-ness as itself, not that of the OS. This is true at least on Windows with recent MATLAB versions, where you can have either 32-bit or 64-bit MATLAB running on 64-bit Windows. Other platforms are moving towards 64-bit versions only.
Here is another way to get the configured mex switches:
>> cc = mex.getCompilerConfigurations
>> cc.Details
In my case I get:
>> cc = mex.getCompilerConfigurations
cc =
CompilerConfiguration with properties:
Name: 'Microsoft Visual C++ 2010'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '10.0'
Location: 'C:\Program Files\Microsoft Visual Studio 10.0'
Details: [1x1 mex.CompilerConfigurationDetails]
LinkerName: 'Microsoft Visual C++ 2010'
LinkerVersion: '10.0'
>> cc.Details
ans =
CompilerConfigurationDetails with properties:
CompilerExecutable: 'cl'
CompilerFlags: [1x115 char]
OptimizationFlags: '/O2 /Oy- /DNDEBUG'
DebugFlags: '/Z7'
LinkerExecutable: 'link'
LinkerFlags: [1x327 char]
LinkerOptimizationFlags: ''
LinkerDebugFlags: '/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"'
To answer my own question, just for those who may be interested in it,
I checked the contents of mexopts.sh and modified the part for maci (specifically set ARCH=i386) , then compile. The error message is gone.