wschwanghart / topotoolbox

A MATLAB software for the analysis of digital elevation models -
https://topotoolbox.wordpress.com/
153 stars 89 forks source link

Segmentation violation error when running flowacc #19

Closed ginevmoore closed 3 years ago

ginevmoore commented 3 years ago

Dear Dr. Schwanghart,

I am a graduate student at the University of Washington and have been using the TopoToolbox for research - thank you for creating such an awesome set of tools!

I recently forked the github repository to make updates more easily accessible, and am running into issues when trying to run the flowacc function. Have you seen this error before or do you have any suggestions on how to move forward? I have pasted my matlab commands and associated error below.

I also had to update matlab before forking the topotoolbox repository and am wondering if it has something to do with my installation - I have to add the path to the topotoolbox every time I open matlab which I didn't have to do before.

Thank you! I hope you had a restful holiday, Ginevra

DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); Undefined function or variable 'GRIDobj'.

addpath(genpath('/Users/ginevramoore/Documents/matlab_toolboxes/topotoolbox')) DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); FD=FLOWobj(DEM,'preprocess','carve','verbose',true); 06-Jan-2021 09:17:08 -- Sink filling 06-Jan-2021 09:17:12 -- Flat sections identified 06-Jan-2021 09:17:13 -- Weights for graydist calculated 06-Jan-2021 09:17:14 -- Auxiliary topography in flats calculated 06-Jan-2021 09:17:14 -- Pixels sorted (1) 06-Jan-2021 09:17:15 -- Pixels sorted (2) 06-Jan-2021 09:17:17 -- Ordered topology established A=flowacc(FD);


   Segmentation violation detected at Wed Jan 06 09:17:22 2021 -0800

Configuration: Crash Decoding : Disabled - No sandbox or build area path Crash Mode : continue (default) Default Encoding : ISO-8859-1 Deployed : false Graphics Driver : Unknown hardware Java Version : Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode MATLAB Architecture : maci64 MATLAB Entitlement ID : 6288173 MATLAB Root : /Applications/MATLAB_R2019a.app MATLAB Version : 9.6.0.1472908 (R2019a) Update 9 OpenGL : hardware Operating System : Mac OS Version 10.13.5 (Build 17F77) Process ID : 1692 Processor ID : x86 Family 6 Model 142 Stepping 9, GenuineIntel Session Key : 6aeba892-b1fd-4aee-9995-1df82d208481 Window System : Quartz

Fault Count: 1

Abnormal termination: Segmentation violation

Register State (from fault): RAX = 0000000189e78020 RBX = 004a24e9004a2c0b RCX = 0000000000000000 RDX = 0000000000000000 RSP = 0000700008af99c0 RBP = 0000700008af9a00 RSI = 0000000000000000 RDI = 004a2c0d004a332f

R8 = 0000000003000001 R9 = 0000000000000003 R10 = 0000000000000000 R11 = 0000000000000007 R12 = 00000001b0ab0020 R13 = 0000700008afa088 R14 = 00000001acd63020 R15 = 00000000006448fa

RIP = 0000000166544e38 RFL = 0000000000010246

CS = 000000000000002b FS = 0000000000000000 GS = 0000000000000000

Stack Trace (from fault): [ 0] 0x000000010820fed1 bin/maci64/libmwfl.dylib+00007889 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000049 [ 1] 0x0000000108215c55 bin/maci64/libmwfl.dylib+00031829 _ZN10foundation4core4test17terminate_handledERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00006421 [ 2] 0x0000000108214085 bin/maci64/libmwfl.dylib+00024709 _ZN10foundation4core4diag13terminate_logEPKcPK17darwin_ucontext+00000149 [ 3] 0x000000010d257b37 bin/maci64/libmwmcr.dylib+00670519 _Z19mnPrintErrorMessageRKNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00013063 [ 4] 0x000000010d2556c7 bin/maci64/libmwmcr.dylib+00661191 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003735 [ 5] 0x000000010d252e54 bin/maci64/libmwmcr.dylib+00650836 mnFatalSignalHandler+00000148 [ 6] 0x00007fff52598f5a /usr/lib/system/libsystem_platform.dylib+00008026 _sigtramp+00000026 [ 7] 0x000000010abe9000 +00000000 [ 8] 0x000000010e3a852c bin/maci64/libmex.dylib+00242988 _ZNK18C_DispatchStrategy8dispatchEiPP11mxArraytagiS2+00000140 [ 9] 0x000000010e3a82e4 bin/maci64/libmex.dylib+00242404 _ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArraytagiS2+00000484 [ 10] 0x000000010e38fcdf bin/maci64/libmex.dylib+00142559 _ZN7Mfh_mex13dispatch_fileEiPP11mxArraytagiS2+00000159 [ 11] 0x000000010d39b78e bin/maci64/libmwm_dispatcher.dylib+00493454 _ZN8Mfh_file20dispatch_file_commonEMS_FviPP11mxArray_tagiS2_EiS2iS2+00000142 [ 12] 0x000000010d39bdaa bin/maci64/libmwm_dispatcher.dylib+00495018 _ZN8Mfh_file8dispatchEiPNSt3110unique_ptrI11mxArray_tagN6matrix6detail17mxDestroydeleterEEEiPPS2+00000378 [ 13] 0x000000010edcc0bd bin/maci64/libmwm_lxe.dylib+09715901 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001357 [ 14] 0x000000010eece99c bin/maci64/libmwm_lxe.dylib+10774940 _ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1S1+00000556 [ 15] 0x000000010eece892 bin/maci64/libmwm_lxe.dylib+10774674 _ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1S1+00000290 [ 16] 0x000000010ee2e14e bin/maci64/libmwm_lxe.dylib+10117454 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_12apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2S2+00000014 [ 17] 0x000000010e6140b0 bin/maci64/libmwm_lxe.dylib+01622192 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS2ts4TypeES8+00000448 [ 18] 0x000000010e6133c7 bin/maci64/libmwm_lxe.dylib+01618887 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001191 [ 19] 0x000000010e611bbd bin/maci64/libmwm_lxe.dylib+01612733 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077 [ 20] 0x000000010e606403 bin/maci64/libmwm_lxe.dylib+01565699 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099 [ 21] 0x000000010e6066a9 bin/maci64/libmwm_lxe.dylib+01566377 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217 [ 22] 0x000000010e611917 bin/maci64/libmwm_lxe.dylib+01612055 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpctypeES4+00000215 [ 23] 0x000000010e6117ec bin/maci64/libmwm_lxe.dylib+01611756 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000108 [ 24] 0x000000010e721fdf bin/maci64/libmwm_lxe.dylib+02727903 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911 [ 25] 0x000000010e727137 bin/maci64/libmwm_lxe.dylib+02748727 ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6+00000295 [ 26] 0x000000010ec99b19 bin/maci64/libmwm_lxe.dylib+08461081 ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6+00000153 [ 27] 0x000000010ec48b49 bin/maci64/libmwm_lxe.dylib+08129353 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKN2ir4termERNS0_18IEvaluationContextE+00000425 [ 28] 0x000000010ec4ca47 bin/maci64/libmwm_lxe.dylib+08145479 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS0_18IEvaluationContextE+00000215 [ 29] 0x000000010ec4cb0a bin/maci64/libmwm_lxe.dylib+08145674 _ZN9MathWorks3lxe9Evaluator13EvalStatementERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000106 [ 30] 0x000000010ecdbb77 bin/maci64/libmwm_lxe.dylib+08731511 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000327 [ 31] 0x000000010ecdba67 bin/maci64/libmwm_lxe.dylib+08731239 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000055 [ 32] 0x000000010e413d4d bin/maci64/libmwbridge.dylib+00077133 _Z8mnParserv+00000653 [ 33] 0x000000010d21e4e6 bin/maci64/libmwmcr.dylib+00435430 _Z15runParserHelperv+00000326 [ 34] 0x000000010d1bf295 bin/maci64/libmwmcr.dylib+00045717 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000917 [ 35] 0x000000010d1bf1d7 bin/maci64/libmwmcr.dylib+00045527 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000727 [ 36] 0x000000010d1bf182 bin/maci64/libmwmcr.dylib+00045442 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000642 [ 37] 0x000000010d0d0c0e bin/maci64/libmwiqm.dylib+00359438 _ZN7mwboost6detail8function21function_obj_invoker0INSt318functionIFNS_3anyEvEEES5_E6invokeERNS1_15function_bufferE+00000030 [ 38] 0x000000010d0d062b bin/maci64/libmwiqm.dylib+00357931 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000251 [ 39] 0x000000010d1fe44d bin/maci64/libmwmcr.dylib+00304205 _Z14mcr_terminate0v+00006717 [ 40] 0x000000010d0b66ae bin/maci64/libmwiqm.dylib+00251566 _ZNK3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tag+00001022 [ 41] 0x000000010d098f5f bin/maci64/libmwiqm.dylib+00130911 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_EEEEEE+00001119 [ 42] 0x000000010d08ce7a bin/maci64/libmwiqm.dylib+00081530 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000362 [ 43] 0x000000010d1ea55a bin/maci64/libmwmcr.dylib+00222554 _ZN3mcr7runtime22InterpreterThreadMulti14process_eventsEv+00000202 [ 44] 0x000000010d1eacb7 bin/maci64/libmwmcr.dylib+00224439 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3113packaged_taskIFvvEEE+00000183 [ 45] 0x000000010d1ebc60 bin/maci64/libmwmcr.dylib+00228448 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3__113packaged_taskIFvvEEE+00004192 [ 46] 0x0000000105f831ec /Applications/MATLAB_R2019a.app/bin/maci64/libmwboost_thread.dylib+00012780 _ZN7mwboost6thread21start_thread_noexceptEv+00000380 [ 47] 0x00007fff525a2661 /usr/lib/system/libsystem_pthread.dylib+00013921 _pthread_body+00000340 [ 48] 0x00007fff525a250d /usr/lib/system/libsystem_pthread.dylib+00013581 _pthread_body+00000000 [ 49] 0x00007fff525a1bf9 /usr/lib/system/libsystem_pthread.dylib+00011257 thread_start+00000013

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. This crash report has been saved to disk as /Users/ginevramoore/matlab_crash_dump.1692-1

Caught MathWorks::System::FatalException [Please exit and restart MATLAB]>>

dirkscherler commented 3 years ago

Hi Ginevra,

I guess Wolfgang will also send you an answer - probably one that is more complete. The error message indicates that it’s the mex-file that caused it. Perhaps there is an issue with the compiler on your Mac. Probably the first step I would try as a work around is to not use the mex file and see what happens. In the flowacc function there is an if-else statement in lines 68 and 136 (at least in the version I currently have on my computer). The first part executes the m-file, the second the mex-file. Comment-out the mex-file part and make the other the only one and you won’t be calling the mex-file. That should allow you to proceed.

If you have to add the path to the toolbox each time opening Matlab, it means you are not able to save the paths. That usually happens if you don’t have admin rights. Either get admin rights, or simply have your add path(genpath(…)) command at the start of each scripts that calls functions from the TopoToolbox.

Hope that helps for the moment. Cheers, Dirk

-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ German Research Centre for Geosciences GFZ Section 3.3, Earth Surface Geochemistry Telegrafenberg, Room E229 D-14473 Potsdam, Germany

and

Freie Universität Berlin Institute of Geological Sciences Malteserstr. 74-100 D-12249 Berlin, Germany

phone: +49 331 288-28646 fax: +49 331 288-2852 e-mail: scherler@gfz-potsdam.de https://sites.google.com/site/scherlerdirk/

On 6. Jan 2021, at 18:44, Ginevra Moore notifications@github.com wrote:

Dear Dr. Schwanghart,

I am a graduate student at the University of Washington and have been using the TopoToolbox for research - thank you for creating such an awesome set of tools!

I recently forked the github repository to make updates more easily accessible, and am running into issues when trying to run the flowacc function. Have you seen this error before or do you have any suggestions on how to move forward? I have pasted my matlab commands and associated error below.

I also had to update matlab before forking the topotoolbox repository and am wondering if it has something to do with my installation - I have to add the path to the topotoolbox every time I open matlab which I didn't have to do before.

Thank you! I hope you had a restful holiday, Ginevra

DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); Undefined function or variable 'GRIDobj'.

addpath(genpath('/Users/ginevramoore/Documents/matlab_toolboxes/topotoolbox')) DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); FD=FLOWobj(DEM,'preprocess','carve','verbose',true); 06-Jan-2021 09:17:08 -- Sink filling 06-Jan-2021 09:17:12 -- Flat sections identified 06-Jan-2021 09:17:13 -- Weights for graydist calculated 06-Jan-2021 09:17:14 -- Auxiliary topography in flats calculated 06-Jan-2021 09:17:14 -- Pixels sorted (1) 06-Jan-2021 09:17:15 -- Pixels sorted (2) 06-Jan-2021 09:17:17 -- Ordered topology established A=flowacc(FD);

Segmentation violation detected at Wed Jan 06 09:17:22 2021 -0800 Configuration: Crash Decoding : Disabled - No sandbox or build area path Crash Mode : continue (default) Default Encoding : ISO-8859-1 Deployed : false Graphics Driver : Unknown hardware Java Version : Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode MATLAB Architecture : maci64 MATLAB Entitlement ID : 6288173 MATLAB Root : /Applications/MATLAB_R2019a.app MATLAB Version : 9.6.0.1472908 (R2019a) Update 9 OpenGL : hardware Operating System : Mac OS Version 10.13.5 (Build 17F77) Process ID : 1692 Processor ID : x86 Family 6 Model 142 Stepping 9, GenuineIntel Session Key : 6aeba892-b1fd-4aee-9995-1df82d208481 Window System : Quartz

Fault Count: 1

Abnormal termination: Segmentation violation

Register State (from fault): RAX = 0000000189e78020 RBX = 004a24e9004a2c0b RCX = 0000000000000000 RDX = 0000000000000000 RSP = 0000700008af99c0 RBP = 0000700008af9a00 RSI = 0000000000000000 RDI = 004a2c0d004a332f

R8 = 0000000003000001 R9 = 0000000000000003 R10 = 0000000000000000 R11 = 0000000000000007 R12 = 00000001b0ab0020 R13 = 0000700008afa088 R14 = 00000001acd63020 R15 = 00000000006448fa

RIP = 0000000166544e38 RFL = 0000000000010246

CS = 000000000000002b FS = 0000000000000000 GS = 0000000000000000

Stack Trace (from fault): [ 0] 0x000000010820fed1 bin/maci64/libmwfl.dylib+00007889 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000049 [ 1] 0x0000000108215c55 bin/maci64/libmwfl.dylib+00031829 _ZN10foundation4core4test17terminate_handledERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00006421 [ 2] 0x0000000108214085 bin/maci64/libmwfl.dylib+00024709 _ZN10foundation4core4diag13terminate_logEPKcPK17darwin_ucontext+00000149 [ 3] 0x000000010d257b37 bin/maci64/libmwmcr.dylib+00670519 _Z19mnPrintErrorMessageRKNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00013063 [ 4] 0x000000010d2556c7 bin/maci64/libmwmcr.dylib+00661191 _Z19mnPrintErrorMessageRKNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003735 [ 5] 0x000000010d252e54 bin/maci64/libmwmcr.dylib+00650836 mnFatalSignalHandler+00000148 [ 6] 0x00007fff52598f5a /usr/lib/system/libsystem_platform.dylib+00008026 _sigtramp+00000026 [ 7] 0x000000010abe9000 +00000000 [ 8] 0x000000010e3a852c bin/maci64/libmex.dylib+00242988 ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2+00000140 [ 9] 0x000000010e3a82e4 bin/maci64/libmex.dylib+00242404 ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArray_tagiS2+00000484 [ 10] 0x000000010e38fcdf bin/maci64/libmex.dylib+00142559 ZN7Mfh_mex13dispatch_fileEiPP11mxArray_tagiS2+00000159 [ 11] 0x000000010d39b78e bin/maci64/libmwm_dispatcher.dylib+00493454 ZN8Mfh_file20dispatch_file_commonEMS_FviPP11mxArray_tagiS2_EiS2_iS2+00000142 [ 12] 0x000000010d39bdaa bin/maci64/libmwm_dispatcher.dylib+00495018 ZN8Mfh_file8dispatchEiPNSt3110unique_ptrI11mxArray_tagN6matrix6detail17mxDestroy_deleterEEEiPPS2+00000378 [ 13] 0x000000010edcc0bd bin/maci64/libmwm_lxe.dylib+09715901 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001357 [ 14] 0x000000010eece99c bin/maci64/libmwm_lxe.dylib+10774940 ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1+00000556 [ 15] 0x000000010eece892 bin/maci64/libmwm_lxe.dylib+10774674 ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1+00000290 [ 16] 0x000000010ee2e14e bin/maci64/libmwm_lxe.dylib+10117454 ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_12apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2+00000014 [ 17] 0x000000010e6140b0 bin/maci64/libmwm_lxe.dylib+01622192 ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8+00000448 [ 18] 0x000000010e6133c7 bin/maci64/libmwm_lxe.dylib+01618887 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001191 [ 19] 0x000000010e611bbd bin/maci64/libmwm_lxe.dylib+01612733 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077 [ 20] 0x000000010e606403 bin/maci64/libmwm_lxe.dylib+01565699 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099 [ 21] 0x000000010e6066a9 bin/maci64/libmwm_lxe.dylib+01566377 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217 [ 22] 0x000000010e611917 bin/maci64/libmwm_lxe.dylib+01612055 ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4+00000215 [ 23] 0x000000010e6117ec bin/maci64/libmwm_lxe.dylib+01611756 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000108 [ 24] 0x000000010e721fdf bin/maci64/libmwm_lxe.dylib+02727903 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911 [ 25] 0x000000010e727137 bin/maci64/libmwm_lxe.dylib+02748727 ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6+00000295 [ 26] 0x000000010ec99b19 bin/maci64/libmwm_lxe.dylib+08461081 ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6+00000153 [ 27] 0x000000010ec48b49 bin/maci64/libmwm_lxe.dylib+08129353 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKN2ir4termERNS0_18IEvaluationContextE+00000425 [ 28] 0x000000010ec4ca47 bin/maci64/libmwm_lxe.dylib+08145479 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS0_18IEvaluationContextE+00000215 [ 29] 0x000000010ec4cb0a bin/maci64/libmwm_lxe.dylib+08145674 _ZN9MathWorks3lxe9Evaluator13EvalStatementERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000106 [ 30] 0x000000010ecdbb77 bin/maci64/libmwm_lxe.dylib+08731511 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000327 [ 31] 0x000000010ecdba67 bin/maci64/libmwm_lxe.dylib+08731239 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000055 [ 32] 0x000000010e413d4d bin/maci64/libmwbridge.dylib+00077133 _Z8mnParserv+00000653 [ 33] 0x000000010d21e4e6 bin/maci64/libmwmcr.dylib+00435430 _Z15runParserHelperv+00000326 [ 34] 0x000000010d1bf295 bin/maci64/libmwmcr.dylib+00045717 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000917 [ 35] 0x000000010d1bf1d7 bin/maci64/libmwmcr.dylib+00045527 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000727 [ 36] 0x000000010d1bf182 bin/maci64/libmwmcr.dylib+00045442 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000642 [ 37] 0x000000010d0d0c0e bin/maci64/libmwiqm.dylib+00359438 _ZN7mwboost6detail8function21function_obj_invoker0INSt318functionIFNS_3anyEvEEES5_E6invokeERNS1_15function_bufferE+00000030 [ 38] 0x000000010d0d062b bin/maci64/libmwiqm.dylib+00357931 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000251 [ 39] 0x000000010d1fe44d bin/maci64/libmwmcr.dylib+00304205 _Z14mcr_terminate0v+00006717 [ 40] 0x000000010d0b66ae bin/maci64/libmwiqm.dylib+00251566 _ZNK3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tag+00001022 [ 41] 0x000000010d098f5f bin/maci64/libmwiqm.dylib+00130911 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_EEEEEE+00001119 [ 42] 0x000000010d08ce7a bin/maci64/libmwiqm.dylib+00081530 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000362 [ 43] 0x000000010d1ea55a bin/maci64/libmwmcr.dylib+00222554 _ZN3mcr7runtime22InterpreterThreadMulti14process_eventsEv+00000202 [ 44] 0x000000010d1eacb7 bin/maci64/libmwmcr.dylib+00224439 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3113packaged_taskIFvvEEE+00000183 [ 45] 0x000000010d1ebc60 bin/maci64/libmwmcr.dylib+00228448 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3113packaged_taskIFvvEEE+00004192 [ 46] 0x0000000105f831ec /Applications/MATLAB_R2019a.app/bin/maci64/libmwboost_thread.dylib+00012780 _ZN7mwboost6thread21start_thread_noexceptEv+00000380 [ 47] 0x00007fff525a2661 /usr/lib/system/libsystem_pthread.dylib+00013921 _pthread_body+00000340 [ 48] 0x00007fff525a250d /usr/lib/system/libsystem_pthread.dylib+00013581 _pthread_body+00000000 [ 49] 0x00007fff525a1bf9 /usr/lib/system/libsystem_pthread.dylib+00011257 thread_start+00000013

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. This crash report has been saved to disk as /Users/ginevramoore/matlab_crash_dump.1692-1

Caught MathWorks::System::FatalException [Please exit and restart MATLAB]>>

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOZBAFLHUXOXZ3MLW6Q7YDSYSOPJANCNFSM4VX3JA7Q.

ginevmoore commented 3 years ago

Hi Dirk,

Thank you for the quick reply! I ended up downloading the v2.3 release from Dr. Schwanghart's blog instead of creating a fork of the most up-to-date version on the github repository. Dr. Schwanghart had similar suggestions of either deleting the mex file or recompiling the code. I will try these solutions when the new functions that have been developed since 2019 are useful, however everything I need is working fine now!

Thanks for your help and suggestions, Ginevra

On Wed, Jan 6, 2021 at 12:26 PM dirkscherler notifications@github.com wrote:

Hi Ginevra,

I guess Wolfgang will also send you an answer - probably one that is more complete. The error message indicates that it’s the mex-file that caused it. Perhaps there is an issue with the compiler on your Mac. Probably the first step I would try as a work around is to not use the mex file and see what happens. In the flowacc function there is an if-else statement in lines 68 and 136 (at least in the version I currently have on my computer). The first part executes the m-file, the second the mex-file. Comment-out the mex-file part and make the other the only one and you won’t be calling the mex-file. That should allow you to proceed.

If you have to add the path to the toolbox each time opening Matlab, it means you are not able to save the paths. That usually happens if you don’t have admin rights. Either get admin rights, or simply have your add path(genpath(…)) command at the start of each scripts that calls functions from the TopoToolbox.

Hope that helps for the moment. Cheers, Dirk

-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ German Research Centre for Geosciences GFZ Section 3.3, Earth Surface Geochemistry Telegrafenberg, Room E229 D-14473 Potsdam, Germany

and

Freie Universität Berlin Institute of Geological Sciences Malteserstr. 74-100 D-12249 Berlin, Germany

phone: +49 331 288-28646 fax: +49 331 288-2852 e-mail: scherler@gfz-potsdam.de https://sites.google.com/site/scherlerdirk/

On 6. Jan 2021, at 18:44, Ginevra Moore notifications@github.com wrote:

Dear Dr. Schwanghart,

I am a graduate student at the University of Washington and have been using the TopoToolbox for research - thank you for creating such an awesome set of tools!

I recently forked the github repository to make updates more easily accessible, and am running into issues when trying to run the flowacc function. Have you seen this error before or do you have any suggestions on how to move forward? I have pasted my matlab commands and associated error below.

I also had to update matlab before forking the topotoolbox repository and am wondering if it has something to do with my installation - I have to add the path to the topotoolbox every time I open matlab which I didn't have to do before.

Thank you! I hope you had a restful holiday, Ginevra

DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); Undefined function or variable 'GRIDobj'.

addpath(genpath('/Users/ginevramoore/Documents/matlab_toolboxes/topotoolbox')) DEM=GRIDobj('../TutorialFiles/Tutorial_Data/DEM.tif'); FD=FLOWobj(DEM,'preprocess','carve','verbose',true); 06-Jan-2021 09:17:08 -- Sink filling 06-Jan-2021 09:17:12 -- Flat sections identified 06-Jan-2021 09:17:13 -- Weights for graydist calculated 06-Jan-2021 09:17:14 -- Auxiliary topography in flats calculated 06-Jan-2021 09:17:14 -- Pixels sorted (1) 06-Jan-2021 09:17:15 -- Pixels sorted (2) 06-Jan-2021 09:17:17 -- Ordered topology established A=flowacc(FD);

Segmentation violation detected at Wed Jan 06 09:17:22 2021 -0800 Configuration: Crash Decoding : Disabled - No sandbox or build area path Crash Mode : continue (default) Default Encoding : ISO-8859-1 Deployed : false Graphics Driver : Unknown hardware Java Version : Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode MATLAB Architecture : maci64 MATLAB Entitlement ID : 6288173 MATLAB Root : /Applications/MATLAB_R2019a.app MATLAB Version : 9.6.0.1472908 (R2019a) Update 9 OpenGL : hardware Operating System : Mac OS Version 10.13.5 (Build 17F77) Process ID : 1692 Processor ID : x86 Family 6 Model 142 Stepping 9, GenuineIntel Session Key : 6aeba892-b1fd-4aee-9995-1df82d208481 Window System : Quartz

Fault Count: 1

Abnormal termination: Segmentation violation

Register State (from fault): RAX = 0000000189e78020 RBX = 004a24e9004a2c0b RCX = 0000000000000000 RDX = 0000000000000000 RSP = 0000700008af99c0 RBP = 0000700008af9a00 RSI = 0000000000000000 RDI = 004a2c0d004a332f

R8 = 0000000003000001 R9 = 0000000000000003 R10 = 0000000000000000 R11 = 0000000000000007 R12 = 00000001b0ab0020 R13 = 0000700008afa088 R14 = 00000001acd63020 R15 = 00000000006448fa

RIP = 0000000166544e38 RFL = 0000000000010246

CS = 000000000000002b FS = 0000000000000000 GS = 0000000000000000

Stack Trace (from fault): [ 0] 0x000000010820fed1 bin/maci64/libmwfl.dylib+00007889 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000049 [ 1] 0x0000000108215c55 bin/maci64/libmwfl.dylib+00031829 _ZN10foundation4core4test17terminate_handledERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00006421 [ 2] 0x0000000108214085 bin/maci64/libmwfl.dylib+00024709 _ZN10foundation4core4diag13terminate_logEPKcPK17darwin_ucontext+00000149 [ 3] 0x000000010d257b37 bin/maci64/libmwmcr.dylib+00670519 _Z19mnPrintErrorMessageRKNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00013063 [ 4] 0x000000010d2556c7 bin/maci64/libmwmcr.dylib+00661191 _Z19mnPrintErrorMessageRKNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003735 [ 5] 0x000000010d252e54 bin/maci64/libmwmcr.dylib+00650836 mnFatalSignalHandler+00000148 [ 6] 0x00007fff52598f5a /usr/lib/system/libsystem_platform.dylib+00008026 _sigtramp+00000026 [ 7] 0x000000010abe9000 +00000000 [ 8] 0x000000010e3a852c bin/maci64/libmex.dylib+00242988 ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2+00000140 [ 9] 0x000000010e3a82e4 bin/maci64/libmex.dylib+00242404 ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArray_tagiS2+00000484 [ 10] 0x000000010e38fcdf bin/maci64/libmex.dylib+00142559 ZN7Mfh_mex13dispatch_fileEiPP11mxArray_tagiS2+00000159 [ 11] 0x000000010d39b78e bin/maci64/libmwm_dispatcher.dylib+00493454 ZN8Mfh_file20dispatch_file_commonEMS_FviPP11mxArray_tagiS2_EiS2_iS2+00000142 [ 12] 0x000000010d39bdaa bin/maci64/libmwm_dispatcher.dylib+00495018 ZN8Mfh_file8dispatchEiPNSt3110unique_ptrI11mxArray_tagN6matrix6detail17mxDestroy_deleterEEEiPPS2+00000378 [ 13] 0x000000010edcc0bd bin/maci64/libmwm_lxe.dylib+09715901 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001357 [ 14] 0x000000010eece99c bin/maci64/libmwm_lxe.dylib+10774940 ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1+00000556 [ 15] 0x000000010eece892 bin/maci64/libmwm_lxe.dylib+10774674 ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1+00000290 [ 16] 0x000000010ee2e14e bin/maci64/libmwm_lxe.dylib+10117454 ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_12apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2+00000014 [ 17] 0x000000010e6140b0 bin/maci64/libmwm_lxe.dylib+01622192 ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8+00000448 [ 18] 0x000000010e6133c7 bin/maci64/libmwm_lxe.dylib+01618887 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001191 [ 19] 0x000000010e611bbd bin/maci64/libmwm_lxe.dylib+01612733 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077 [ 20] 0x000000010e606403 bin/maci64/libmwm_lxe.dylib+01565699 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099 [ 21] 0x000000010e6066a9 bin/maci64/libmwm_lxe.dylib+01566377 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217 [ 22] 0x000000010e611917 bin/maci64/libmwm_lxe.dylib+01612055 ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4+00000215 [ 23] 0x000000010e6117ec bin/maci64/libmwm_lxe.dylib+01611756 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000108 [ 24] 0x000000010e721fdf bin/maci64/libmwm_lxe.dylib+02727903 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911 [ 25] 0x000000010e727137 bin/maci64/libmwm_lxe.dylib+02748727 ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6+00000295 [ 26] 0x000000010ec99b19 bin/maci64/libmwm_lxe.dylib+08461081 ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6+00000153 [ 27] 0x000000010ec48b49 bin/maci64/libmwm_lxe.dylib+08129353 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKN2ir4termERNS0_18IEvaluationContextE+00000425 [ 28] 0x000000010ec4ca47 bin/maci64/libmwm_lxe.dylib+08145479 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS0_18IEvaluationContextE+00000215 [ 29] 0x000000010ec4cb0a bin/maci64/libmwm_lxe.dylib+08145674 _ZN9MathWorks3lxe9Evaluator13EvalStatementERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000106 [ 30] 0x000000010ecdbb77 bin/maci64/libmwm_lxe.dylib+08731511 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000327 [ 31] 0x000000010ecdba67 bin/maci64/libmwm_lxe.dylib+08731239 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000055 [ 32] 0x000000010e413d4d bin/maci64/libmwbridge.dylib+00077133 _Z8mnParserv+00000653 [ 33] 0x000000010d21e4e6 bin/maci64/libmwmcr.dylib+00435430 _Z15runParserHelperv+00000326 [ 34] 0x000000010d1bf295 bin/maci64/libmwmcr.dylib+00045717 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000917 [ 35] 0x000000010d1bf1d7 bin/maci64/libmwmcr.dylib+00045527 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000727 [ 36] 0x000000010d1bf182 bin/maci64/libmwmcr.dylib+00045442 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000642 [ 37] 0x000000010d0d0c0e bin/maci64/libmwiqm.dylib+00359438 _ZN7mwboost6detail8function21function_obj_invoker0INSt318functionIFNS_3anyEvEEES5_E6invokeERNS1_15function_bufferE+00000030 [ 38] 0x000000010d0d062b bin/maci64/libmwiqm.dylib+00357931 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000251 [ 39] 0x000000010d1fe44d bin/maci64/libmwmcr.dylib+00304205 _Z14mcr_terminate0v+00006717 [ 40] 0x000000010d0b66ae bin/maci64/libmwiqm.dylib+00251566 _ZNK3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tag+00001022 [ 41] 0x000000010d098f5f bin/maci64/libmwiqm.dylib+00130911 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_EEEEEE+00001119 [ 42] 0x000000010d08ce7a bin/maci64/libmwiqm.dylib+00081530 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000362 [ 43] 0x000000010d1ea55a bin/maci64/libmwmcr.dylib+00222554 _ZN3mcr7runtime22InterpreterThreadMulti14process_eventsEv+00000202 [ 44] 0x000000010d1eacb7 bin/maci64/libmwmcr.dylib+00224439 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3113packaged_taskIFvvEEE+00000183 [ 45] 0x000000010d1ebc60 bin/maci64/libmwmcr.dylib+00228448 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3113packaged_taskIFvvEEE+00004192 [ 46] 0x0000000105f831ec /Applications/MATLAB_R2019a.app/bin/maci64/libmwboost_thread.dylib+00012780 _ZN7mwboost6thread21start_thread_noexceptEv+00000380 [ 47] 0x00007fff525a2661 /usr/lib/system/libsystem_pthread.dylib+00013921 _pthread_body+00000340 [ 48] 0x00007fff525a250d /usr/lib/system/libsystem_pthread.dylib+00013581 _pthread_body+00000000 [ 49] 0x00007fff525a1bf9 /usr/lib/system/libsystem_pthread.dylib+00011257 thread_start+00000013

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. This crash report has been saved to disk as /Users/ginevramoore/matlab_crash_dump.1692-1

Caught MathWorks::System::FatalException [Please exit and restart MATLAB]>>

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/wschwanghart/topotoolbox/issues/19>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACOZBAFLHUXOXZ3MLW6Q7YDSYSOPJANCNFSM4VX3JA7Q .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-755641815, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQEGC7Y3H3ALHQECH6CC43SYTBRHANCNFSM4VX3JA7Q .

cnsytsma commented 3 years ago

Hello!

I apologize for any errors I make in posting this, as I just made a GitHub account specifically for adding onto this question. I'm also getting a "Segmentation violation" when trying to use the flowacc() command, and the remainder of the error notification looks very similar to Ginevra's (down to the MEX-file error notification).

I would like to try Dirk's suggested method, but I do not know how to comment out parts of a prebuilt command. I've tried searching around a bit but can't seem to find an answer.

If either of you can help or direct me to a thread where this has already been discussed I would really appreciate it!

Thank you, Caleb

ginevmoore commented 3 years ago

Hi Caleb -

Rather than going through the code I ended up just downloading and installing the 2.3 release from here https://topotoolbox.wordpress.com/download/ instead of forking the github repository, and the error doesn't show up anymore. The downside to this is that I don't have access to the new tools in the most up-to-date code on github.

Ginevra

On Thu, Jan 14, 2021 at 8:41 AM cnsytsma notifications@github.com wrote:

Hello!

I apologize for any errors I make in posting this, as I just made a GitHub account specifically for adding onto this question. I'm also getting a "Segmentation violation" when trying to use the flowacc() command, and the remainder of the error notification looks very similar to Ginevra's (down to the MEX-file error notification).

I would like to try Dirk's suggested method, but I do not know how to comment out parts of a prebuilt command. I've tried searching around a bit but can't seem to find an answer.

If either of you can help or direct me to a thread where this has already been discussed I would really appreciate it!

Thank you, Caleb

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-760315692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQEGC5OIRFSV3DZOAIIG6DSZ4NDTANCNFSM4VX3JA7Q .

cnsytsma commented 3 years ago

That worked perfectly!

Thank you so much.

-Caleb

kaihux commented 3 years ago

Hi Ginevra, I guess Wolfgang will also send you an answer - probably one that is more complete. The error message indicates that it’s the mex-file that caused it. Perhaps there is an issue with the compiler on your Mac. Probably the first step I would try as a work around is to not use the mex file and see what happens. In the flowacc function there is an if-else statement in lines 68 and 136 (at least in the version I currently have on my computer). The first part executes the m-file, the second the mex-file. Comment-out the mex-file part and make the other the only one and you won’t be calling the mex-file. That should allow you to proceed. If you have to add the path to the toolbox each time opening Matlab, it means you are not able to save the paths. That usually happens if you don’t have admin rights. Either get admin rights, or simply have your add path(genpath(…)) command at the start of each scripts that calls functions from the TopoToolbox. Hope that helps for the moment. Cheers, Dirk

Hi Dirk,

I think I am having the same problem here. Every time I try to run the STREAMobj function, Matlab crashes and returns the same error message. Could you specify which compiler is problematic and how could it be fixed?

Kai

wschwanghart commented 3 years ago

Hi everybody, unfortunately, I am unable to reconstruct the errors. With or without recompiling the mex files, I've never had any issues on my Windows computers as well as different MATLAB versions. Hence, this seems to be a MAC issue. Unfortunately, I don't have access to a MAC and won't be able to help. Sorry... Best regards, Wolfgang

dirkscherler commented 3 years ago

Hi,

I use a Mac and I don’t have an issue. Also, I think the STREAMobj function doesn’t call mex-function, if I recall correctly. But the drainagebasins function does and it may get called from inside the STREAMoibj function. Perhaps that’s the issue? If so, one could simply disable that feature by replacing in line 114:

if exist(['drainagebasins_mex.' mexext],'file')==3 && ...

To

if (0)

Hope that helps, Dirk

-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ German Research Centre for Geosciences GFZ Section 3.3, Earth Surface Geochemistry Telegrafenberg, Room E229 D-14473 Potsdam, Germany

and

Freie Universität Berlin Institute of Geological Sciences Malteserstr. 74-100 D-12249 Berlin, Germany

phone: +49 331 288-28646 fax: +49 331 288-2852 e-mail: scherler@gfz-potsdam.de https://sites.google.com/site/scherlerdirk/

On 5. Feb 2021, at 12:20, Wolfgang Schwanghart notifications@github.com wrote:

Hi everybody, unfortunately, I am unable to reconstruct the errors. With or without recompiling the mex files, I've never had any issues on my Windows computers as well as different MATLAB versions. Hence, this seems to be a MAC issue. Unfortunately, I don't have access to a MAC and won't be able to help. Sorry... Best regards, Wolfgang

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-773971854, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOZBABMSMOWGJ3ME7H6UTLS5PH6VANCNFSM4VX3JA7Q.

wschwanghart commented 3 years ago

Hi Dirk and everybody. STREAMobj may call a mex function when called with the syntax STREAMobj(FD,'minarea',...). Then, STREAMobj will call flowacc, which again calls the mex-function. Cheers, Wolfgang

dirkscherler commented 3 years ago

I mentioned the drainagebasins functions because I remember that I once also had Matlab crash when calling this function until I disabled the mex-version. So that would be my first action. But I have not experienced that anymore for a while now. Perhaps those that receive the error can specify it further and report when it occurs. If unsure, maybe set a break point in the beginning of STREAMobj and execute code blocks bit by bit. Dirk

-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ German Research Centre for Geosciences GFZ Section 3.3, Earth Surface Geochemistry Telegrafenberg, Room E229 D-14473 Potsdam, Germany

and

Freie Universität Berlin Institute of Geological Sciences Malteserstr. 74-100 D-12249 Berlin, Germany

phone: +49 331 288-28646 fax: +49 331 288-2852 e-mail: scherler@gfz-potsdam.de https://sites.google.com/site/scherlerdirk/

On 5. Feb 2021, at 15:01, Wolfgang Schwanghart notifications@github.com wrote:

Hi Dirk and everybody. STREAMobj may call a mex function when called with the syntax STREAMobj(FD,'minarea',...). Then, STREAMobj will call flowacc, which again calls the mex-function. Cheers, Wolfgang

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-774050143, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOZBAGZMDJOHDGRT4PIHUTS5P23NANCNFSM4VX3JA7Q.

kaihux commented 3 years ago

Hi everyone,

I think I’ve found the solution to fix this error. The problem does lie with the c compiler on mac. I hadn’t had any problem using the STREAMobj until I recently updated the MacOS to Catalina and installed the newest version of Xcode. The MEX function in Matlab on mac depends on the c compilers in Xcode, I believe a recent update in Xcode require a recompilation of the c files. I rebuild the mex files from the .c files (under the folder topotoolbox/@FLOWobj/private/) by executing in matlab, for example, mex flowacc_mex.c. A new mex file named flowacc_mex.mexmaci64 will be generated, notice that the suffix of this file is slightly different from the old mex file in the folder, which is flowacc_mex.mexw64. To avoid further errors of this type, rebuild all the c files in this way and delete the old mex files. Problem solved!

I attached the recompiled mex files below. Hopefully my solution applies to mac users who encounter the same problem.

Best,

Kai Hu


PhD candidate Department of Geoscience University of Wisconsin-Madison Email: kai.hu@wisc.edu

On Feb 5, 2021, at 10:46 AM, dirkscherler notifications@github.com wrote:

I mentioned the drainagebasins functions because I remember that I once also had Matlab crash when calling this function until I disabled the mex-version. So that would be my first action. But I have not experienced that anymore for a while now. Perhaps those that receive the error can specify it further and report when it occurs. If unsure, maybe set a break point in the beginning of STREAMobj and execute code blocks bit by bit. Dirk

-- Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ German Research Centre for Geosciences GFZ Section 3.3, Earth Surface Geochemistry Telegrafenberg, Room E229 D-14473 Potsdam, Germany

and

Freie Universität Berlin Institute of Geological Sciences Malteserstr. 74-100 D-12249 Berlin, Germany

phone: +49 331 288-28646 fax: +49 331 288-2852 e-mail: scherler@gfz-potsdam.de https://sites.google.com/site/scherlerdirk/

On 5. Feb 2021, at 15:01, Wolfgang Schwanghart notifications@github.com wrote:

Hi Dirk and everybody. STREAMobj may call a mex function when called with the syntax STREAMobj(FD,'minarea',...). Then, STREAMobj will call flowacc, which again calls the mex-function. Cheers, Wolfgang

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-774050143, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOZBAGZMDJOHDGRT4PIHUTS5P23NANCNFSM4VX3JA7Q.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wschwanghart/topotoolbox/issues/19#issuecomment-774148843, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPIOCUCXJ2CHMEDIXFHRHDS5QOERANCNFSM4VX3JA7Q.

wschwanghart commented 3 years ago

Hi Kai, thanks, this is super helpful. In order to compile all mex-files at once, the compilemexfiles function should hopefully do. With this, I would close this issue. Thanks again. Best, Wolfgang