The art of compiling Meshlab and getting it running

I have been using Meshlab for quite a while as a powerful tool for automating 3D mesh calculations. Newer versions were not always more reliable than older ones, but mine was mostly a command-line usage more than interactive sessions so I got by.

The latest stable release is still 2016.12 and it gets my work done (though some changes were made to the command-line switches that broke some of my scripts). I have been using it on 14.04, 16.04 Ubuntu systems and lately, I wanted to use it on the 18.04 Ubuntu. But for that version, I could not find a pre-compiled binary and the versión included with the distribution was Meshlab 1.3.3 that, you guessed it, uses a different set of command-line switches so it was not an option.

Still, there was the choice to install a binary using the snap package system, which comes included in Ubuntu 18.04 and got me a working interactive Meshlab. But the meshlabserver command was nowhere to be found. It seems someone thought it best to rename it to meshlab.meshlabserver ...

So I thought I was back on track, but then I realized that some of the operations I was doing on some meshes did not work ok. In other cases, the program would block forever (well ... I did not really wait that long, back it should have been less than a second and it was still processing after several minutes). So I realized the snap binary was not really helping.

Being a Computer Scientist I told to myself: How hard can it be to create your own binary? After all, Meshlab is open-source software. But as usual, the devil is in the details. When you are not compiling a big project on a daily basis you need to learn some of the ugly details using some of your time.

The process was apparently straightforward and detailed here. So I just went ahead and started to hit my head against different walls:

  1. My first mistake was to assume the master branch would match the latest release. 
  2. Meshlab requires Qt5 libraries installed, that I had covered, but while the master branch required 5.9 the 2016.12 release required 5.7. 
  3. The project also required the source code of vcglib. But once you have that in place a nasty error keeps on popping up as a given method is not named anywhere (the reason being it need to be renamed with a patch). 
  4. I also realized that the proposed environment variables for qmake did not work ok. At least for my Ubuntu system, the flags QMAKE_FLAGS=('-spec' 'linux-g++' ... should be QMAKE_FLAGS=('-spec linux-g++'  ...
  5. Of course, make sure you are running the right qmake versión (you might have qt4 qmake installed on your system too).
I managed to compile three different versions, two of them being based on the master branch would eventually fail with segmentation faults or undefined symbols using certain filters, so I could not use that. Eventually, I used the 2016.12 release code and with that, I was able to create a binary that would work flawlessly with all my scripts as it was doing on other versions of Ubuntu. Total elapsed time, about two days of head-banging. 

Comments

Lili Roy said…
This comment has been removed by a blog administrator.

Popular posts from this blog

VFD control with Arduino using RS485 link

How to get sinusoidal s-curve for a stepper motor

Importing OpenSCAD designs into Onshape