Alexander Pyhalov <a...@rsu.ru> writes:

> While building different c++ projects with gcc 4.7 on OpenIndiana I've
> faced several problems with Solaris standard headers (including stdlib.h,
> iso/stdlib_iso.h, iso/stdio_iso.h and other)
>
> https://www.illumos.org/issues/3787
>
> The prolem was introduced by fixing
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773 (defining __cplusplus
> correctly). I've tested some patches to illumos headers, but even with
> patches applied not all g++ tests in gcc/testsuite can be passed).
>
> Firstly, it seems that g++ searches for abs(double) in <stdlib.h>:
>
>
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/random.tcc:1269:39:
> error: call of overloaded 'abs(const double&)' is ambiguous
>
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/random.tcc:1269:39:
> note: candidates are:
>
> In file included from /usr/include/stdlib.h:34:0,
>
>                 from
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cstdlib:66,
>
>                 from
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/stl_algo.h:61,
>
>                 from
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/algorithm:63,
>
>                 from ./g++.dg/cpp0x/lambda/lambda-pass.C:5:
>
> /usr/include/iso/stdlib_iso.h:124:12: note: int abs(int)
>
> In file included from
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/stl_algo.h:61:0,
>
>                 from
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/algorithm:63,
>
>                 from ./g++.dg/cpp0x/lambda/lambda-pass.C:5:
>
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cstdlib:175:3:
> note: long long int __gnu_cxx::abs(long long int)
>
>
> double abs(double) is defined in math.h, however above-mentioned headers
> don't include it.

On Solaris 11, it is defined in <iso/math_iso.h> which *is* included
indirectly from <algorithm>.  That file (and math.h) are missing from
the main Illumos repo, so I've no idea what they did about that.  I
think libm and its headers were released by Sun at some point.

libstdc++ configure should check for this and define
__CORRECT_ISO_CPP_MATH_H_PROTO[12] appropriately,
cf. libstdc++-v3/config/os/solaris/solaris2.8/os_defines.h.

> Other errors in dejagnu logs include
>
> In file included from ./g++.old-deja/g++.other/inline2.C:5:0:
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cmath:102:5:
> note: template<class _Tp> typename
> __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type
> std::abs(_Tp)
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cmath:102:5:
> note:   template argument deduction/substitution failed:
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cmath:
> In substitution of 'template<class _Tp> typename
> __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type
> std::abs(_Tp) [with _Tp = double]':
> ./g++.old-deja/g++.other/inline2.C:10:38:   required from here
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/cmath:102:5:
> error: no type named '__type' in 'struct __gnu_cxx::__enable_if<false,
> double>'
>
>
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/stl_algo.h:5499:5:
> note: void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =
> __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Compare =
> std::pointer_to_binary_function<const E
> xpr<int>, const Expr<int>, bool>]
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.3/../../../../include/c++/4.7.3/bits/stl_algo.h:5499:5:
> note:   no known conversion for argument 3 from '<unresolved overloaded
> function type>' to 'std::pointer_to_binary_function<const Expr<int>, const
> Expr<int>, bool>'
>
> I don't know how these errors can be fixed. The GCC bug 1773 was closed,
> but g++ 4.7 is still broken in OpenIndiana/illumos environment. Need your
> advices. If you wish I can share dejagnu logs somewhere (with patched
> illumos headers and with original headers).

Please open a gcc bug report for this.  This is nothing to be discussed
on the main list.

That said, g++ 4.7 *does* work on Solaris 11 (otherwise it wouldn't have
been released), and AFAICS <iso/stdlib_iso.h> and <iso/stdio_iso.h> are
unchanged in Illumos.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to