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

Some fixes for building on FreeBSD #882

Merged
merged 1 commit into from Jan 25, 2016
Merged

Some fixes for building on FreeBSD #882

merged 1 commit into from Jan 25, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jan 25, 2016

Hi,

I'm the maintainer of the OpenMW FreeBSD port. There are some patches that need to be applied to build OpenMW on FreeBSD and I'd like to reduce the diff a little to make future updates of the port easier.

Thanks!

@zinnschlag zinnschlag merged commit 0659687 into OpenMW:master Jan 25, 2016
@@ -3,6 +3,7 @@

#include <string>

#include <osg/observer_ptr>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to include observer_ptr when it's not being used in this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't. This could be moved to apps/openmw/mwworld/projectilemanager.cpp.

Here is the error I get when it is missing from both files:

In file included from ../apps/openmw/mwworld/projectilemanager.cpp:1:
In file included from ../apps/openmw/mwworld/projectilemanager.hpp:4:
In file included from /usr/include/c++/v1/string:439:
In file included from /usr/include/c++/v1/algorithm:627:
/usr/include/c++/v1/utility:253:9: error: implicit instantiation of undefined template 'osg::observer_ptr<osg::Camera>'
    _T1 first;
        ^
/usr/include/c++/v1/map:629:16: note: in instantiation of template class 'std::__1::pair<const osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >' requested here
    value_type __cc;
               ^
/usr/include/c++/v1/__tree:1440:14: note: in instantiation of template class 'std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >' requested here
    if (__nd != nullptr)
             ^
/usr/include/c++/v1/__tree:1433:5: note: in instantiation of member function 'std::__1::__tree<std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >, std::__1::__map_value_compare<osg::observer_ptr<osg::Camera>, std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >, std::__1::less<osg::observer_ptr<osg::Camera> >, true>, std::__1::allocator<std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > > > >::destroy' requested here
    destroy(__root());
    ^
/usr/include/c++/v1/__tree:1119:78: note: in instantiation of member function 'std::__1::__tree<std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >, std::__1::__map_value_compare<osg::observer_ptr<osg::Camera>, std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > >, std::__1::less<osg::observer_ptr<osg::Camera> >, true>, std::__1::allocator<std::__1::__value_type<osg::observer_ptr<osg::Camera>, std::__1::vector<SceneUtil::LightManager::LightSourceViewBound, std::__1::allocator<SceneUtil::LightManager::LightSourceViewBound> > > > >::~__tree' requested here
    template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
                                                                             ^
/usr/local/include/osg/ref_ptr:21:28: note: template is declared here
template<typename T> class observer_ptr;
                           ^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wondered about why you needed to remove const from a few places.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't I get errors like:

In file included from ../apps/essimporter/importer.cpp:32:
../apps/essimporter/converter.hpp:128:79: error: no viable overloaded '='
                mContext->mPlayer.mObject.mCreatureStats.mSpells.mSpells[*it] = empty;
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~
/usr/include/c++/v1/map:889:10: note: candidate function not viable: no known conversion from 'map<int, [...], less<int>, [...]>' to 'const map<const int, [...], less<const int>, [...]>' for 1st argument
    map& operator=(const map& __m)
         ^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What version of GCC or Clang are you using?

I'm able to use both without a problem with Debian userland.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD 10.2 comes with Clang 3.4.1 and LLVM's libc++.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using clang version 3.6.2-1, but I don't know if that will make a difference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In OSX, I'm using clang 3.2 without a problem. :s

I'm guessing this has something to do with FreeBSD's implementation of libstdc++.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that the culprit here is indeed FreeBSD's libc++ rather than Clang. When I created the port I tried playing around with different Clang and GCC versions but that lead to a lot of other pain (not related to OpenMW code).

Replacing const int with int was the most straightforward non-hacky solution to those compiler errors I could find.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr/include/c++/v1/utility:253:9: error: implicit instantiation of undefined template 'osg::observer_ptrosg::Camera'

osg::observer_ptr<osg::Camera> is used in components/sceneutil/lightmanager.hpp, so the include should be added there.

aec8c38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants