Boost logo

Boost :

Subject: Re: [boost] [1.44][Serialization] fails to compile on OSX universal
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-08-20 13:23:39


Marshall Clow wrote:
> On Aug 20, 2010, at 9:47 AM, Marshall Clow wrote:
>
>> On Aug 20, 2010, at 10:38 AM, Robert Ramey wrote:
>>> Jeff Flinn wrote:
>>>> Building boost 1.44 on Mac OSX generating universal binaries fails to
>>>> compile serialization lib, due to static asserts in
>>>> basic_binary_?archive.hpp's at:
>>>>
>>>> BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char));
>>>>
>>>> It appears that this fails for the ppc architecture.
>>>>
>>>> Robert, Any ideas on fixing this?
>>>>
>>>> Thanks, Jeff
>>>>
>>>> _______________________________________________
>>>> Unsubscribe & other changes:
>>>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>>
>>> I included these asserts to trap any future change in the size of these
>>> types.
>>> Accidently changing these sizes silently breaks previous archives which is
>>> a major pain.
>>>
>>> boost/archive/tracking_type is actually a bool - which I had assumed would
>>> be a char in all machines. So I guess that correct way to express this
>>> would be:
>>>
>>> BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool));
>>>
>>> Try making this change and verify that it fixes the problem and I'll check
>>> in the change.
>>
>> Tests done on my Mac running 10.6.4:
>>
>> $ g++ --version
>> i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
>>
>> $ cat junk.cpp
>> #include <iostream>
>>
>> int main ( int argc, char *argv[] ) {
>> std::cout << "sizeof (bool) = " << sizeof (bool) << std::endl;
>> return 0;
>> }
>>
>> $ g++ -arch i386 junk.cpp && ./a.out
>> sizeof (bool) = 1
>>
>> $ g++ -arch x86_64 junk.cpp && ./a.out
>> sizeof (bool) = 1
>>
>> $ g++ -arch ppc junk.cpp && ./a.out
>> sizeof (bool) = 4
>
> Better test (looks like Robert's change will work):
>
> $ cat junk.cpp
> #include <iostream>
> #include <boost/archive/basic_archive.hpp>
>
> int main ( int argc, char *argv[] ) {
> std::cout << "Sizeof (bool) = " << sizeof (bool) << std::endl;
> std::cout << "Sizeof (tracking_type) = " << sizeof (boost::archive::tracking_type) << std::endl;
> return 0;
> }
>
> $ g++ -I /Marshall/Sources/boost/boost_1_44_0 -arch ppc junk.cpp && ./a.out
> Sizeof (bool) = 4
> Sizeof (tracking_type) = 4
>
> $ g++ -I /Marshall/Sources/boost/boost_1_44_0 -arch i386 junk.cpp && ./a.out
> Sizeof (bool) = 1
> Sizeof (tracking_type) = 1
>
> $ g++ -I /Marshall/Sources/boost/boost_1_44_0 -arch x86_64 junk.cpp && ./a.out
> Sizeof (bool) = 1
> Sizeof (tracking_type) = 1

I concur, with Robert's fix I can build universal binaries on OSX
10.5.8. Thanks for the quick response.

By the way Robert, thanks for clearing up all of the compiler warnings
in both the lib and in portable_binary_archive over the last couple of
releases.

Thanks, Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk