本文介绍了Matlab中无效的glmnet Mex文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在macOS 10.14中的MATLAB 2019a上运行 glmnet 程序包.5.我还在笔记本电脑中安装了Xcode.

I am running glmnet package on MATLAB 2019a in macOS 10.14.5. I have also installed Xcode in my laptop.

我收到如下错误:

Invalid MEX-file '/Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64' : dlopen(/Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64,
6): Library not loaded: @loader_path/libmex.dylib
  Referenced from: /Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64

我尝试了代码mex -setup并得到了

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.
In the near future 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.

我从专门针对mex的数学作品,但我不确定这是否可以解决我的问题.我不确定是否应该按照此答案删除某些内容,所以在这里停了下来.

I've found some advice from mathworks specific to mex but I am not sure whether this can solve my problem. I stopped here since I am not sure if I should follow this answer to delete something.

有什么想法吗?

推荐答案

Glmnet下载中包含的glmnetMex MEX文件在新版本的macOS上看起来像是疯了,因为它是在旧版本的macOS上编译的(),并且DLL库加载机制已更改自那以后. (它应该使用@rpath而不是@loader_path.)您将需要自己重建MEX文件,或者与Glmnet维护人员联系并要求他们提供新的版本.

The glmnetMex MEX file included with the Glmnet download looks busticated on newer versions of macOS because it was compiled on a much older version of macOS (OS X 10.8, according to their website), and the DLL library loading mechanism has changed since then. (It should be using @rpath instead of @loader_path.) You will need to rebuild the MEX file yourself, or contact the Glmnet maintainers and ask them to provide a new build.

要重建MEX文件,请执行以下操作:

To rebuild the MEX file:

  1. 使用mex -setup设置Matlab,以使用可以编译Fortran MEX文件的编译器. (我实际上不知道该怎么做.)
  2. 在Matlab中,cdglmnet_matlab目录!rm glmnetMex.mexmaci64,然后运行mex glmnetMex.F
  1. Set up Matlab with mex -setup to use a compiler that can compile Fortran MEX files. (I don't actually know how to do this.)
  2. In Matlab, cd to the glmnet_matlab directory, !rm glmnetMex.mexmaci64, and then run mex glmnetMex.F

我认为这是Glmnet发行版中的错误;我已经将其报告给了Glmnet维护者.

I would consider this a bug in the Glmnet distribution; I have reported it upstream to the Glmnet maintainers.

(我也可以在运行Matlab R2019a的macOS 10.14.6机器上重新下载Glmnet来重现此问题.)

(I can reproduce this issue with a fresh download of Glmnet on my macOS 10.14.6 box running Matlab R2019a, too.)

这是另一个Matlab库的预构建MEX文件的类似问题:.下次,请尝试使用Google搜索查询错误消息的各个部分;搜索未加载库:@ loader_path/libmex.dylib"将提出该问题.

Here's a similar problem with another Matlab library's pre-built MEX file: Library not loaded: @loader_path/libmex.dylib in matlab. Next time try Googling for various parts of your error message; searching for "Library not loaded: @loader_path/libmex.dylib" will pull up that question.

这篇关于Matlab中无效的glmnet Mex文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 08:27
查看更多