Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DepthCamera compilation error on clang / macOS #29

Closed
osrf-migration opened this issue Oct 11, 2018 · 5 comments
Closed

DepthCamera compilation error on clang / macOS #29

osrf-migration opened this issue Oct 11, 2018 · 5 comments
Labels
bug Something isn't working ogre1.x

Comments

@osrf-migration
Copy link

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


There is a compilation error for clang / macOS in OgreScene.cc related to the DepthCamera class since pull request #93. I haven't tested with clang on Ubuntu yet.

ogre/src/OgreScene.cc:376:34: error: no viable conversion from 'shared_ptr<ignition::rendering::v1::OgreDepthCamera>' to
      'shared_ptr<ignition::rendering::v1::OgreObject>'
  bool result = this->InitObject(camera, _id, _name);
                                 ^~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3703:23: note: candidate constructor not viable: no known conversion from
      'ignition::rendering::v1::OgreDepthCameraPtr' (aka 'std::__1::shared_ptr<ignition::rendering::v1::OgreDepthCamera>') to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
    _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3717:5: note: candidate constructor not viable: no known conversion from
      'ignition::rendering::v1::OgreDepthCameraPtr' (aka 'std::__1::shared_ptr<ignition::rendering::v1::OgreDepthCamera>') to 'const
      std::__1::shared_ptr<ignition::rendering::v1::OgreObject> &' for 1st argument
    shared_ptr(const shared_ptr& __r) _NOEXCEPT;
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3725:5: note: candidate constructor not viable: no known conversion from
      'ignition::rendering::v1::OgreDepthCameraPtr' (aka 'std::__1::shared_ptr<ignition::rendering::v1::OgreDepthCamera>') to
      'std::__1::shared_ptr<ignition::rendering::v1::OgreObject> &&' for 1st argument
    shared_ptr(shared_ptr&& __r) _NOEXCEPT;
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3720:9: note: candidate template ignored: requirement
      'is_convertible<OgreDepthCamera *, element_type *>::value' was not satisfied [with _Yp = ignition::rendering::v1::OgreDepthCamera]
        shared_ptr(const shared_ptr<_Yp>& __r,
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3726:52: note: candidate template ignored: requirement
      'is_convertible<OgreDepthCamera *, element_type *>::value' was not satisfied [with _Yp = ignition::rendering::v1::OgreDepthCamera]
    template<class _Yp> _LIBCPP_INLINE_VISIBILITY  shared_ptr(shared_ptr<_Yp>&& __r,
                                                   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3745:9: note: candidate template ignored: could not match 'unique_ptr'
      against 'shared_ptr'
        shared_ptr(unique_ptr<_Yp, _Dp>&&,
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3754:9: note: candidate template ignored: could not match 'unique_ptr'
      against 'shared_ptr'
        shared_ptr(unique_ptr<_Yp, _Dp>&&,
        ^
/Users/jenkins/Desktop/ign-rendering/ogre/include/ignition/rendering/ogre/OgreScene.hh:142:56: note: passing argument to parameter '_object' here
      protected: virtual bool InitObject(OgreObjectPtr _object,
                                                       ^
1 error generated.

The clearest way to see the error is by adding the following static_assert:

diff -r 2cae5cb00bff44f0a97c38332713ea37fa391c52 ogre/src/OgreDepthCamera.cc
--- a/ogre/src/OgreDepthCamera.cc       Thu Oct 11 11:47:22 2018 -0700
+++ b/ogre/src/OgreDepthCamera.cc       Thu Oct 11 15:59:53 2018 -0700
@@ -15,6 +15,7 @@
  *
 */
 
+#include <type_traits>
 #include "ignition/rendering/ogre/OgreDepthCamera.hh"
 #include <ignition/math/Helpers.hh>
 #if (_WIN32)
@@ -30,6 +31,7 @@
 OgreDepthCamera::OgreDepthCamera()
   : dataPtr(new OgreDepthCameraPrivate())
 {
+  static_assert(std::is_convertible<OgreDepthCamera*, OgreObject*>::value);
 }
 
 //////////////////////////////////////////////////

This passes on Ubuntu with gcc, but fails on macOS with clang:

ogre/src/OgreDepthCamera.cc:34:3:
 error: static_assert failed due to requirement 'std::is_convertible<OgreDepthCamera *, OgreObject *>::value'
  static_assert(std::is_convertible<OgreDepthCamera*, OgreObject*>::value);
  ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [ogre/src/CMakeFiles/ignition-rendering1-ogre.dir/OgreDepthCamera.cc.o] Error 1
make[1]: *** [ogre/src/CMakeFiles/ignition-rendering1-ogre.dir/all] Error 2
make: *** [all] Error 2

cc @jchoclin

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


One thing to check is if this failure occurs with clang on Ubuntu.

@osrf-migration
Copy link
Author

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


I just confirmed that the build fails with clang on ubuntu, but it also gave an extra error message with a clue about how to fix it:

error: cannot cast
      'ignition::rendering::v1::OgreDepthCamera' to its protected base class 'const
      std::enable_shared_from_this<ignition::rendering::v1::BaseObject>'
          if (auto __base = __enable_shared_from_this_base(_M_refcount, __p))
                                                                        ^
...
include/ignition/rendering/base/BaseDepthCamera.hh:43:7: note: constrained by protected inheritance
      here
      protected virtual BaseCamera<T>,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm testing inheriting with public instead of protected in d320c73

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


  • changed state from "new" to "resolved"

@osrf-migration
Copy link
Author

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


  • changed component from "ogre" to "ogre1.x"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ogre1.x
Projects
None yet
Development

No branches or pull requests

1 participant