ricedsp / rwt

The Rice Wavelet Toolbox (RWT) is a collection of Matlab M-files and C MEX-files for 1D and 2D wavelet and filter bank design, analysis, and processing. The toolbox provides tools for denoising and interfaces directly with our Matlab code for wavelet domain hidden Markov models and wavelet regularized deconvolution.
http://dsp.rice.edu
Other
134 stars 48 forks source link

unable to correctly compile in linux #1

Closed hanjiepan closed 9 years ago

hanjiepan commented 12 years ago

I run into trouble when I try to compile the mex files in the toolbox with "compile.m". I have several warnings as follows:

mdwt_r.c:81: warning: cast to pointer from integer of different size mdwt_r.c:82: warning: cast to pointer from integer of different size mdwt_r.c:83: warning: cast to pointer from integer of different size mdwt_r.c:84: warning: cast to pointer from integer of different size mdwt_r.c:85: warning: cast to pointer from integer of different size

midwt_r.c:86: warning: cast to pointer from integer of different size midwt_r.c:87: warning: cast to pointer from integer of different size midwt_r.c:88: warning: cast to pointer from integer of different size midwt_r.c:89: warning: cast to pointer from integer of different size midwt_r.c:90: warning: cast to pointer from integer of different size

mrdwt_r.c:96: warning: cast to pointer from integer of different size mrdwt_r.c:97: warning: cast to pointer from integer of different size mrdwt_r.c:98: warning: cast to pointer from integer of different size mrdwt_r.c:99: warning: cast to pointer from integer of different size mrdwt_r.c:100: warning: cast to pointer from integer of different size mrdwt_r.c:101: warning: cast to pointer from integer of different size mrdwt_r.c:102: warning: cast to pointer from integer of different size mrdwt_r.c:103: warning: cast to pointer from integer of different size

mirdwt_r.c:95: warning: cast to pointer from integer of different size mirdwt_r.c:96: warning: cast to pointer from integer of different size mirdwt_r.c:97: warning: cast to pointer from integer of different size mirdwt_r.c:98: warning: cast to pointer from integer of different size mirdwt_r.c:99: warning: cast to pointer from integer of different size mirdwt_r.c:100: warning: cast to pointer from integer of different size mirdwt_r.c:101: warning: cast to pointer from integer of different size mirdwt_r.c:102: warning: cast to pointer from integer of different size mirdwt_r.c:103: warning: cast to pointer from integer of different size

If I ignore them, then I can still call wavelet anslysis wrdwt. But as soon as I try to call "mirdwt", then matlab crashes with errors associated with the mex file:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   Segmentation violation detected at Sat Nov  5 21:10:00 2011

Configuration: MATLAB Version: 7.6.0.324 (R2008a) MATLAB License: 60557 Operating System: Linux 2.6.16.60-0.21-smp #1 SMP Tue May 6 12:41:02 UTC 2008 x86_64 GNU C Library: 2.4 stable Window System: No active display Current Visual: None Processor ID: x86 Family 6 Model 15 Stepping 11, GenuineIntel Virtual Machine: Java 1.6.0_01 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode Default Encoding: UTF-8

Fault Count: 1

Register State: rax = 0000000000000000 rbx = 00002aaac61ab020 rcx = 0000000000b71930 rdx = c000f876ccdf6d00 rbp = 00000000407fa3a0 rsi = 0000000000b71110 rdi = 0000000000000000 rsp = 00000000407fa270 r8 = ffffffffc622c020 r9 = 0000000000000040 r10 = 0000000000b73be8 r11 = 0000000000bd26e0 r12 = 0000000000000004 r13 = 0000000000000000 r14 = 0000000000b739e0 r15 = 0000000000000001 rip = 00002aaac60aa25e flg = 0000000000010246

Stack Trace: [0] mirdwt.mexa64:0x00002aaac60aa25e(0x2aaac6028020, 0x2aaac6e2c020, 0x407faef0 ", 2304) [1] mirdwt.mexa64:mexFunction~(0x100000004, 0x2b28fa4dd6ad, 0x127f407fa490, 0x407fafd0) + 711 bytes [2] libmex.so:mexRunMexFile(0, 0x407fafb0 ", 0x4407fabc0, 0x407faef0 ") + 75 bytes [3] libmex.so:Mfh_mex::runMexFileWithSignalProtection(int, mxArray_tag, int, mxArray_tag)(0x407faa70, 0x407fa670, 0x407fafb0 ", 0x2aaac47de400) + 137 bytes [4] libmex.so:Mfh_mex::dispatch_file(int, mxArray_tag, int, mxArray_tag)(0x407fafb0 ", 0x4407fba90, 0x2aaac47de400, 0x407fc230 ") + 262 bytes [5] libmwm_dispatcher.so:Mfh_file::dispatch_fh(int, mxArray_tag, int, mxArray_tag)(0x407fac00, 0xffffffff00000001, 0x00b70ae0, 4) + 236 bytes [6] libmwm_interpreter.so:ResolverFunctionDesc::CallFunction(int, mxArray_tag, int, mxArray_tag)(0x2aaa00000001, 0x407fac60, 0x2b28fb939930, 0x407fb160 ") + 786 bytes [7] libmwm_interpreter.so:Resolver::CallMFunction(int, int, _moperand, m_operandstorage, int, _moperand, m_operandstorage, int_)(0x00b70920, 0, 0x407fbc60, 0) + 1672 bytes [8] libmwm_interpreter.so:inResolveMFunctionCall(_m_functiondesc, int, int, _moperand, m_operandstorage, int, _moperand, m_operandstorage, int, inMarshalType, int, mpsTypeSequenceNlhs const_, mxArraytag (_)(int))(0x00b70920, 0, 0x407fbc60, 0x407fbdf8) + 517 bytes [9] libmwm_interpreter.so:accelImpl::MFunctionCall(_accelOp)(0x407fbc40 ", 0x407fbc60, 0x1700b67450, 0x2aaac45c4120 ") + 242 bytes [10] libmwm_interpreter.so:accelImpl::Exec()(0x407fbdf8, 0x407fbdf0, 0x00b6d2e0, 0x007fbae0) + 238 bytes [11] libmwminterpreter.so:accelCode::Call(inMarshalType, int_) const(1, 0x407fbdff, 0x2b29035c3e00 ", 0x407fbdd0 "શ") + 91 bytes [12] libmwm_interpreter.so:inJit::ExecuteHotSegment(inJitAccelInfo, opcodes, int, long_)(3, 0x407fbe80, 0x407fbecc, 0x2aaac5b852a0) + 1664 bytes [13] libmwm_interpreter.so:inExecuteMFunctionOrScript(Mfhmp, bool)(0, 0, 0x407fbf60, 0x407fc0b0) + 1108 bytes [14] libmwm_interpreter.so:inRunMfile(int, mxArray_tag, int, mxArray_tag, Mfhmp, inWorkSpacetag)(0x407fc3b0 ", 0x3407fc250, 0x00b67450, 0x407fcef0 ") + 666 bytes [15] libmwm_dispatcher.so:Mfh_file::dispatch_fh(int, mxArray_tag, int, mxArray_tag)(0x407fc2e0, 0x100000003, 0x407fc200, 0x2b28fa657b80 ") + 236 bytes [16] libmwminterpreter.so:inDispatchFromStack(int, char const, int, int)(0x407fc6cc, 0x2b000000003, 0x2b290351aa6c "w_syn2D_rwt", 0x100000000) + 1062 bytes [17] libmwminterpreter.so:inDispatchCall(char const, int, long, int, int, int)(0, 0x0091d0c0, 0x2aaa0000000e, 0x407fc6d0) + 165 bytes [18] libmwm_interpreter.so:inInterp(inDebugCheck, int, int, opcodes, inPcodeNesttag volatile, long_)(0x407fcb78, 0x2aaac5bcdab0 ", 0x100000000, 0x100000000) + 4321 bytes [19] libmwm_interpreter.so:protected_inInterp(inDebugCheck, int, int, opcodes, inPcodeNesttag, long_)(0x00b67750, 0x00a349f0, 0x00b67750, 0x2bde273ad41cc6) + 140 bytes [20] libmwm_interpreter.so:inInterPcodeSJ(inDebugCheck, int, int, opcodes, inPcodeNesttag, long_)(0, 0x407fcb40, 0x407fcb8c, 0) + 265 bytes [21] libmwm_interpreter.so:inExecuteMFunctionOrScript(Mfhmp, bool)(0, 1, 0x2aaac40a1170 ", 0x407fcd70) + 680 bytes [22] libmwm_interpreter.so:inRunMfile(int, mxArray_tag__, int, mxArray_tag, Mfhmp, inWorkSpacetag)(0, 0xfcc4e9a0, 0x00b67750, 0x407fde90) + 666 bytes [23] libmwm_dispatcher.so:Mfh_file::dispatch_fh(int, mxArray_tag__, int, mxArray_tag__)(0x407fcf90, 0, 0x407fdc50, 0x407fdad0) + 236 bytes [24] libmwm_interpreter.so:inEvalPcodeHeaderToWord(_memorycontext, int, mxArray_tag, pcodeheader, Mfhmp, unsigned int)(0x407fcfb0, 0x407fd150, 0x407fdca0, 0) + 187 bytes [25] libmwm_interpreter.so:in_local_call_script_function(_memorycontext, pcodeheader, int, mxArray_tag, unsigned int, bool)(0x407fd9b0, 0x407fdb60, 0x407fda50, 0x00b67da0) + 103 bytes [26] libmwm_interpreter.so:inEvalStringWithIsVarFcn(_memorycontext, char const_, EvalType, int, mxArraytag*, inDebugCheck, pcodeheader, int, bool ()(void, char const), void_, bool, bool)(0, 0, 0x2b28fb44ff60, 0) + 1529 bytes [27] libmwminterpreter.so:inEvalCmdWithLocalReturn(char const, int, bool, bool, bool ()(void, char const))(0x407fdd10, 0x00b61490 "tmp2=w_syn2D_rwt(tmp,F_scal,3);\", 0x407fde50, 0) + 149 bytes [28] libmwbridge.so:evalCommandWithLongjmpSafety(char const*)(0, 0, 0, 0) + 94 bytes [29] libmwbridge.so:mnParser(0x00580790, 0x00580920, 0x40800160, 7) + 291 bytes [30] libmwmcr.so:mcrInstance::mnParser()(0x636f6c2f7273752f, 0x616c74616d2f6c61, 0x6c672f6e69622f62, 0x343661786e) + 82 bytes

This error was detected while a MEX-file was running. If the MEX-file is not an official MathWorks function, please examine its source code for errors. Please consult the External Interfaces Guide for information on debugging MEX-files.

If it is an official MathWorks function, please follow these steps to report this problem to The MathWorks so we have the best chance of correcting it:

The next time MATLAB is launched under typical usage, a dialog box will open to help you send the error log to The MathWorks. Alternatively, you can send an e-mail to segv@mathworks.com with the following file attached: /users/student/s1010096720/matlab_crash_dump.22263

If the problem is reproducible, please submit a Service Request via: http://www.mathworks.com/support/contact_us/ts/help_request_1.html

A technical support engineer might contact you with further information.

Thank you for your help. MATLAB may attempt to recover, but even if recovery appears successful, we recommend that you save your workspace and restart MATLAB as soon as possible.

Attempt to restart MATLAB? [y or n]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

So I wonder is there any fix for this or do you have any precompiled files for 64-bit linux available? btw, I am using gcc version 4.1.2 20070115 in a SUSE Linux Server.

Thanks a lot.

rsadek commented 12 years ago

I have the same bug on mac w/ 64-bit matlab. The code seems to work fine in 32-bit, but for newer matlab versions (2010b+) which is 64-bit only, this code crashes matlab consistently.

rsadek commented 12 years ago

including matrix.h in each file eliminates the crash. It is a good idea to also include mex.h and add -largeArrayDims to each line in compile.m

hanjiepan commented 12 years ago

thx rsadek! It works perfectly in my machine as well.

songuke commented 11 years ago

Adding mex.h to all files ending with suffix _r.c makes it work for 64-bit OS. The issue is also discussed in a thread in the MATLAB forum: http://www.mathworks.com/matlabcentral/newsreader/view_thread/293279

kalliste commented 9 years ago

Should be fixed in the current version