• MATLAB Errors
  • MATLAB error: gmsh and gmt not found (Linux binary file)

Hi there,

I have followed the suggestions from ISSM admin to use Linux and download the pre-compiled binary file proovided from the ISSM website (here is my previous thread: https://issm.ess.uci.edu/forum/d/250-matlab-gmsh-function-not-found-with-binaries-for-windows/4). Unfortunately, I have a similar problem with running the code in my MATLAB R2019b. I try to use issmversion and it worked. Also, I try the SquareIceShelf example and also ran properly. Unfortunately when I try EsaGRACE SlrFarrel and SlrGrace, I received similar error:

`Error using gmshplanet (line 114)
gmsh not found, make sure it is properly installed

Error in runme (line 15)
md.mesh=gmshplanet('radius',radius,'resolution',resolution);`

`Error using gmtmask (line 53)
gmt not found, make sure it is properly installed, or add its path to this file (line 44)

Error in runme (line 23)
md.mask.ocean_levelset=gmtmask(md.mesh.lat,md.mesh.long);`

What should I do to solve the problem? Looking towards your reply

Best,
Abdul

    kadiralhamid
    Hi Abdul,
    I apologize: I forgot that you were working with our precompiled packages rather than compiling from source. Our Linux package does not actually include GMSH + GMT, but I am currently working on a package that does include it. In the meantime, do you have the option of compiling from source? If not, I can let you know here as soon as the new package is available

      justinquinn Hi Justin
      Would you please notify me as soon as you are done with the package that includes it? At the moment I will try to download the external package from your svn, and then copy it to your binaty file, install it there. If this is not possible, I'll just start with the source code method. Thank you. Waiting for your best work

      Best
      Abdul

      justinquinn
      Hi Justin,
      I managed to compile gmsh and it worked smoothly. However, when I compile gmt, there are few errors regarding CMake Error as described below:
      `-- The C compiler identification is GNU 7.5.0
      -- The CXX compiler identification is GNU 7.5.0
      -- Check for working C compiler: /usr/bin/cc
      -- Check for working C compiler: /usr/bin/cc -- works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Check for working CXX compiler: /usr/bin/c++
      -- Check for working CXX compiler: /usr/bin/c++ -- works
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found UnixCommands: /bin/bash
      -- Searching dependent libraries. This may take a few minutes...
      -- Looking for nc_def_var_deflate
      CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
      Please set them or make sure they are set and tested correctly in the CMake files:
      _found_lib_inux-gnu
      linked by target "cmTC_e77bd" in directory /home/abdul/trunk/externalpackages/gmt/src/build/CMakeFiles/CMakeTmp
      _found_lib_inux-gnu/hdf5/serial
      linked by target "cmTC_e77bd" in directory /home/abdul/trunk/externalpackages/gmt/src/build/CMakeFiles/CMakeTmp

      CMake Error at /usr/share/cmake-3.10/Modules/CheckSymbolExists.cmake:85 (try_compile):
      Failed to configure test project build system.
      Call Stack (most recent call first):
      /usr/share/cmake-3.10/Modules/CheckSymbolExists.cmake:48 (__CHECK_SYMBOL_EXISTS_IMPL)
      cmake/modules/FindNETCDF.cmake:124 (check_symbol_exists)
      src/CMakeLists.txt:39 (find_package)

      -- Configuring incomplete, errors occurred!
      See also "/home/abdul/trunk/externalpackages/gmt/src/build/CMakeFiles/CMakeOutput.log".
      `

      Are there any additional libraries that I should install to resolve this? Thank you

      Best,
      Abdul

        kadiralhamid
        Hi Abdul,
        Here are the list of installation scripts that we use for external packages for our nightly run build that includes GMSH + GMT:

        autotools	install-debian-linux.sh
        cmake		install.sh
        petsc		install-3.12-linux-solid_earth.sh
        triangle	install-linux.sh
        chaco		install.sh
        m1qn3		install.sh
        semic		install.sh
        boost		install-1.7-linux.sh
        curl		install-7.67.sh
        netcdf		install-4.7.sh
        proj		install-6.2.sh
        gdal		install-3.0-python-netcdf.sh
        gshhg		install.sh
        gmt		install-6.0-linux.sh
        gmsh		install.sh

        The only one on that list that you may have issues with under Ubuntu might be the installer for Autotools, but if you have it installed already, you can just ignore it. My recommendation is to,

        • reinstall petsc and boost
        • install curl, netcdf, proj, and gdal, and gshhg
        • reinstall gmt and gmsh
        • reconfigure and compile ISSM

        Note that there are some dependencies in that list so they should be installed in that order. As well, remember to source $ISSM_DIR/etc/environment.sh after each successfully installed package.

          justinquinn

          Hi Justin,

          This is the error that I found in installing boost:

          sudo ./install-1.72-linux.sh
          ./install-1.72-linux.sh: line 24: /scripts/DownloadExternalPackage.sh: No such file or directory

          gzip: stdin: unexpected end of file
          tar: Child returned status 1
          tar: Error is not recoverable: exiting now
          mv: cannot stat 'boost_1_72_0/*': No such file or directory
          ./install-1.72-linux.sh: line 40: ./bootstrap.sh: No such file or directory
          ./install-1.72-linux.sh: line 48: ./b2: No such file or directory

          What should I do?

          justinquinn
          Hi Justin, I've made huge progress!! I'm almost there. In the middle of my configuration, I have a little errors as following:

          [ 65%] Building C object src/CMakeFiles/gmtlib.dir/pslegend.c.o
          [ 65%] Linking C shared library libgmt.so
          [ 68%] Built target gmtlib
          Scanning dependencies of target gmt
          [ 68%] Building C object src/CMakeFiles/gmt.dir/gmt.c.o
          [ 68%] Linking C executable gmt
          /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgdal.so: undefined reference to sqlite3_column_origin_name'
          /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libgdal.so: undefined reference to
          sqlite3_column_table_name'
          collect2: error: ld returned 1 exit status
          src/CMakeFiles/gmt.dir/build.make:98: recipe for target 'src/gmt' failed
          make[2]: *** [src/gmt] Error 1
          CMakeFiles/Makefile2:674: recipe for target 'src/CMakeFiles/gmt.dir/all' failed
          make[1]: *** [src/CMakeFiles/gmt.dir/all] Error 2
          Makefile:151: recipe for target 'all' failed
          make: *** [all] Error 2

          In fact I already installed the SQLite in your external packages. It seems that you haven't enabled the SQLITE METADATA feature yet. Could you help me to solve this by giving a code to enable the SQLITE METADATA during compilation? Or are there any other soultion to this problem? I come so far thanks to you, Hoping that I can use your SlrGRACE features.

          Best,
          Abdul

          justinquinn
          Dear Justin,

          I have great news. I can compile SQLite and enabling the -DSQLITE_ENABLE_COLUMN_METADATA, the gmt has been compiled. However, my MATLAB still didn't work. It says:

          Error using gmtmask (line 59)
          /home/abdul/Desktop/WasedaUniversity/issm-linux/ISSM//externalpackages/gmt/install/bin/gmt: error while loading shared libraries:
          libnetcdf.so.15: cannot open shared object file: No such file or directory

          Error in runme (line 22)
          md.mask.ocean_levelset=gmtmask(md.mesh.lat,md.mesh.long);

          Meanwhile, the libnetcdf.so.15 itself is located at externalpackages/netcdf/install/lib (I have successfully compile and install the netcdf). What should I do to resolve this?

            kadiralhamid

            Hi Abdul,
            First, regarding the Boost install-1.7-linux.sh installation script, it seems that you may need to update your copy of the SVN repo as the file should have VER="1_73_0" (version 1.55 may indeed work, but 1.73 is what we run on our testing server).

            That's good to know about SQLite, however we install it using the Debian package manager apt on our testing server (our documentation will be updated to reflect this).

            Regarding the finding of libnetcdf, the only thing I can think is that you should add $ISSM_DIR/externalpackages/netcdf/install/lib to your runtime path in MATLAB with the addpath function (preferred method, and the same way that we get MATLAB to find the ISSM binaries and libraries) or manually through the MATLAB GUI.

              justinquinn
              Hi Justin, of course, I have added the addpath function, even to all of the ISSM related folders. Yet, this problem still persists. I guess I will need to wait for your newest version precompiled binary files (which includes gmt and gmsh). I hope you also tested it on the 'SlrGRACE' example as well. Is there any clue about when will the newest issm binary file will be done? Please kindly let me know.

              Best regards,
              Abdul

              Hi Justin, I felt very silly at this point.

              I notice that in the error, "/home/abdul/Desktop/WasedaUniversity/issm-linux/ISSM//externalpackages/gmt/install/bin/gmt", notice that "/" is counted twice after ISSM.

              Do you know how to resolve this small issue? Thanks

              Best,
              Abdul

                justinquinn Hi Justin, of course, I have done that using MATLAB GUI, and I opened all paths in the ISSM folder directories. But a similar problem still exists. I think I'll have to wait for you to upload the update of the downloadable binary on your website. Is there any clue about when will you update the pre-compiled binary file (which includes gmt and gmsh) on your website? Please kindly let me know if there are any other things that I could do now. I do hope you tested it on your example 'SlrGRACE.' I highly appreciate your efforts on this

                Best,
                Abdul

                As an addition, in Linux terminal, first, when I run ./gmt, it got the same issue error while loading shared libraries:
                libnetcdf.so.15: cannot open shared object file: No such file or directory
                However, if I run export LD_LIBRARY_PATH=$ISSM_DIR/externalpackages/netcdf/install/lib in that directory first, $ISSM_DIR/externalpackages/gmt/install/bin and run ./gmt, it works! I can run the gmt in the bin directory.

                But for MATLAB case, the problem stays the same.

                I suspect there is something to do with this code in gmtmask.m

                %Avoid bypassing of the ld library path by Matlab (:()
                if ismac,
                dyld_library_path_old=getenv('DYLD_LIBRARY_PATH');
                setenv('DYLD_LIBRARY_PATH',[ issmdir() '/externalpackages/curl/install/lib:' issmdir() '/externalpackages/hdf5/install/lib:' issmdir() '/externalpackages/netcdf/install/lib' ]);
                end

                Let me know your opinion.
                Thanks, Abdul

                  kadiralhamid
                  Hi Abdul,
                  Regarding the "//", this is nothing to worry about: the interpreter should treat this as "/". That said, if it is bothering you, I would look at ~/.bashrc: my guess is that there is a trailing slash in your definition of ISSM_DIR.

                  Ah, so it is a path issue: we're on the right track. The conditional you mentioned in gmtmask.m pertains to macOS, but you are running Linux, correct?

                  I will let you know as soon as the binaries with GMSH + GMT are up: they are a little trickier to get working unfortunately. 🙂

                  kadiralhamid
                  Abdul,
                  Another thought: if you are launching MATLAB by double-clicking the application icon, your environment (set, in part, by running source $ISSM_DIR/etc/environment.sh will not be honored. Instead, launch MATLAB in a terminal instance with matlab after sourcing environment.sh.

                    justinquinn

                    Hey Justin, you are definitely a genius!! It works very well! I can see the plotted global mesh creation in SlrFarrell. I can now enter step 2. However, I found another error:

                    `Unrecognized property 'steric_rate' for class 'slr'.

                    Error in runme (line 67)
                    md.slr.steric_rate=zeros(md.mesh.numberofvertices,1);`

                    Is it because I miss something during my Installation? Thank you for helping me this far!

                    Best regards,
                    Abdul

                    And yes indeed, MATLAB is true, I have checked the slr class (slr.m), in the classdef slr, there is no such thing as steric_rate defined in here. What should I edit in the classdef slr? Should I include the 'steric_date' and attributing it the same as 'sealevel'? Here are the list of your classdef in slr.m:

                    fielddisplay(self,'deltathickness','thickness change: ice height equivalent [m]');
                    fielddisplay(self,'sealevel','current sea level (prior to computation) [m]');
                    fielddisplay(self,'spcthickness','thickness constraints (NaN means no constraint) [m]');
                    fielddisplay(self,'reltol','sea level rise relative convergence criterion, (default, NaN: not applied)');
                    fielddisplay(self,'abstol','sea level rise absolute convergence criterion, NaN: not applied');
                    fielddisplay(self,'maxiter','maximum number of nonlinear iterations');
                    fielddisplay(self,'love_h','load Love number for radial displacement');
                    fielddisplay(self,'love_k','load Love number for gravitational potential perturbation');
                    fielddisplay(self,'love_l','load Love number for horizontal displacements');
                    fielddisplay(self,'tide_love_k','tidal load Love number (deg 2)');
                    fielddisplay(self,'tide_love_h','tidal load Love number (deg 2)');
                    fielddisplay(self,'fluid_love','secular fluid Love number');
                    fielddisplay(self,'equatorial_moi','mean equatorial moment of inertia [kg m^2]');
                    fielddisplay(self,'polar_moi','polar moment of inertia [kg m^2]');
                    fielddisplay(self,'angular_velocity','mean rotational velocity of earth [per second]');
                    fielddisplay(self,'ocean_area_scaling','correction for model representation of ocean area [default: No correction]');
                    fielddisplay(self,'hydro_rate','rate of hydrological expansion (in mm/yr)');
                    fielddisplay(self,'Ngia','rate of viscous (GIA) geoid expansion (in mm/yr)');
                    fielddisplay(self,'Ugia','rate of viscous (GIA) bedrock uplift (in mm/yr)');
                    fielddisplay(self,'loop_increment','vector assembly (in the convolution) framentation');
                    fielddisplay(self,'geodetic','compute geodetic SLR? ( in addition to steric?) default 0');
                    fielddisplay(self,'geodetic_run_frequency','how many time steps we skip before we run SLR solver during transient (default: 1)');
                    fielddisplay(self,'rigid','rigid earth graviational potential perturbation');
                    fielddisplay(self,'elastic','elastic earth graviational potential perturbation');
                    fielddisplay(self,'rotation','earth rotational potential perturbation');
                    fielddisplay(self,'degacc','accuracy (default .01 deg) for numerical discretization of the Green''s functions');
                    fielddisplay(self,'transitions','indices into parts of the mesh that will be icecaps');
                    fielddisplay(self,'requested_outputs','additional outputs requested');

                    Let me know what should I do, I would happy to do it. (I'll consider this as my learning process). Thank you

                    Best,
                    Abdul

                    Moreover, if I don't include the md.slr.steric_rate=zeros(md.mesh.numberofvertices,1); the model would continue running successfully through step 2 and step 3. However, in step 4 it will occur an error saying `Error using ismodelselfconsistent (line 36)
                    Model not consistent, see messages above

                    Error in solve (line 90)
                    ismodelselfconsistent(md),

                    Error in runme (line 116)
                    md=solve(md,'Slr');`

                    So probably the md.slr.steric_rate=zeros(md.mesh.numberofvertices,1); would give something significant in the slr classdef.

                      a month later