If you're trying to install Tom Minka's
lightspeed library for matlab, on a mac machine,
you may have bumped into this error:
Compiling lightspeed 2.6 mex files...
Change directory to lightspeed for this to work.
util.c:32:1: warning: "INFINITY" redefined
In file included from /usr/include/math.h:28,
from util.c:6:
/usr/include/architecture/i386/math.h:76:1: warning: this is the location of the previous definition
util.c:33:1: warning: "NAN" redefined
/usr/include/architecture/i386/math.h:66:1: warning: this is the location of the previous definition
mex -largeArrayDims -DBLAS64 -DUNDERSCORE_LAPACK_CALL solve_triu.c "-lmwlapack" "-lmwblas"
llvm-gcc-4.2 -c -I/Applications/MATLAB_R2011b.app/extern/include -I/Applications/MATLAB_R2011b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG -c random.c; llvm-gcc-4.2 -c -I/Applications/MATLAB_R2011b.app/extern/include -I/Applications/MATLAB_R2011b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -fexceptions -DMX_COMPAT_32 -dynamiclib -Wl,-install_name,`pwd`/librandom.dylib -o librandom.dylib random.o
i686-apple-darwin11-llvm-gcc-4.2: -install_name: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: /Users/Tomer/Research/Common/lightspeed/librandom.dylib: linker input file unused because linking not done
i686-apple-darwin11-llvm-gcc-4.2: random.o: linker input file unused because linking not done
ans =
0
i686-apple-darwin11-llvm-gcc-4.2: librandom.dylib: No such file or directory
mex: link of ' "randomseed.mexmaci64"' failed.
To solve this, note the comment in 'install_lightspeed.m'
% tis installer is set up for 64-bit MacOSX 10.6 with gcc-4.0
% if you are using something else, run 'mex -v -c flops.c'
% and use the output to change these strings
which, for me outputs
llvm-gcc-4.2 -c -I/Applications/MATLAB_R2011b.app/extern/include -I/Applications/MATLAB_R2011b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG "flops.c"
However, even after changing the appropriate variables, I still got an error (the one above),
To fix it, I simply removed that first '-c' flag, which results in the following settings:
options.COMPILER = 'llvm-gcc-4.2';
options.COMPFLAGS = ' -I/Applications/MATLAB_R2011b.app/extern/include -I/Applications/MATLAB_R2011b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -fexceptions -DMX_COMPAT_32';
options.OPTIMFLAGS = '-O2 -DNDEBUG';
2 comments:
Great Help! Thanks a lot!
This was very helpful, thanks!
Post a Comment