简体   繁体   中英

Invalid MEX-file due to undefined symbol 'start_time'

I am attempting to run a complex ice sheet modeling software downloaded from here: ISSM

After running configuring with automake and compiling properly I'm getting the following error.

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

Error in triangle (line 40) [elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area);

Error in runme (line 11) md=triangle(model,'./DomainOutline.exp',1000);

This is from the following code snippet in 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. However, even after updating the triangle library to be triangle.so I was still receiving the same error. 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.

I've tried running the following command with the following output:

$ nm ./lib/libISSMModules.so.0 | grep 'start_time'

U start_time

A run of the ldd command returns the following undefined symbols:

$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)

The undefined symbols are either prefixed with a U or a B .

It is my understanding that U means that the symbol is undefined and B means the symbol is in an uninitialized section. 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.

Thus the order libA libB (where libB depends on libA ) will trigger the error, but libB libA will be ok. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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