alecjacobson / gptoolbox

Matlab toolbox for Geometry Processing.
MIT License
628 stars 166 forks source link

Is this toolbox linux compatible? #39

Closed martinrnelson closed 7 years ago

martinrnelson commented 7 years ago

I'm having some trouble getting this toolbox up and running on a linux-based server. Should I expect it to work? (Running Matlab R2016a on Ubuntu Trusty.)

The issue seems to be related to loading the necessary libraries. I noticed that some bits of the code (e.g. geodesic_new_mesh.m) look to load libraries by testing ispc and ismac first, but both of these return false on a linux system, so it seems that nothing will be loaded as a result.

Any advice gratefully received! :-)

alecjacobson commented 7 years ago

This toolbox is mostly a collection of pure Matlab .m functions. So it shouldn't require installation and Matlab R2016a should work fine.

It looks like you're trying to run a specific function that might depend on compiled c++ "Mex" code. It's also from an external package, not written by me. I can try to help debug if you send a specific error message, but you might also ask on the page for that library https://www.mathworks.com/matlabcentral/fileexchange/6110-toolbox-fast-marching?s_tid=prof_contriblnk

martinrnelson commented 7 years ago

I am running the file external/exactgeodesic/example1.m, and it is the call to generate_new_mesh on line 12 that gives me the following error:


Error using calllib Library was not found

Error in geodesic_new_mesh (line 30) [id, tmp1, tmp2, num_edges, edges] = calllib(geodesic_library, 'new_mesh', length(p)/3, p, length(t)/3, t, 1, tmp);

Error in example1 (line 12) mesh = geodesic_new_mesh(vertices,faces); %initilize new mesh

It seems that lines 3-11 in that geodesic_new_mesh file are failing to load the required library.

martinrnelson commented 7 years ago

Solved. The solution was to recompile the geodesic_matlab_api code from source using

cd /usr/local/gptoolbox/external/exactgeodesic/src sudo g++ -fPIC -shared geodesic_matlab_api.cpp -o ../geodesic_release.so

and then after line 9 in geodesic_new_mesh.m, add

elseif isunix loadlibrary(geodesic_library, hfile);

to ensure that the library does get loaded.