[mlpack-svn] r13868 - mlpack/trunk/src/mlpack/bindings/matlab

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Nov 15 17:24:04 EST 2012


Author: rcurtin
Date: 2012-11-15 17:24:04 -0500 (Thu, 15 Nov 2012)
New Revision: 13868

Modified:
   mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt
Log:
Issue a warning when a user tries to compile MATLAB bindings and they have a
version of gcc which is "not supported" by mex.


Modified: mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt
===================================================================
--- mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt	2012-11-15 21:07:13 UTC (rev 13867)
+++ mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt	2012-11-15 22:24:04 UTC (rev 13868)
@@ -11,6 +11,34 @@
   return()
 endif(NOT ${MATLABMEX_FOUND})
 
+# If the mex compiler is wrapping an "unsupported" version, warn the user that
+# they may have issues with the produced bindings for a multitude of reasons.
+# We can only reasonably check this on a UNIX-like system.
+if(UNIX)
+  # The file test.cpp does not exist, but mex will still print a warning if it's
+  # using a weird version.
+  execute_process(COMMAND "${MATLAB_MEX}" test.cpp
+                  RESULT_VARIABLE MEX_RESULT_TRASH
+                  OUTPUT_VARIABLE MEX_OUTPUT
+                  ERROR_VARIABLE MEX_ERROR_TRASH)
+
+  string(REGEX MATCH "Warning: You are using" MEX_WARNING "${MEX_OUTPUT}")
+
+  if(MEX_WARNING)
+    message(WARNING "The MATLAB runtime glibc is different than the system "
+        " glibc.  This can (and probably will) cause the MLPACK bindings "
+        "generated by this build script to fail with odd GLIBCXX_a_b_c version "
+        "complaints when they are run.  Assuming that the system glibc is "
+        "newer than the MATLAB-provided version, the MATLAB version can "
+        "probably be deleted (always save a copy in case this is wrong!).\n"
+        "For more information on this confusing issue, see\n"
+        "http://dovgalecs.com/blog/matlab-glibcxx_3-4-11-not-found/\nand for an"
+        " overly-detailed dissertation/rant on why it is not possible to work "
+        "around this issue in any way, see\n"
+        "http://www.mlpack.org/trac/ticket/253 for more information.")
+  endif(MEX_WARNING)
+endif(UNIX)
+
 # Ignore the fact that we are setting CMAKE_SHARED_LIBRARY_CXX_FLAGS on CMake
 # 2.8.9 and newer.  Because we are requiring at least CMake 2.8.5, we only have
 # to check the patch version.




More information about the mlpack-svn mailing list