简体   繁体   English

由于未定义符号“start_time”,MEX 文件无效

[英]Invalid MEX-file due to undefined symbol 'start_time'

I am attempting to run a complex ice sheet modeling software downloaded from here: ISSM我正在尝试运行从这里下载的复杂冰盖建模软件: ISSM

After running configuring with automake and compiling properly I'm getting the following error.使用 automake 运行配置并正确编译后,我收到以下错误。

Invalid MEX-file '/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/TriMesh.mexa64': /home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMModules.so.0: undefined symbol: start_time无效的 MEX 文件“/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/TriMesh.mexa64”:/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMModules.so.0:未定义符号:start_time

Error in triangle (line 40) [elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area);三角形错误(第 40 行)[elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area);

Error in runme (line 11) md=triangle(model,'./DomainOutline.exp',1000); runme 中的错误(第 11 行) md=triangle(model,'./DomainOutline.exp',1000);

This is from the following code snippet in runme.m :这是来自runme.m的以下代码片段:

disp('   Step 1: Mesh creation');

%Generate initial uniform mesh (resolution = 20000 m)
md=triangle(model,'./DomainOutline.exp',1000);

My thought here was that the triangle.a library this is linked against is a static file, thus it should need to be a shared object.我的想法是,它所链接的triangle.a库是一个静态文件,因此它应该是一个共享对象。 However, even after updating the triangle library to be triangle.so I was still receiving the same error.然而,即使更新三角库是后triangle.so我还收到了同样的错误。 At this point I'm all out of ideas.在这一点上,我完全没有想法。 If I am lacking any relevant information please let me know, I'm still relatively new to GNU autotools.如果我缺少任何相关信息,请告诉我,我对 GNU autotools 还是比较陌生。

I've tried running the following command with the following output:我尝试使用以下输出运行以下命令:

$ nm ./lib/libISSMModules.so.0 | $ nm ./lib/libISSMModules.so.0 | grep 'start_time' grep '开始时间'

U start_time开始时间

A run of the ldd command returns the following undefined symbols:运行ldd命令返回以下未定义符号:

$ldd -r ./lib/libISSMModules.so.0 $ldd -r ./lib/libISSMModules.so.0

undefined symbol: _ZN14ToolkitOptions14toolkitoptionsE (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) undefined symbol: _ZN8IssmComm4commE (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) undefined symbol: _ZN8IssmComm8parallelE (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) undefined symbol: _Z9ApiPrintfPKc (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) undefined symbol: start_time (./lib/libISSMModules.so.0) undefined symbol: input_time (./lib/libISSMModules.so.0) undefined symbol: Using_Main (./lib/libISSMModules.so.0) undefined symbol: interface (./lib/libISSMModules.so.0) undefined symbol: read_params (./lib/libISSMModules.so.0) undefined symbol: smalloc_stats (./lib/libISSMModules.so.0)未定义符号:_ZN14ToolkitOptions14toolkitoptionsE (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) 未定义符号:_ZN8IssmComm4commE (/home/cpmcgrat/Documents/Research/ISSM/libsmE) libISSMCore.so.0) 未定义符号:_ZN8IssmComm8parallelE (/home/cpmcgrat/Documents/Research/ISSM/issm/trunk/lib/libISSMCore.so.0) 未定义符号:_Z9ApiPrintfPKc (/home/cpmcgrat/Documents/Research/ISSM issm/trunk/lib/libISSMCore.so.0) 未定义符号:start_time (./lib/libISSMModules.so.0) 未定义符号:input_time (./lib/libISSMModules.so.0) 未定义符号:Using_Main (./lib /libISSMModules.so.0) 未定义符号:接口 (./lib/libISSMModules.so.0) 未定义符号:read_params (./lib/libISSMModules.so.0) 未定义符号:smalloc_stats (./lib/libISSMModules.so. 0)

The undefined symbols are either prefixed with a U or a B .未定义的符号以UB为前缀。

It is my understanding that U means that the symbol is undefined and B means the symbol is in an uninitialized section.我的理解是U表示符号未定义, B表示符号位于未初始化的部分。 I am quite unsure of how to fix this however.但是,我不确定如何解决此问题。

I'm not in a position to download and try your code but the symptoms you're describing (the symbol is defined in a library, you're linking to the library, but the symbol is still not found) looks very like a problem with the order in which the libraries are linked.我无法下载并尝试您的代码,但您描述的症状(符号在库中定义,您正在链接到库,但仍未找到该符号)看起来很像一个问题与库链接的顺序。

There are good articles here and here explaining the problem with link order. 这里这里有很好的文章解释了链接顺序的问题。 In a nutshell, if the symbol is defined in a library (libA) that is linked before the file or library that requires that symbol (libB), then the symbol will be reported as missing.简而言之,如果在需要该符号的文件或库 (libB) 之前链接的库 (libA) 中定义了符号,则该符号将被报告为丢失。

Thus the order libA libB (where libB depends on libA ) will trigger the error, but libB libA will be ok.因此,命令libA libB (其中libB取决于libA )将触发错误,但libB libA会正常。 If both libraries have mutual dependencies, then either use libA libB libA or use --start-group and --end-group linker flags, where the linker will go round and round the group of files until all unresolved symbols have been found.如果两个库都有相互依赖关系,那么要么使用libA libB libA要么使用--start-group--end-group链接器标志,链接器将在其中循环访问文件组,直到找到所有未解析的符号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM