qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Teira <mte...@tid.es>
Subject Re: qpid (cpp) on solaris + Sun Studio 12
Date Tue, 27 May 2008 09:15:26 GMT
Manuel Teira escribió:
> Alan Conway escribió:
>> Manuel Teira wrote:
>>  
>>> Manuel Teira escribió:
>>>    
>>>> Unfortunately, I've found a problem I'm not able to solve by myself,
>>>> while compiling src/qpid/SessionState.cpp:
>>>>
>>>> source='qpid/SessionState.cpp' object='qpid/SessionState.lo'
>>>> libtool=yes \
>>>> DEPDIR=.deps depmode=none /bin/bash ../build-aux/depcomp \
>>>> /bin/bash ../libtool --tag=CXX    --mode=compile CC -m64 -mt
>>>> -library=stlport4 -DHAVE_CONFIG_H -I. -Igen -I./gen
>>>> -I/opt/dslap/contrib/include -c -o qpid/SessionState.lo
>>>> qpid/SessionState.cpp
>>>> mkdir qpid/.libs
>>>>  CC -m64 -mt -library=stlport4 -DHAVE_CONFIG_H -I. -Igen -I./gen
>>>> -I/opt/dslap/contrib/include -c qpid/SessionState.cpp  -KPIC -DPIC -o
>>>> qpid/.libs/SessionState.o
>>>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algobase.c", line 375:
>>>> Error: Cannot use qpid::Range<qpid::framing::SequenceNumber> to
>>>> initialize const qpid::framing::SequenceNumber.
>>>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
>>>> Where: While instantiating
>>>> "std::__lower_bound<qpid::Range<qpid::framing::SequenceNumber>*,
>>>> qpid::framing::SequenceNumber, 
>>>> std::less<qpid::framing::SequenceNumber>,
>>>> long>(qpid::Range<qpid::framing::SequenceNumber>*,
>>>> qpid::Range<qpid::framing::SequenceNumber>*, const
>>>> qpid::framing::SequenceNumber&,
>>>> std::less<qpid::framing::SequenceNumber>, long*)".
>>>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
>>>> Where: Instantiated from
>>>> qpid::RangeSet<qpid::framing::SequenceNumber>::addRange(const
>>>> qpid::Range<qpid::framing::SequenceNumber>&).
>>>> "./qpid/RangeSet.h", line 152:     Where: Instantiated from 
>>>> non-template
>>>> code.
>>>> 1 Error(s) detected.
>>>> *** Error code 1
>>>>
>>>> It seems that the error is triggered by some usage of the     
>>>> RangeSet&
>>>> operator+=(const Range& r) , perhaps just a constantness issue, but 
>>>> I'm
>>>> not able to find exactly where the problem is.
>>>>
>>>>       
>>> Some more info about this error. The instantiated template is:
>>>
>>>
>>> "/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
>>> Information: Instantiating
>>>  std::__lower_bound<qpid::Range<qpid::framing::SequenceNumber>*,
>>>                                   qpid::framing::SequenceNumber,
>>>                                   
>>> std::less<qpid::framing::SequenceNumber>,
>>>                                   long>
>>> (qpid::Range<qpid::framing::SequenceNumber>*,
>>> qpid::Range<qpid::framing::SequenceNumber>*,
>>> const qpid::framing::SequenceNumber&,
>>> std::less<qpid::framing::SequenceNumber>,
>>> long*).
>>>
>>> The involved code in the Sun STL headers is:
>>>
>>> template <class _ForwardIter, class _Tp>
>>> inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter 
>>> __last,
>>>                                   const _Tp& __val) {
>>>  _STLP_DEBUG_CHECK(__check_range(__first, __last))
>>>  return __lower_bound(__first, __last, __val, less<_Tp>(),
>>> _STLP_DISTANCE_TYPE(__first, _ForwardIter)); //This line
>>> }
>>>
>>> That calls:
>>>
>>> template <class _ForwardIter, class _Tp, class _Compare, class 
>>> _Distance>
>>> _ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
>>>                           const _Tp& __val, _Compare __comp, 
>>> _Distance*)
>>> {
>>>  _Distance __len = distance(__first, __last);
>>>  _Distance __half;
>>>  _ForwardIter __middle;
>>>
>>>  while (__len > 0) {
>>>    __half = __len >> 1;
>>>    __middle = __first;
>>>    advance(__middle, __half);
>>>    if (__comp(*__middle, __val)) {         //This line
>>>      __first = __middle;
>>>      ++__first;
>>>      __len = __len - __half - 1;
>>>    }
>>>    else
>>>      __len = __half;
>>>  }
>>>  return __first;
>>> }
>>>
>>>
>>> It seems that the code line triggering the whole problem is, in
>>> src/qpid/RangeSet.h (line 224):
>>>
>>>    typename Ranges::iterator i =
>>>        std::lower_bound(ranges.begin(), ranges.end(), r.begin());
>>>
>>>
>>> I'm not able to see anything wrong in all that. Any idea or test 
>>> case to
>>> help finding any hint about this?
>>>
>>>     
>>
>> I don't see anything wrong either but try updating to revision 660302 
>> or later.
>>
>> I removed the RangeSet::Range typedef and replaced it with Range<T>. 
>> Don't ask
>> me why, it's just a wild stab in the dark based on vague intuition. 
>> I've really
>> no idea why Sun C++ is objecting here.
>>
>> I've got no systematic suggestions for handling these type of 
>> template issues,
>> my approach is to repeatedly bang my head on the problem until it's 
>> fixed or I
>> pass out, whichever comes first.
>> .
>>
>>   
> No luck with that update. That error refuses to leave (in line 148 of 
> RangeSet.h now, where the operator +=(const Range<T>& r) is now located).
> I'm trying to isolate the error in an example single file, to see if 
> someone in the Sun Studio forums can throw some light on it. In the 
> meantime, if you have some other idea to try...
>
> Thanks a lot.
>
>
>
Some new info about this problem.

I was not able to exactly reproduce the issue with an stanalone and 
meaninfull source, but have found a way to pass the compilation (other 
than commenting everything, of course). The problem, I think, is related 
with the std::lower_bound invocation, as shown before:

"/opt/SUNWspro/prod/include/CC/stlport4/stl/_algo.h", line 491:
Information: Instantiating
 std::__lower_bound<qpid::Range<qpid::framing::SequenceNumber>*,
                                  qpid::framing::SequenceNumber,
                                  std::less<qpid::framing::SequenceNumber>,
                                  long>
(qpid::Range<qpid::framing::SequenceNumber>*,
qpid::Range<qpid::framing::SequenceNumber>*,
const qpid::framing::SequenceNumber&,
std::less<qpid::framing::SequenceNumber>,
long*).

All the pain begins (I think) with the fact that the first template type 
(the iterator) is not valid to travel through the value type. And this 
is produced (I guess) by the call, in RangeSet<T>::addRange(const 
Range<T> &r) :

typename Ranges::iterator i =
        std::lower_bound(ranges.begin(), ranges.end(), r.begin());

That way, we are passing two valid Range<T>::iterator types and a T 
value. changing that with:

typename Ranges::iterator i = std::lower_bound(ranges.begin(), 
ranges.end(), r);

it passes the compilation with the Sun Studio 12.

Perhaps the GNU compiler is able to instantiate a whole Range<T> from 
the r.begin() argument? However, the Range<T>::Range(const T &t) 
constructor is declared as explicit. So, I don't think that should be 
the problem

As an outline, does it make sense to pass to std::lower_bound iterators 
not compatible with the value argument?

Waiting your wise comments.

Best regards
--
Manuel.






Mime
View raw message