MATLAB(linux) cannot find the gcc - c

I try to compile in MATALAB, but it seems that the MATLAB cannot find the gcc:
Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/glnxa64.
Error in compile (line 439)
mex(args{:});
>> mex -setup
MEX configured to use 'gcc' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
But I have already installed the gcc using apt-get install gcc, and type the gcc -v can get the following information:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --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.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-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 --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.8.2 (Ubuntu 4.8.2-19ubuntu1)
How can I solve this problem?

converting my comment into this answer:
The error message tells you to go to http://mathworks.com/support/compilers/R2014a/glnxa64, which lists gcc 4.7.x as a supported compiler, but you have 4.8.2.
So you need to install GCC 4.7. On Ubuntu this can be done using:
sudo apt-get install gcc-4.7

Related

__builtin_strncpy warning from Kernel Compile

I recently tried to compile Kernel (4.18.1) on top of CentOS 8.5 system.
When Kernel build progress, I saw many message like
./include/linux/string.h:246:9: warning: ‘__builtin_strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
I originally thought somewhere Kernel has Makefile including [-Wstringop-truncation] but it seems not.
And this is output of gcc -v in my CentOS 8.5 system.
# gcc -v | grep stringtop
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC)
If someone can explain why I see this message and how to remove it, it would be great.

aarch64 gcc support --fix-cortex-a53-843419

I download arm64 arch toolchain from linaro.com
But when i start to build latest kernel with arm64 defconfig
It will show the below error, which means that my arm64 gcc doesn't support --fix-cortex-a53-843419 option.
Is there anyone knows which gcc I can use to fix that problem ?
linux git:(master) make ARCH=arm64 aarch64-linux-gnu- -j8
arch/arm64/Makefile:23: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
linux git:(master) aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/miracle/Misc/gcc-linaro-7.1.1-2017.08-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/7.1.1/lto-wrapper
Target: aarch64-linux-gnu
Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/snapshots/gcc.git~linaro-7.1-2017.08/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/sysroots/aarch64-linux-gnu --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu

GCC terminates operation on fatal error

The Linux server at my college runs gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1), configuration below.
As an exercise I'm trying to run and get the warnings and output for a buggy program. The first error is that the program starts with
#include <stdio>
rather than
#include <stdio.h>
.
On the server, the compiler shows said first error, and then proceeds to show the rest of the errors and warnings. On my local VM however, it only shows this first error as a "fatal error", and then terminates operation.
I would like to configure my local GCC so that it behaves the same as the remote GCC.
I'm compiling my code on both machines using gcc -Wall -o filename filename.c.
My local VM GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Remote GCC configuration:
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Local GCC configuration:
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --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-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-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
Aborting on missing headers has been deliberately enabled some time ago (see BZ 15638) as it's believed that most following errors will be caused by missing declarations and so pretty much useless. There is no option to revert to old behavior.

Qemu static configure error (thread local storage)

I'm trying to compile Qemu for this target in a static way : {arm-linux-user, armeb-linux-user, arm-softmmu}.
here is this configure command I'm using :
./configure --target-list="arm-linux-user armeb-linux-user arm-softmmu" --disable-werror --enable-debug --static
When I'm executing this command I got the following error :
C++ compiler c++ does not work with C compiler cc Disabling C++
specific optional code
ERROR: Your compiler does not support the __thread specifier for
Thread-Local Storage (TLS). Please upgrade to a version that does.
Or, my cc version is 5.1.1 so this is quite new :
[lionel#localhost qemu]$ cc -v
Utilisation des specs internes.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Cible : x86_64-redhat-linux
Configuré avec: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
I can compile it normally without the "--static" argument. I need to compile it in static way as I am trying to chroot into a filesystem where binaries are ELF arm executable..
If it is not possible I could possibly use qemu-system-arm to emulate to board.
Configure will also produce this error message if your linker is broken (ie trying to compile a .c program to an executable doesn't work), because the TLS check happens to be the first one which tries to do that -- in this case it will print a misleading error message. In this case your compiler is definitely new enough to handle __thread, so you should check whether your linker works OK. Looking in config.log will show all the programs QEMU's configure script tried to run and their output.
(I just submitted a patch -- http://patchwork.ozlabs.org/patch/548123/ -- which will result in a less confusing warning if your linker doesn't work.)

LLVM missing linker and can't compile the lld (llvm linker)

I want to build a compiler to a new target and I choose llvm. As far as I understand, I can use the clang project as a front end and llvm as a back end. I can get .o files out of the llc (part of the llvm). now I need to link them all into executable. I tried using lld project but it failed compiling with the error :
Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp: In member function ‘llvm::Instruction* llvm::ARMTargetLowering::makeDMB(llvm::IRBuilder<>&, llvm::ARM_MB::MemBOpt) const’:
Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp:11000:73: error: could not convert ‘{(& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(15u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(7u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(10u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(5u)}’ from ‘<brace-enclosed initializer list>’ to ‘llvm::ArrayRef<llvm::Value*>’
Builder.getInt32(10), Builder.getInt32(5)};
^
make[2]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMISelLowering.cpp.o] Error 1
make[1]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/all] Error 2
make: *** [all] Error 2
so I have several question cause I think I am missing something :
if I don't have binutils for the new target, how should I use the llvm project ? - they create they great project...but without the final piece that actually create running files ?! what should I use as a linker ?
anyone encountered this lld build error and solved it ?
uname -a
Linux my_name-Inspiron-3521 3.13.0-35-generic #62-Ubuntu SMP Fri Aug
15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
gcc -v
Using built-in specs. COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu Configured with: ../src/configure -v
--with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --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.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-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 --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.8.2 (Ubuntu 4.8.2-19ubuntu1)
The error you are encountering is in llvm itself, not lld. I'm not seeing that error on the buildbots, so I recommend updating your source tree.
As for binutils, llvm does not currently provide a complete replacement for them. This is being worked on, but it will be a while before it's completed. For now I recommend using gnu binutils with either ld or gold as the linker.

Resources