#12855: FLINTQS fails to build on Solaris (with GCC 4.7.x)
-------------------------------------------------------------------------------+
Reporter: leif
| Owner: tbd
Type: defect
| Status: needs_review
Priority: major
| Milestone: sage-5.1
Component: packages
| Resolution:
Keywords: spkg GCC 4.7.0 C++ g++ log() math.h overloaded SunOS sd40.5
| Work issues:
Report Upstream: N/A
| Reviewers:
Authors: Jeroen Demeyer
| Merged in:
Dependencies:
| Stopgaps:
-------------------------------------------------------------------------------+
Changes (by {'newvalue': u'Jeroen Demeyer', 'oldvalue': ''}):
* status: needs_info => needs_review
* author: => Jeroen Demeyer
Old description:
> This is a rather subtle issue, related to Solaris' headers, and the fact
> that GCC (4.7.0) now defines `__cplusplus` to `199711L`, while previous
> versions defined it to just `1`.
>
> If `__cplusplus >= 199711L`, a lot of overloaded (originally C) functions
> like `div()` and `log()` get defined in the `std` namespace (if one
> includes `math.h`), e.g.
> {{{
> #!c++
> float std::log(float); // logf() in C
> double std::log(double); // log() in C
> long double std::log(long double); // logl() in C
> }}}
> which is correct in the first place, but on Solaris these also end up in
> the '''global''' namespace:
> {{{
> #!c++
> // /usr/include/math.h
>
> ...
>
> #if __cplusplus >= 199711L
> ...
> using std::log;
> ...
> #endif
>
> }}}
>
> Now FLINTQS happens to call `log()` with an `unsigned long` (without a
> cast) in one place, and with the overloaded functions present as well,
> the call gets ambiguous. The obvious, trivial fix is to just cast the
> argument to a `double`, such that `double log(double)` gets called (as
> before).
>
> [[BR]]
>
> There's a lot wrong with the FLINTQS spkg, as I noted a couple of times
> before, but I won't address other issues ''here''. [The most important
> fact being that ''a newer version'' of Bill Hart's quadratic sieve is
> included in FLINT since a long time, but the FLINT spkg simply doesn't
> install it. So the FLINTQS spkg is obsolete in whole, but we can't
> remove it until ''someone''^TM^ fixes the FLINT spkg to also install the
> QS program included in it.]
New description:
This is a rather subtle issue, related to Solaris' headers, and the fact
that GCC (4.7.0) now defines `__cplusplus` to `199711L`, while previous
versions defined it to just `1`.
If `__cplusplus >= 199711L`, a lot of overloaded (originally C) functions
like `div()` and `log()` get defined in the `std` namespace (if one
includes `math.h`), e.g.
{{{
#!c++
float std::log(float); // logf() in C
double std::log(double); // log() in C
long double std::log(long double); // logl() in C
}}}
which is correct in the first place, but on Solaris these also end up in
the '''global''' namespace:
{{{
#!c++
// /usr/include/math.h
...
#if __cplusplus >= 199711L
...
using std::log;
...
#endif
}}}
Now FLINTQS happens to call `log()` with an `unsigned long` (without a
cast) in one place, and with the overloaded functions present as well, the
call gets ambiguous. The obvious, trivial fix is to just cast the
argument to a `double`, such that `double log(double)` gets called (as
before).
'''spkg''':
[http://boxen.math.washington.edu/home/jdemeyer/spkg/flintqs-20070817.p7.spkg]
=== flintqs-20070817.p7 (Jeroen Demeyer, 25 May 2012) ===
* Trac #12855: Only call log() on float or double types. This works
around a problem with Solaris' libc where log() in C++ is overloaded
for float, double and long double but not integer types.
* Use `patch` for patching, use standard template for spkg-install.
* Don't retry the build upon failure on x86_64, which seems pointless
after #11351.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12855#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.