Monday, September 30, 2013

Compiling Meshlab on Linux

I couldn't save a project in Meshlab, so I compiled it myself and fixed the bug. 
It turns out that the latest version of Meshlab doesnt have this bug since the commit 6114,
but it still had the problem with opening a PLY file.
 
So I downloaded version r6184. 
 
The instructions for compiling are here 
https://sourceforge.net/apps/mediawiki/meshlab/index.php?title=Compiling#Compiling 
Here's a short version
 

1. Download code into a meshlab top folder:

svn checkout svn://svn.code.sf.net/p/vcg/code/trunk/vcglib vcglib
svn checkout svn://svn.code.sf.net/p/meshlab/code/trunk/meshlab meshlab

2. Compile 

cd meshlab/src/external
qmake -recursive external.pro 
make
cd meshlab/src/
qmake -recursive meshlab_mini.pro  
make
This would give you a stripped down version of meshlab without the Align tool for example.. 
 

If you try to compile with meshlab_full.pro then you get the error:
In file included from filter_csg.cpp:29:0:
gmpfrac.h:5:20: fatal error: mpirxx.h: No such file or directory
compilation terminated.
make[1]: *** [filter_csg.o] Error 1


This error persists since 2011:
https://sourceforge.net/p/meshlab/bugs/274/
 
To solve it, you can comment the following lines causing errors during compilation
a) in the file >> meshlab/src/meshlabplugins/filter_csg/filter_csg.pro  
#linux-g++-64:INCLUDEPATH += ../../external/inc/linux-g++-64/mpir-2.4.0
#linux-g++-64:LIBS += ../../external/lib/linux-g++-64/libmpirxx.a ../../external/lib/linux-g++-64/libmpir.a
 
b) in the file meshlab/src/meshlab_full.pro comment several plugins that are incompatible>>
#                meshlabplugins/filter_texture \
#                meshlabplugins/filter_plymc \
 
but I solved one plugin edit_align because I needed it by adding the include
#include <unistd.h>
on line 60 of vcglib/wrap/ply/plystuff.h just like in this post:
http://sourceforge.net/p/meshlab/discussion/499533/thread/15551772/
 
and now you can 
cd meshlab/src/
qmake -recursive meshlab_full.pro  
make

 3. Bugfixing - Open PLY files

+using namespace std;
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLocale::setDefault(QLocale::C);
QCoreApplication::setOrganizationName("VCG");
QCoreApplication::setApplicationName("MeshLab");
+
+ std::setlocale(LC_NUMERIC, "C");

https://sourceforge.net/p/meshlab/bugs/238/

 4. Testing 

The other bugs like saving a project are already fixed
https://sourceforge.net/p/meshlab/bugs/264/ 

No comments:

Post a Comment