#14737: Fragile GMP header hack in Singular
-------------------------------------------------------------------------------------------+
Reporter: leif
| Owner: leif
Type: defect
| Status: new
Priority: major
| Milestone: sage-5.11
Component: packages: standard
| Resolution:
Keywords: cf_gmp.h bits/c++config.h spkg factory build error Arch Linux
Slackware | Work issues:
Report Upstream: Not yet reported upstream; Will do shortly.
| Reviewers:
Authors:
| Merged in:
Dependencies:
| Stopgaps:
-------------------------------------------------------------------------------------------+
Old description:
> One (variant of possible) symptom(s):
> {{{
> In file included from ../kernel/si_gmp.h:4:0,
> from ../kernel/structs.h:15,
> from weight0.c:13:
> ../factory/cf_gmp.h:2501:28: fatal error: bits/c++config.h: No such file
> or directory
> #include <bits/c++config.h>
> ^
> compilation terminated.
> make[4]: *** [weight0.o] Error 1
> }}}
>
> This is still present in Singular 3-1-6.
>
> ----
>
> The file `factory/cf_gmp.h` is supposed to contain ''a copy'' of the
> otherwise used `gmp.h` found on the system, with some C++ definitions
> removed, later on to be used both by Singular C and C++ files (i.e.,
> those include `cf_gmp.h` instead of `gmp.h`).
>
> The actual problem is getting the location (i.e., the absolute path) of
> the header file used by the C/C++ compiler / preprocessor, in order to
> create a modified copy of it.
>
> The latter is achieved by using GCC's `-M` switch to output `Makefile`
> dependencies (also taking into account include directory search paths
> eventually specified by the user, probably via `--with-gmp=...`), but
> isn't robust w.r.t. the formatting of the generated rules.
>
> In particular, undesired ''additional header files'' (which usually
> include others) may end up in `cf_gmp.h`, leading to (potentially
> arbitrary) problems at least when C files include it, as the folders
> searched for C headers usually differ from those used when compiling /
> preprocessing C++. (This is the case in the rather obscure error above,
> where `bits/c++config.h` isn't found.)
>
> [[BR]]
>
> The current patch to the Singular spkg both simplifies the generation of
> `cf_gmp.h` (no longer needing `gen_cf_gmp.template` and [to ship]
> `gen_cf_gmp.cc`, nor the generation of a temporary shell script,
> `gen_cf_gmp.sh`), and of course makes it more robust, also making sure
> ''only the contents of `gmp.h`'' ends up in its modified copy.
New description:
One (variant of possible) symptom(s):
{{{
In file included from ../kernel/si_gmp.h:4:0,
from ../kernel/structs.h:15,
from weight0.c:13:
../factory/cf_gmp.h:2501:28: fatal error: bits/c++config.h: No such file
or directory
#include <bits/c++config.h>
^
compilation terminated.
make[4]: *** [weight0.o] Error 1
}}}
This is still present in Singular 3-1-6.
----
The file `factory/cf_gmp.h` is supposed to contain ''a copy'' of the
otherwise used `gmp.h` found on the system, with some C++ definitions
removed, later on to be used both by Singular C and C++ files (i.e., those
include `cf_gmp.h` instead of `gmp.h`).
The actual problem is getting the location (i.e., the absolute path) of
the header file used by the C/C++ compiler / preprocessor, in order to
create a modified copy of it.
The latter is achieved by using GCC's `-M` switch to output `Makefile`
dependencies (also taking into account include directory search paths
eventually specified by the user, probably via `--with-gmp=...`), but
isn't robust w.r.t. the formatting of the generated rules.
In particular, undesired ''additional header files'' (which usually
include others) may end up in `cf_gmp.h`, leading to (potentially
arbitrary) problems at least when C files include it, as the folders
searched for C headers usually differ from those used when compiling /
preprocessing C++. (This is the case in the rather obscure error above,
where `bits/c++config.h` isn't found.)
[[BR]]
The current patch to the Singular spkg both simplifies the generation of
`cf_gmp.h` (no longer needing `gen_cf_gmp.template` and [to ship]
`gen_cf_gmp.cc`, nor the generation of a temporary shell script,
`gen_cf_gmp.sh`), and of course makes it more robust, also making sure
''only the contents of `gmp.h`'' ends up in its modified copy.
----
'''Preliminary fixed spkg:'''
[http://boxen.math.washington.edu/home/leif/Sage/spkgs/singular-3-1-5.p8.spkg]
(Changes not yet committed.)
--
Comment (by leif):
Slightly changed the spkg; patch now removes unneeded files as well.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14737#comment:10>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.