Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jun 2016 08:31:10 -0300
From:      =?UTF-8?B?T3RhY8OtbGlv?= <otacilio.neto@bsd.com.br>
To:        freebsd-hackers@freebsd.org
Subject:   Re: /usr/include/c++/v1/map:837:5: error: static_assert failed "Allocator::value_type must be same type as value_type"
Message-ID:  <db3f9d44-c94d-0305-3f94-0b658ba0ff45@bsd.com.br>
In-Reply-To: <FB887E8B-03E4-4592-B137-470766CEC0CC@FreeBSD.org>
References:  <e4c2cba6-7643-9032-8304-b2fce04c32b6@bsd.com.br> <F34B797C-7A4A-4110-A457-CE439EEA9715@FreeBSD.org> <bea2418d-5e1d-2cac-0500-773c2c9ca0ff@bsd.com.br> <FB887E8B-03E4-4592-B137-470766CEC0CC@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Em 15/06/2016 06:54, Dimitry Andric escreveu:
> On 15 Jun 2016, at 03:40, Otacílio <otacilio.neto@bsd.com.br> wrote:
>> Em 14/06/2016 18:14, Dimitry Andric escreveu:
>>> On 14 Jun 2016, at 06:05, Otacílio <otacilio.neto@bsd.com.br> wrote:
>>>> I'm getting this error when I try compile the ORB-SLAM2 library. Some one can give me a hint about it?
>>>>
>>>>
>>>> /usr/include/c++/v1/map:837:5: error: static_assert failed "Allocator::value_type must be same type as value_type"
>>>>     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
>>> Typically, this is because the allocator for std::map must use a const
>>> key, and libc++ now checks for this with a static assertion.
>>>
>>> See for example this fix for www/node:
>>> https://svnweb.freebsd.org/ports/head/www/node/files/patch-deps_v8_src_compiler_instruction.h?view=markup&pathrev=412412
>>>
>>> -Dimitry
>>>
>> I think that this problem is more difficult that the example. Bellow is the error message:
>>
>> In file included from /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/src/LoopClosing.cc:21:
>> In file included from /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/LoopClosing.h:24:
>> In file included from /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/KeyFrame.h:24:
>> In file included from /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/MapPoint.h:25:
>> In file included from /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/Frame.h:27:
>> In file included from /usr/local/include/DBoW2/BowVector.h:14:
>> /usr/include/c++/v1/map:837:5: error: static_assert failed "Allocator::value_type must be same type as value_type"
>>     static_assert((is_same<typename allocator_type::value_type, value_type>::value),
>>     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/src/LoopClosing.cc:436:21: note: in instantiation of template class 'std::__1::map<ORB_SLAM2::KeyFrame *, g2o::Sim3, std::__1::less<ORB_SLAM2::KeyFrame *>, Eigen::aligned_allocator<std::__1::pair<const ORB_SLAM2::KeyFrame *, g2o::Sim3> > >' requested here
>>     KeyFrameAndPose CorrectedSim3, NonCorrectedSim3;
> This patch should hopefully work.  I do not have the port itself, so I could not compile-test it.
>
> diff --git a/include/LoopClosing.h b/include/LoopClosing.h
> index b1736fe..5d80d02 100644
> --- a/include/LoopClosing.h
> +++ b/include/LoopClosing.h
> @@ -47,7 +47,7 @@ public:
>
>       typedef pair<set<KeyFrame*>,int> ConsistentGroup;
>       typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
> -        Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
> +        Eigen::aligned_allocator<std::pair<KeyFrame const*, g2o::Sim3> > > KeyFrameAndPose;
>
>   public:
>
> -Dimitry
>
Dear

I have applied your patch, but the bug stay there :(

In file included from 
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/src/LoopClosing.cc:21:
In file included from 
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/LoopClosing.h:24:
In file included from 
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/KeyFrame.h:24:
In file included from 
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/MapPoint.h:25:
In file included from 
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/include/Frame.h:27:
In file included from /usr/local/include/DBoW2/BowVector.h:14:
/usr/include/c++/v1/map:837:5: error: static_assert failed 
"Allocator::value_type must be same type as value_type"
     static_assert((is_same<typename allocator_type::value_type, 
value_type>::value),
     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/graphics/orbslam2/work/ORB_SLAM2-132d92f/src/LoopClosing.cc:436:21: 
note: in instantiation of template class 
'std::__1::map<ORB_SLAM2::KeyFrame *, g2o::Sim3, 
std::__1::less<ORB_SLAM2::KeyFrame *>, 
Eigen::aligned_allocator<std::__1::pair<const ORB_SLAM2::KeyFrame *, 
g2o::Sim3> > >' requested here
     KeyFrameAndPose CorrectedSim3, NonCorrectedSim3;


This is the source code of LoopClosing.h after patch:

#ifndef LOOPCLOSING_H
#define LOOPCLOSING_H

#include "KeyFrame.h"
#include "LocalMapping.h"
#include "Map.h"
#include "ORBVocabulary.h"
#include "Tracking.h"

#include "KeyFrameDatabase.h"

#include <thread>
#include <mutex>
#include <g2o/types/sim3/types_seven_dof_expmap.h>

namespace ORB_SLAM2
{

class Tracking;
class LocalMapping;
class KeyFrameDatabase;


class LoopClosing
{
public:

     typedef pair<set<KeyFrame*>,int> ConsistentGroup;
     typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
         Eigen::aligned_allocator<std::pair<KeyFrame const*, g2o::Sim3> 
 > > KeyFrameAndPose;





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?db3f9d44-c94d-0305-3f94-0b658ba0ff45>