From: Matt on 5 Aug 2010 17:30 Dear all, I have written some mexed routines for speeding up my code in Windows, and everything compiles fine and works beautifully in Windows, but when moving my code to Linux I'm having trouble with lapack routines. To simplify things I'm using the MATLAB example file matrixDivide.c [from http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/br_2m24-1.html]. Compiling and running the test example proceeds as follows: >> mex -v matrixDivide.c -llapack -> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION) FILE = /home/mpuecker/.matlab/R2010a/mexopts.sh ---------------------------------------------------------------- -> MATLAB = /share/apps/matlabr2010a -> CC = gcc -> CC flags: CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread CDEBUGFLAGS = -g COPTIMFLAGS = -O -DNDEBUG CLIBS = -Wl,-rpath-link,/share/apps/matlabr2010a/bin/glnxa64 -L/share/apps/matlabr2010a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ arguments = -DMX_COMPAT_32 -> CXX = g++ -> CXX flags: CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread CXXDEBUGFLAGS = -g CXXOPTIMFLAGS = -O -DNDEBUG CXXLIBS = -Wl,-rpath-link,/share/apps/matlabr2010a/bin/glnxa64 -L/share/apps/matlabr2010a/bin/glnxa64 -lmx -lmex -lmat -lm arguments = -DMX_COMPAT_32 -> FC = g95 -> FC flags: FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer FDEBUGFLAGS = -g FOPTIMFLAGS = -O FLIBS = -Wl,-rpath-link,/share/apps/matlabr2010a/bin/glnxa64 -L/share/apps/matlabr2010a/bin/glnxa64 -lmx -lmex -lmat -lm arguments = -DMX_COMPAT_32 -> LD = gcc -> Link flags: LDFLAGS = -pthread -shared -Wl,--version-script,/share/apps/matlabr2010a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined LDDEBUGFLAGS = -g LDOPTIMFLAGS = -O LDEXTENSION = .mexa64 arguments = -llapack -> LDCXX = -> Link flags: LDCXXFLAGS = LDCXXDEBUGFLAGS = LDCXXOPTIMFLAGS = LDCXXEXTENSION = arguments = -llapack ---------------------------------------------------------------- -> gcc -c -I/share/apps/matlabr2010a/extern/include -I/share/apps/matlabr2010a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -O -DNDEBUG "matrixDivide.c" In file included from matrixDivide.c:21: /share/apps/matlabr2010a/extern/include/lapack.h:6498:1: warning: "dgesv" redefined matrixDivide.c:17:1: warning: this is the location of the previous definition matrixDivide.c: In function 'mexFunction': matrixDivide.c:64: warning: incompatible implicit declaration of built-in function 'memcpy' matrixDivide.c:74: warning: passing argument 1 of 'dgesv_' from incompatible pointer type matrixDivide.c:74: warning: passing argument 2 of 'dgesv_' from incompatible pointer type matrixDivide.c:74: warning: passing argument 4 of 'dgesv_' from incompatible pointer type matrixDivide.c:74: warning: passing argument 5 of 'dgesv_' from incompatible pointer type matrixDivide.c:74: warning: passing argument 7 of 'dgesv_' from incompatible pointer type matrixDivide.c:74: warning: passing argument 8 of 'dgesv_' from incompatible pointer type -> gcc -O -pthread -shared -Wl,--version-script,/share/apps/matlabr2010a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "matrixDivide.mexa64" matrixDivide.o -llapack -Wl,-rpath-link,/share/apps/matlabr2010a/bin/glnxa64 -L/share/apps/matlabr2010a/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ >> A = [1 2; 3 4]; >> B = [5; 6]; >> X = matrixDivide(A,B) ** On entry to DGESV parameter number 1 had an illegal value At which point MATLAB quits. A few notes: - Sometimes I get parameter number 3, or number 7 instead of number 1 as the error message - I have also gotten a segmentation fault as the error, but have not been able to reproduce that lately - The exact same code compiles/runs flawlessly on Windows with microsoft visual express compiler - I've also tried using the pathscale compiler pathcc instead with no luck - You'll notice I compiled with -llapack instead of -lmwlapack + This is because we have a 64 bit linux system. + When getting blas to work I found compiling with -lblas instead of -lmwblas would avoid segmentation faults + I've also tried compiling against -lacml, but I get a similar error At this point I'm stumped. Any help would be great! [ps. I'm a newb when it comes to linking to precompiled libraries etc.] THANKS!
|
Pages: 1 Prev: mmreader gives incorrect intensity values Next: Access Neuroscan via TCP |