Author Topic: Metashape Java API running on UBUNTU  (Read 506 times)


  • Newbie
  • *
  • Posts: 7
    • View Profile
Metashape Java API running on UBUNTU
« on: September 07, 2022, 10:35:51 AM »
Hi everyone,

Thank you for your amazing software.

I am running metashape on Ubuntu.
I am using the 1.8.4 version, I removed the file and everything works find when running metashape in GUI mode.

Now I am trying to use the Java API with maven using the following github repo :

With version 1.8.2 everything is working except that exporting points is not working as mentioned in this thread :
So I need to stick with the 1.8.4 version.

I get the following error with 1.8.4 :
SEVERE: Cannot load Metashape library from /tmp/ /tmp/ /lib/x86_64-linux-gnu/ undefined symbol: __gmpz_limbs_write
java.lang.UnsatisfiedLinkError: /tmp/ /lib/x86_64-linux-gnu/ undefined symbol: __gmpz_limbs_write

It is the same tls error produced by the file so my guess is : could it be possible that the used in the Java api was obtained with the wrong gmp version ? I hope its not a stupid guess though.

Thank you very much for your help,


  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Metashape Java API running on UBUNTU
« Reply #1 on: September 07, 2022, 12:06:32 PM »

About error "undefined symbol: __gmpz_limbs_write":

1) It can be fixed like you described with deletion of, in fact in Metashape 1.8.4 it is so by default - this file was renamed to, so that it is ignored (but can be manually renamed back to to be used again - it is useful on old Linux distributions with old system

2) Alternatively it can be fixed with forced pre-loading of system before Metashape launch - then Metashape will ignore its bundled even if it is presented with such name in metashape/lib. You can do it with LD_PRELOAD='/usr/lib/x86_64-linux-gnu/' /path/to/

About Java API:

3) Basically there are everything the same, you can see that in there are in metashape-java-api-1.8.4/jniLibs/linux64/, so if you use official Java API library - everything should work

4) It seems that this change was properly adapted by maven artifact mantainer - ( was renamed to - so may be you use old artifact?

5) Also you can workaround this problem for older versions by launching your java application (for GUI version it works too) with environment variable that will force loading of system libgmp: LD_PRELOAD='/usr/lib/x86_64-linux-gnu/'
« Last Edit: September 07, 2022, 12:09:57 PM by PolarNick »


  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Metashape Java API running on UBUNTU
« Reply #2 on: September 07, 2022, 12:15:42 PM »
Great trick it works with export LD_PRELOAD=/pathtosystemlibgmp/
before launching the maven project.

Thank you !