Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragile GMP header hack in Singular and track all files #14737

Closed
nexttime mannequin opened this issue Jun 13, 2013 · 22 comments
Closed

Fragile GMP header hack in Singular and track all files #14737

nexttime mannequin opened this issue Jun 13, 2013 · 22 comments

Comments

@nexttime
Copy link
Mannequin

nexttime mannequin commented Jun 13, 2013

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.)

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.


fixed spkg: http://boxen.math.washington.edu/home/vbraun/spkg/singular-3-1-5.p8.spkg

Upstream: Not yet reported upstream; Will do shortly.

CC: @mezzarobba

Component: packages: standard

Keywords: git cf_gmp.h bits/c++config.h spkg factory build error Arch Linux Slackware

Author: Leif Leonhardy, Volker Braun

Reviewer: Volker Braun, Jean-Pierre Flori

Merged: sage-5.12.beta0

Issue created by migration from https://trac.sagemath.org/ticket/14737

@nexttime nexttime mannequin added this to the sage-5.11 milestone Jun 13, 2013
@nexttime nexttime mannequin assigned jdemeyer Jun 13, 2013
@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 13, 2013

comment:1

(More to come...)

@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 13, 2013

Changed keywords from cf_gmp.h bits/c++config.h spkg to cf_gmp.h bits/c++config.h spkg factory build error

@nexttime nexttime mannequin added the c: build label Jun 13, 2013
@nexttime

This comment has been minimized.

@nexttime

This comment has been minimized.

@nexttime nexttime mannequin assigned nexttime and unassigned jdemeyer Jun 13, 2013
@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 14, 2013

comment:4

For the impatient:

An initial fixed spkg can be found here. (Currently just adds a patch to src/factory/GNUmakefile.in, also simplifying the header generation a bit.)

@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 23, 2013

Changed keywords from cf_gmp.h bits/c++config.h spkg factory build error to cf_gmp.h bits/c++config.h spkg factory build error Arch Linux Slackware

@nexttime

This comment has been minimized.

@mezzarobba
Copy link
Member

comment:8

I used the patch to build sage 5.11β3 on a system that used to be affected by this bug (debian sid, gcc 4.8). It works for me.

@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 24, 2013

comment:9

Replying to @mezzarobba:

I used the patch to build sage 5.11β3 on a system that used to be affected by this bug (debian sid, gcc 4.8). It works for me.

Someone else just reported the same error for Debian testing... :-)

@nexttime

This comment has been minimized.

@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 24, 2013

comment:10

Slightly changed the spkg; patch now removes unneeded files as well.

@nexttime
Copy link
Mannequin Author

nexttime mannequin commented Jun 24, 2013

Attachment: sanitize_gmp_header_hack.patch.gz

Proposed patch to upstream (included in the .p8 spkg). For reference / review.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jul 2, 2013

comment:12

This spkg fixed the problem for me too ! And I also run debian sid. Thank you very much ! ;-)

Nathann

@vbraun
Copy link
Member

vbraun commented Jul 6, 2013

comment:13

Leif, are you still working on the patch or is this ready for review?

@vbraun

This comment has been minimized.

@vbraun vbraun changed the title Fragile GMP header hack in Singular Fragile GMP header hack in Singular and track all files Jul 10, 2013
@vbraun
Copy link
Member

vbraun commented Jul 10, 2013

comment:15

The GMP header patch looks good to me (positive review)

Somebody needs to review the sage-src script and then we are ready.

@vbraun
Copy link
Member

vbraun commented Jul 10, 2013

Author: Leif Leonhardy, Volker Braun

@vbraun
Copy link
Member

vbraun commented Jul 10, 2013

Reviewer: Volker Braun

@vbraun
Copy link
Member

vbraun commented Jul 10, 2013

Changed keywords from cf_gmp.h bits/c++config.h spkg factory build error Arch Linux Slackware to git cf_gmp.h bits/c++config.h spkg factory build error Arch Linux Slackware

@jpflori
Copy link

jpflori commented Jul 11, 2013

Changed reviewer from Volker Braun to Volker Braun, Jean-Pierre Flori

@jpflori
Copy link

jpflori commented Jul 11, 2013

comment:16

I'm ok with spkg-src.

@jdemeyer
Copy link

jdemeyer commented Aug 2, 2013

Merged: sage-5.12.beta0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants