I figured out the problem. In my code, I has a relative path that pointed to a configuration file my code needed that used to be in a subdirectory. That folder was recently moved, but replacing the folder back in the directory where the executable was generated and run from solved the segmentation fault issue. I still don't know why I was getting all those XCode messages, but they seem to be unrelated to the 'Segmentation Fault' error.
Code Generation Segmentation Fault
17 views (last 30 days)
Show older comments
I am trying to generate an executable from my Matlab Code. I have done this in the past with this same codebase and it worked fine. I am now getting segmentation fault errors when I run the executable in Terminal:
mshafer@dev567 detector % ./detectstreaming
zsh: segmentation fault ./detectstreaming
Coder says the code generation was successful (see below-bottom), but I am getting a lot of messages like Requested but did not find extension point with identifier Xcode.IDEKit in the build logs (see below and attached). The full listing of build messages is in the attached report .mat files in the ReportInfo.BuildLogs.Text. I am running R2022a, I'm on macOS 12.4, and I have XCode 13.4 installed. Running xcode-select -p in terminal produces /Applications/Xcode.app/Contents/Developer which is the currect directory for XCode. When I convert my Coder project to a script I get the following, which is important if you want to know my coder config settings:
% DETECTSTREAMING_SCRIPT Generate executable detectstreaming from
% detectstreaming.
%
% Script generated from project 'detectstreaming.prj' on 14-Jun-2022.
%
% See also CODER, CODER.CONFIG, CODER.TYPEOF, CODEGEN.
%% Create configuration object of class 'coder.CodeConfig'.
cfg = coder.config('exe','ecoder',false);
cfg.TargetLang = 'C++';
cfg.GenerateExampleMain = 'GenerateCodeAndCompile';
cfg.GenerateReport = true;
cfg.MaxIdLength = 1024;
cfg.ReportPotentialDifferences = false;
%% Invoke MATLAB Coder.
cd('/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector');
codegen -config cfg detectstreaming
Please help. This was working previously, but I don't know what changed to cause the current problem.
-Michael
Example of build log report messages
### Building 'detectstreaming': "/Applications/MATLAB_R2022a.app/bin/maci64/gmake" -f detectstreaming_rtw.mk all
2022-06-14 10:16:36.968 xcodebuild[19087:270357] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-06-14 10:16:36.968 xcodebuild[19087:270357] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -arch x86_64 -fno-common -fexceptions -mmacosx-version-min=10.15 -O3 -Xpreprocessor -fopenmp -I/Applications/MATLAB_R2022a.app/toolbox/eml/externalDependency/omp/maci64/include -DOpenMP_omp_LIBRARY=/Applications/MATLAB_R2022a.app/sys/os/maci64/libiomp5.dylib -DMODEL=detectstreaming -I/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/codegen/exe/detectstreaming -I/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector -I/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/codegen/exe/detectstreaming/examples -I/Applications/MATLAB_R2022a.app/toolbox/shared/spc/src_ml/extern/include -I/Applications/MATLAB_R2022a.app/extern/include -o "coder_posix_time.o" "/Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/codegen/exe/detectstreaming/coder_posix_time.c"
:
:(LOTS OF MESSAGES LIKE THOSE ABOVE)
:
### Creating standalone executable /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/detectstreaming ...
xcrun clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/../../.. -Wl,-rpath,/Applications/MATLAB_R2022a.app/sys/os// -lm -ldl -o /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/detectstreaming coder_posix_time.o detectstreaming_data.o rt_nonfinite.o rtGetNaN.o rtGetInf.o detectstreaming_initialize.o detectstreaming_terminate.o detectstreaming.o fileManager.o fgetl.o ftell.o fseek.o find.o str2double.o str2matrix.o validator_check_size.o int2str.o channelreceiver.o pause.o singlecomplex2double.o dec2hex.o colon.o fwrite.o tic.o timeKeeper.o stft.o allOrAny.o psdfreqvec.o movSumProdOrMean.o median.o quickselect.o repmat.o mean.o linspace.o interp1.o minOrMax.o weightingmatrix.o buildthreshold.o buildtimecorrelatormatrix.o unique.o sortLE.o randn.o mvksdensity.o any1.o sum.o ecdf.o diff.o mad.o nanmedian.o bsearch.o all.o mtimes.o pchip.o incohsumtoeplitz.o locBsearch.o sparse.o ifWhileCond.o toc.o controlreceiver.o setup.o eml_rand_mt19937ar_stateful.o main.o CoderTimeAPI.o strcmp.o sort3.o str2double1.o sort.o sortIdx.o formatSTFTOutput.o insertionsort.o introsort.o heapsort.o eml_rand_mt19937ar.o nullAssignment.o circshift.o fftshift.o wfmstft.o div.o waveform.o assembleWq.o eml_mtimes_helper.o string1.o DetectorConfig.o pulse.o pulsestats.o AsyncBuffercgHelper.o AsyncBuffer.o UDPReceiver.o sparse1.o FFTImplementationCallback.o detectstreaming_rtwutil.o DAHostLib_Network.o DAHostLib_rtw.o -L"/Applications/MATLAB_R2022a.app/sys/os/maci64" -lm -lstdc++ -liomp5
### Created: /Users/mshafer/Desktop/PLAYGROUND/CODE_TOEPLITZ/uavrt_detection/detector/detectstreaming
### Successfully generated all binary outputs.
gmake: Nothing to be done for `all'.
'
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!