alternative compiler specification, linux

General forum for EasySpin: questions, how to's, etc.
Post Reply
myersw802
User
Posts: 13
Joined: Tue Aug 12, 2014 12:27 pm

alternative compiler specification, linux

Post by myersw802 »

The gcc version is 4.1.2 and 4.4.7 is available only as gcc44. How can I tell easyspin to use gcc44 instead of gcc? I don't have administrator access for the linux machine and switching to a the newer version as gcc is not allowed. Thanks. - Will
Stefan Stoll
EasySpin Creator
Posts: 1057
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: alternative compiler specification, linux

Post by Stefan Stoll »

What message do you get when you run easyspincompile?

Also, go to the easyspin/private subfolder in the ES installation folder and run mex -v cubicsolve.c. What do you get?

Try running mex -v CC=gcc44 cubicsolve.c. Does that work?
myersw802
User
Posts: 13
Joined: Tue Aug 12, 2014 12:27 pm

Re: alternative compiler specification, linux

Post by myersw802 »

Sorry, it looks like -lstdc++ is missing? Thanks. -Will

>> easyspincompile
EasySpin compilation
directory: /home/xuser/easyspin-4.5.0/easyspin/private
version: 7.14.0.739 (R2012a)
mex extension: mexglx, 32-bit
compiling...
Warning: You are using gcc version "4.1.2". The version
currently supported with MEX is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compil ... t_release/

/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

mex: link of ' "chili_lm0.mexglx"' failed.

Error using mex (line 206)
Unable to complete successfully.

Error in /home/xuser/easyspin-4.5.0/easyspin/easyspincompile.p>easyspincompile
(line 41)


>> mex -v cubicsolve.c

**************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/m ... nue-1.html
**************************************************************************

-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
FILE = /usr/local/MATLAB/R2012a/bin/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2012a
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc
-> Link flags:
LDFLAGS = -pthread -shared -m32 -Wl,--version-script,/usr/local/MATLAB/R2012a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexglx
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------


Warning: You are using gcc version "4.1.2". The version
currently supported with MEX is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compil ... t_release/

-> gcc -c -I/usr/local/MATLAB/R2012a/extern/include -I/usr/local/MATLAB/R2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64 -DMX_COMPAT_32 -O -DNDEBUG "cubicsolve.c"

-> gcc -O -pthread -shared -m32 -Wl,--version-script,/usr/local/MATLAB/R2012a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "cubicsolve.mexglx" cubicsolve.o -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++

/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

mex: link of ' "cubicsolve.mexglx"' failed.

Error using mex (line 206)
Unable to complete successfully.

>> mex -v CC=gcc44 cubicsolve.c

**************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/m ... nue-1.html
**************************************************************************

-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
FILE = /usr/local/MATLAB/R2012a/bin/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2012a
-> CC = gcc44
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = gcc44
-> Link flags:
LDFLAGS = -pthread -shared -m32 -Wl,--version-script,/usr/local/MATLAB/R2012a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexglx
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

-> gcc44 -c -I/usr/local/MATLAB/R2012a/extern/include -I/usr/local/MATLAB/R2012a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64 -DMX_COMPAT_32 -O -DNDEBUG "cubicsolve.c"

-> gcc44 -O -pthread -shared -m32 -Wl,--version-script,/usr/local/MATLAB/R2012a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "cubicsolve.mexglx" cubicsolve.o -Wl,-rpath-link,/usr/local/MATLAB/R2012a/bin/glnx86 -L/usr/local/MATLAB/R2012a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++

/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

mex: link of ' "cubicsolve.mexglx"' failed.

Error using mex (line 206)
Unable to complete successfully.

>>
Stefan Stoll
EasySpin Creator
Posts: 1057
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: alternative compiler specification, linux

Post by Stefan Stoll »

It seems Matlab/mex cannot find the standard C++ library on your computer. It expects it in /usr/local/MATLAB/R2012a/bin/glnx86 (See CLIBS in your output). If you can locate libstdc++.* on your computer (maybe in a subfolder of /usr/local/MATLAB/R2012a/sys/os), then you can create a symbolic link from bin/glnx86 folder to that place, and Matlab/mex should be able to find it.
Post Reply