I know Linux Matlab only has official support for gcc 4.9 for mex.
Does anyone know how to get either the Linux Intel compilers (icc) working with mex on Linux or more recent versions of the gcc?
This is for recent versions of Matlab (2015-2017).
I assume you talk about C++ projects. Yes, its possible with newer versions of gcc.
Check supported compilers to find out which Matlab uses which gcc version.
Tell your newer version of gcc to use the ABI version of the gcc version that your Matlab was made in for the compilation of your project and all dependencies.
Tell Matlab to use the standard c++ library in /usr/lib and not the one it contains itself. It is backwards compatible.
Example with gcc > 4.9.x for Matlab 2017b:
Matlab 2017b was built with gcc 4.9.x
gcc 4.9.x is compatible with CXX ABI version 8
use your gcc with compile flag -fabi-version=8 for your mex file and all dependencies
in a shell export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 before a call to matlab
Related
Where is the canonical place on Linux to install a library, that was not compiled with the standard system compiler? /us/local/lib or /usr/local/mylib-1.0-gcc.version? Some place else? The same library compiled with the system gcc may be installed and used, too.
Background:
I am on CentOS 6.5. The standard compiler is gcc 4.4. I have a closed source program, that is compiled on CentOS 6.0 with gcc 4.1.2 (strange enough, gcc is also 4.4 there). I want to build a plugin for the program that uses a (open source) library. So I compile gcc 4.1.2 and the library with gcc 4.1.2. Where does the library go?
I want to use Red Hat Enterprise Linux 5.8 to compile folly, and gcc is 4.1.2. But folly needs gcc >=4.6. So I need to upgrade gcc to 4.6, maybe binutils etc. If new toolchain generates binary files such as *.a *.so, would running them on old Red Hat Enterprise Linux 5.8 bring any problem or unstabitily?
Probably no big trouble (because GCC 4.1 & soon released GCC 4.8 produces compatible code), at least for C code.
For C++ code I believe there is a incompatibility. Certainly the libstdc++ is tied to the compiler version. Sometimes it may be compatible in practice, sometimes not (but the C++ ABI slightly changed too). And this incompatibility may spread to every C++ library.
I believe you should try. If you recompile -with the same newest GCC- all the C++ dependencies, you'll probably be quite safe. So you could compile the newest GCC, then compile folly and all its dependencies with it.
BTW, I would suggest going to the latest GCC (today 4.7, in a few weeks 4.8).
I downgraded my gcc version 4.6.3 to 4.3.4 but ada version is not changed gnat-4.6.3 so I got error
Ada compiler not installed on this system.
How to set my ada to gnat 4.3.4?
It depends on what system you're running on and how you installed it. You need to either install GNAT from the same build of GCC, or you need to install GNAT in such a way that it doesn't interfere with the rest of GCC.
I met an err when I installed JikesRVM, that is,
skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.4/libstdc++.so when searching for -lstdc++
So I am trying to install/update it to a later version. Now, the machine already has
gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]
I am new to openSUSE, could you help?
Thanks!
You need to install 32 bit support for the GNU C/C++ compiler since JikesRVM on x86_64 currently supports only the 32 bit architecture.
To install this support in OpenSuSE 11.2 type
sudo zypper install gcc44-32bit gcc-32bit libstdc++44-devel-32bit
The first two provide runtime support for the C language and the 32-bit version of libgcc, the GCC low level runtime library. The third provides the 32-bit version of libstdc++, both the static import library and the dynamic library. It is the static libstdc++.a that was missing for JikesRVM.
To verify that the 32bit C++ build system is installed correctly you can test it with the following
echo "int main(){}" | g++ -x c++ -m32 -
Note Official support for OpenSuSE 11.2 has ended. Evergreen support will be available through 2013. Yet it is reasonable to update to 11.3 or a later version soon.
I have found the code which links against of 'g2c' library. Why do I need it? Just would like to understand why it might be important and what it does in general.
Thanks!
What is GNU Fortran?
g77 consists of several components:
A modified version of the gcc command, which also might be installed as the system's cc command. (In many cases, cc refers to the system's “native” C compiler, which might be a non-GNU compiler, or an older version of gcc considered more stable or that is used to build the operating system kernel.)
The g77 command itself, which also might be installed as the system's f77 command.
The libg2c run-time library. This library contains the machine code needed to support capabilities of the Fortran language that are not directly provided by the machine code generated by the g77 compilation phase.
libg2c is just the unique name g77 gives to its version of libf2c to distinguish it from any copy of libf2c installed from f2c (or versions of g77 that built libf2c under that same name) on the system.
You may think of it as, libg2c is to g77 as libc is to gcc.
Note that as of the GCC 4.x series, g77 has been discontinued, replaced by gfortran, which produces programs that do not require an extra libg2c runtime library.
"This library contains the machine code needed to support capabilities of the Fortran language that are not directly provided by the machine code generated by the g77 compilation phase."
from this link
Installing compat-gcc-34-g77 solves this requirement.
(gcc-34 must be replaced by your gcc version)