Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-7300

Mesos failed to build on Windows due to error C2440: 'return': cannot convert from 'Error' to 'bool'

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: build
    • Labels:
      None
    • Environment:

      Windows Server 2012 R2 + VS2015 Update 3

      Description

      I try to build Mesos (master branch revision 322300f) with VS2015 Update 3 on Windows. It failed to build with the following error:
      D:\Mesos\src\3rdparty\stout\include\stout/os/windows/stat.hpp(41): error C2440: 'return': cannot convert from 'Error' to 'bool' (compiling source file D:\Mesos\src\3rdparty\libprocess\src\time.cpp) [D:\Mesos\build_x64\3rdparty\libprocess\src\process-0.0.1.vcxproj]
      D:\Mesos\src\3rdparty\stout\include\stout/os/windows/stat.hpp(59): error C2440: 'return': cannot convert from 'Error' to 'bool' (compiling source file D:\Mesos\src\3rdparty\libprocess\src\time.cpp) [D:\Mesos\build_x64\3rdparty\libprocess\src\process-0.0.1.vcxproj]

      This issue starts to be reproduce form master branch revision "82e4077" (https://github.com/apache/mesos/commit/82e4077ceb40e84c2796be43f1448eec0bfd7c69#diff-76a72473075f57f8d0d3b3bf6f150672)

      I presume this is a issue in your source code. The function "inline bool isdir( const std::string& path, const FollowSymlink follow = FOLLOW_SYMLINK)"
      needs a bool type return value. But the return value type of "Error("Non-following stat not supported for '" + path + "'")" is not bool.

      In D:\Mesos\src\3rdparty\stout\include\stout\os\windows\stat.hpp file:
      inline bool isdir(
      const std::string& path,
      const FollowSymlink follow = FOLLOW_SYMLINK)
      {
      struct _stat s;
      if (follow == DO_NOT_FOLLOW_SYMLINK)

      { return Error("Non-following stat not supported for '" + path + "'"); }

      if (::_stat(path.c_str(), &s) < 0)

      { return false; }

      return S_ISDIR(s.st_mode);
      }

      In D:\Mesos\src\3rdparty\stout\include\stout\errorbase.hpp file:
      class Error
      {
      public:
      explicit Error(const std::string& _message) : message(_message) {}

      const std::string message;
      };

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andschwa Andrew Schwartzmeyer
                Reporter:
                KarenTian Karen Huang
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: