Building Meshlab from Source in Ubuntu
Every time I build Meshlab, it’s always a little more work than it really should be. So here’s my notes from my most recent build (June 2018, Ubuntu 18.04)
Clone the repositories (This is for building master, switch to a release branch/tag if you prefer)
git clone git@github.com:cnr-isti-vclab/meshlab.git
git clone git@github.com:cnr-isti-vclab/vcglib.git -b devel
Install dependencies (You may need other dependencies, these are just the ones that I needed at this point in time)
sudo apt install qt5-qmake qtscript5-dev libqt5xmlpatterns5-dev libqt5widgets5 libqt5gui5 libqt5network5 libqt5core5a libdouble-conversion1 libxcb-xinerama0
Build external plugins
cd meshlab/src/external
qmake -qt=5 external.pro
make -j6
Build common project
cd ../common
qmake -qt=5 common.pro
make -j6
At this point I encountered an error about ReadHeader
. The following GitHub issue contains a fix, and I’ve pasted the patch below
https://github.com/cnr-isti-vclab/meshlab/issues/188
diff -ru vcglib/wrap/io_trimesh/import_nvm.h vcglib/wrap/io_trimesh/import_nvm.h
--- a/vcglib/wrap/io_trimesh/import_nvm.h 2016-12-29 12:54:58.000000000 +0300
+++ b/vcglib/wrap/io_trimesh/import_nvm.h 2017-12-28 12:20:14.591670159 +0300
@@ -85,15 +85,6 @@
return true;
}
-static bool ReadHeader(const char * filename,unsigned int &/*num_cams*/, unsigned int &/*num_points*/){
- FILE *fp = fopen(filename, "r");
- if(!fp) return false;
- ReadHeader(fp);
- fclose(fp);
- return true;
-}
-
-
static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
std::vector<std::string > & image_filenames,
const char * filename, CallBackPos *cb=0)
diff -ru vcglib/wrap/io_trimesh/import_out.h vcglib/wrap/io_trimesh/import_out.h
--- a/vcglib/wrap/io_trimesh/import_out.h 2016-12-29 12:54:58.000000000 +0300
+++ b/vcglib/wrap/io_trimesh/import_out.h 2017-12-28 12:20:48.434017234 +0300
@@ -85,15 +85,6 @@
return true;
}
-static bool ReadHeader(const char * filename,unsigned int &/*num_cams*/, unsigned int &/*num_points*/){
- FILE *fp = fopen(filename, "r");
- if(!fp) return false;
- ReadHeader(fp);
- fclose(fp);
- return true;
-}
-
-
static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
std::vector<std::string > & image_filenames,
const char * filename,const char * filename_images, CallBackPos *cb=0)
Build meshlab itself
cd ..
qmake -qt=5 meshlab_full.pro
make -j6
I hit an error about missing libraries - the following fixed it for me
cp external/lib/linux/* external/lib/linux-g++
If everything worked, the meshlab binary will be at src/distrib/meshlab