Opened 17 years ago

Closed 17 years ago

#470 closed Bugs (Fixed)

Cannot compile on Sparc/NetBSD: redefinition of `struct

Reported by: bortz Owned by: John Maddock
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

I cannot compile Boost on my UltraSparc (64 bits)
machine running NetBSD:

...found 4111 targets...
...updating 325 targets...
gcc-C++-action
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/build/bin/boost/libs/dat
e_time/build/libboost_date_time.so/gcc/release/shared-linkable-true/threading-multi/gr
eg_month.o
In file included from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/type_traits
/intrinsics.hpp:39,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/type_traits
/is_union.hpp:16,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/type_traits
/is_class.hpp:14,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/detail/indi
rect_traits.hpp:10,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/iterator/de
tail/facade_iterator_category.hpp:27,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/iterator/it
erator_facade.hpp:14,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/iterator/it
erator_adaptor.hpp:15,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/token_itera
tor.hpp:21,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/tokenizer.h
pp:20,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/date_time/d
ate_parsing.hpp:12,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/date_time/g
regorian/parsers.hpp:13,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/boost/date_time/g
regorian/greg_facet.hpp:14,
                 from
/usr/pkgsrc/devel/boost-libs/work/boost_1_33_0/libs/date_time/sr
c/gregorian/greg_month.cpp:15:
/usr/include/g++/type_traits.h:55: error: redefinition
of `struct __true_type'
/usr/include/g++/bits/type_traits.h:90: error: previous
definition of `struct 
   __true_type'
/usr/include/g++/type_traits.h:58: error: redefinition
of `struct __false_type'
/usr/include/g++/bits/type_traits.h:91: error: previous
definition of `struct 
   __false_type'
/usr/include/g++/type_traits.h:62: error: redefinition
of `struct 
   __type_traits<_Tp>'
/usr/include/g++/bits/type_traits.h:94: error: previous
definition of `struct 
   __type_traits<_Tp>'
/usr/include/g++/type_traits.h:96: error: redefinition
of `struct 
   __type_traits<bool>'
/usr/include/g++/bits/type_traits.h:123: error:
previous definition of `struct 
   __type_traits<bool>'
/usr/include/g++/type_traits.h:106: error: redefinition
of `struct 
   __type_traits<char>'

NetBSD 2.0.1

gcc:

% g++ -v
Using built-in specs.
Configured with:
/home/nick/work/netbsd/src/tools/gcc/../../gnu/dist/gcc/configure
--enable-long-long --disable-multilib --enable-threads
--disable-symvers --build=i386-unknown-netbsdelf
--host=sparc64--netbsd --target=sparc64--netbsd
Thread model: posix
gcc version 3.3.3 (NetBSD nb3 20040520)

Change History (4)

comment:1 by John Maddock, 17 years ago

Logged In: YES 
user_id=14804

I'm not sure what we do about that: the bottom line is that
the system should only have one version of type_traits.h. 
I've looked at cygwin and Linux and these do have two
versions of that file but they are identical, or at least
they both use _TYPE_TRAITS_H as an include guard.

Can you try something like the following program and see if
it reproduces the issue, if it does, can you please report
the bug to either the gcc or the NetBSD folks?

#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <type_traits.h>

Thanks,

John Maddock.

comment:2 by bortz, 17 years ago

Logged In: YES 
user_id=25865

Indeed, the sample program suggested by johnmaddock fails in
the same way on the Sparc/NetBSD (while it compiles fine on
a Sparc/Linux).

Reported to NetBSD people.

comment:3 by John Maddock, 17 years ago

Logged In: YES 
user_id=14804

I'm going to add a fix to boost/type_traits/intrinsics.hpp
to include <algorithm> rather than <type_traits.h> in order
to avoid this issue.  It's a rather fragile fix, but I
believe it will do the job.

John.

comment:4 by John Maddock, 17 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.