Commit c844966 breaks MATLAB toolbox

Issue #421 closed
Mike Sheffler created an issue

In c844966, there is a modification of gtsam.h that adds

string findExampleDataFile(string name);

that causes compilation to fail when the MATLAB is being built:

/home/msheffler/Build/GTSAM/Debug/wrap/gtsam/gtsam_wrapper.cpp: In function ‘void gtsamfindExampleDataFile_3038(int, mxArray**, int, const mxArray**)’:
/home/msheffler/Build/GTSAM/Debug/wrap/gtsam/gtsam_wrapper.cpp:32249:34: error: ‘findExampleDataFile’ is not a member of ‘gtsam’
   out[0] = wrap< string >(gtsam::findExampleDataFile(name));
                                  ^~~~~~~~~~~~~~~~~~~

Presumably, this is because slam/dataset.h has the block

#ifndef MATLAB_MEX_FILE
/**
 * Find the full path to an example dataset distributed with gtsam.  The name
 * may be specified with or without a file extension - if no extension is
 * given, this function first looks for the .graph extension, then .txt.  We
 * first check the gtsam source tree for the file, followed by the installed
 * example dataset location.  Both the source tree and installed locations
 * are obtained from CMake during compilation.
 * @return The full path and filename to the requested dataset.
 * @throw std::invalid_argument if no matching file could be found using the
 * search process described above.
 */
GTSAM_EXPORT std::string findExampleDataFile(const std::string& name);

/**
 * Creates a temporary file name that needs to be ignored in .gitingnore
 * for checking read-write oprations
 */
GTSAM_EXPORT std::string createRewrittenFileName(const std::string& name);
#endif

I'm not sure of the best thing to do here.

I assume @vik748 didn't have any problems building the Cython stuff. I can comment out string findExampleDataFile(string name); and my build succeeds, but I am selecting MATLAB (and not Cython -- long story, but I can't do Cython on some of my machines), so I'll just assume that that would break the Cython build.

I'm not sure why that

#ifndef MATLAB_MEX_FILE
#endif

block is in slam/dataset.h. There is a findExampleDataFile.m in the MATLAB toolbox install, but I'm not sure why it is treated differently (that file comes from matlab/+gtsam -- not the normal wrap way of getting it into the toolbox).

Advice?

Comments (4)

  1. Mina Henein

    Any updates on this? compilation still fails when MATLAB is being built with the same error shown above

  2. Mike Sheffler reporter

    @MinaHenein Not yet. I don't understand why this change was made, so I haven't prepared a fix yet (@dellaert?). In the meantime, if you use MATLAB but don't use Cython, you can comment out string findExampleDataFile(string name); in gtsam.h. In my version of gtsam.h, it (the offending line) is line 2467. If I comment that out, I'm okay. If you use both MATLAB and Cython, I don't think that fix will work.

  3. Frank Dellaert

    I just created a PR that should fix this issue as well as earlier adjoint case conflict. Please try it, let me know of any issues, and I will merge into develop.

  4. Log in to comment