Missing symbol required by MATLAB

I downloaded AFQ https://github.com/yeatmanlab/AFQ/wiki with vistasoft and spm8 on my macOS Sierra MATLAB R2017a. I have been trying to run the example code, but the following error is returned:
"
Missing symbol '_malloc' required by
'/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio->/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis->/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices->/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC->/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata->/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices->/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation->/Applications/MATLAB_R2017a.app/bin/maci64/libmwnativestrings.dylib->/Applications/MATLAB_R2017a.app/bin/maci64/libmwsettingscore.dylib->/Applications/MATLAB_R2017a.app/bin/maci64/libmwservices.dylib->/Applications/MATLAB_R2017a.app/bin/maci64/libmex.dylib->/Users/christinejou/Documents/MathWorks/R2017a/archives/common/matlab/vistasoft/mrDiffusion/src/dtiSplitTensor.mexmaci64'
"
... (and many lines of missing symbol like the one above for '_memcpy', '_memmove', etc.)
"
Error in dtiEig (line 65)
[eigVec,eigVal] = dtiSplitTensor(Y);
Error in dtiComputeFA (line 44)
[eigVec, eigVal] = dtiEig(eigVal);
Error in AFQ_WholebrainTractography (line 84)
fa = dtiComputeFA(dt.dt6);
Error in AFQ_example (line 23)
wholebrainFG = AFQ_WholebrainTractography(dt,'test');
"
I've checked to make sure that I have added the paths to the AFQ/vistasoft/spm8 correctly and tried recompiling the MEX files, but I still get the same error. I have been trying to troubleshoot this for a while and think this may be a MATLAB version compatibility problem, but I'm unsure how to continue.
Does anyone have some pointers on how to fix this? Thanks again and any help would be much appreciated.

댓글 수: 9

dpb
dpb 2018년 8월 21일
That would look like an installation problem with the C/C++ compiler and the link library path not finding the RTL. Those are base compiler library routines, not the user code.
Can you compile any mex function?
Walter Roberson
Walter Roberson 2018년 8월 21일
That symbol would typically be in the C standard library, -lc
Thank you for your help! @dpb I tried compiling the SPM MEX files (instructions under SPM8 from https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel)), but running the last command
make external && make external-install
returns
/Users/chriskjou/Downloads/spm8/external/fieldtrip/src/ft_getopt.c:49:13: warning: implicit declaration of function 'mxErrMsgTxt' is invalid in C99 [-Wimplicit-function-declaration]
mxErrMsgTxt("if specified, input argument emptymeaningful should be a logical or numeric value");
^
1 warning generated.
Undefined symbols for architecture x86_64:
"_mxErrMsgTxt", referenced from:
_mexFunction in ft_getopt.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [fieldtrip/src/ft_getopt.mexmaci64] Error 255
make: *** [external] Error 2
Hope this is what you meant. Thanks again for your help!
dpb
dpb 2018년 8월 21일
That's an error in the C source code for the default options of a C99 compiler; you didn't get far enough to find out if the standard libraries are going to be found.
I'm not a C programmer and don't know which compiler you're using to know what switch you can set to ignore warnings and whether it might possibly succeed if did or not or whether there's one for compiling pre-C99 C source that would accept the implicit declaration.
The surest route would be to look up and write the proper declaration for the function.
chriskjou
chriskjou 2018년 8월 25일
편집: chriskjou 2018년 8월 26일
Gotcha, turns out the function in that SPM version was deprecated, so the MEX file now compiles.
I'm a bit new to using MATLAB/compilers/libraries and was not able to find out how or if the standard libraries (for example, mentioned on other help forums, I tried running 'ver' to see what MATLAB can access and it seems like everything needed is there.) Can you point me to more specific resources or explain with more detail how to continue?
Again thank you so much for your help!
dpb
dpb 2018년 8월 26일
Can you successfully run mex setup and build/run one of the simple example files? That's the place to begin, until the "easy" works, there's no point in trying "hard". :)
There's quite a lot of detailed doc for mex, but it's not something that doesn't take quite a bit of study to learn how to write/debug code to use it successfully beyond the introductory level.
I'm not sure what the real Q? here is; the comment above says that the mex file compiled with an updated version so don't know what the limitation is on continuing. To use the result, you do have to have the .mex file located somewhere on the matlabpath, of course.
Just to clarify what I meant has happened so far/what I have tried:
- Initially, there was an error of 'missing symbol' when I run the AFQ example code.
- Later, I realized that I hadn't compiled the SPM MEX files properly (which I posted about with the 'linker command'). This turned out to be an deprecated software error so I was able to recompile the SPM MEX files according to https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel).
- I made sure that the SPM (with recompiled .mex files), Vistasoft, and AFQ were in the MATLAB path and tried running the AFQ example code again, but I still have the same error of 'missing symbol' that I initially posted.
- Running ‘mex -setup’ returns
MEX configured to use 'Xcode with Clang' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
even after I recompiled the SPM MEX file, but I thought this would be fixed after recompiling.
The main questions I want to ask are:
(1) What do you mean by the link library path to the RTL not being found? Some of the later errors show something like
Missing symbol '_writev' required by
'/usr/lib/libstdc++.6.dylib -> ...
so it seems like the standard library paths are included in the MATLAB path.
(2) Do I also need to recompile code in the AFQ example that I want to execute in a program? I had thought I only needed to recompile MEX files based on the new software I downloaded.
Thank you for your help. I think that I may be misunderstanding some basic MEX concepts which is confusing me and I wasn't clear on what I was trying.
Walter Roberson
Walter Roberson 2018년 8월 30일
The message from mex -setup is informational, not an error. It tells you what has been configured, how to choose a configuration; and gives a message warning that if you were using code from about a decade ago that you could have problems.
dpb
dpb 2018년 8월 30일
I would think you would need to recompile everything that is part of the mex file(s) you're trying to use, yes, to have everything consistent. Otherwise, whatever references there are to the runtime is based on whatever compiler/release those modules were compiled with and that could be either somewhat different in internal naming conventions or interface.
I "know nuthink!" about either the example you're trying to compile nor C++ in general so I have no knowledge of the specific symbol as far as where it might be in the system; once past the most basic of C standard libraries, I'm totally at sea.
Again, I'd suggest going back to the basics first...can you get any C++ mex file to compile/link; then begin to add the complexities of whatever libraries are being used in the particular package.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

제품

릴리스

R2017a

질문:

2018년 8월 21일

댓글:

dpb
2018년 8월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by