Re: 5.9 build issue with Singular and bits/c++config.h

132 views
Skip to first unread message

leif

unread,
Jun 12, 2013, 11:38:48 AM6/12/13
to sage-s...@googlegroups.com
chexmix wrote:
> I b0rked the Sage install on my netbook by somehow bungling upgrade(),
> so decided to reinstall from source (I run Linux, but it's neither Red
> Hat-based nor Debian/Ubuntu-oid ... it's Slackware).
>
> For the first time ever, the Sage build failed.
>
> The details:
>
> OS is Slackware Linux 14.0, 64-bit 'current branch'.
>
> The cpu is an Intel(R) Atom(TM) CPU N570 @ 1.66GHz
>
> I ran a script session to capture the build output. Here is the end,
> where it crashes out:
>
> gcc -O2 -g -fPIC -pipe -I. -I.. -I/home/chexmix/sage-5.9/local
> -I/home/chexmix/sage-5.9/local/include
> -I/home/chexmix/sage-5.9/local/include
> -I/home/chexmix/sage-5.9/local/include -I/usr/local/include -DNDEBUG
> -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H -c weight0.c
> 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
> make[4]: Leaving directory
> `/home/chexmix/sage-5.9/spkg/build/singular-3-1-5.p7/src/kernel'
> make[3]: *** [install-nolns] Error 1
> make[3]: Leaving directory
> `/home/chexmix/sage-5.9/spkg/build/singular-3-1-5.p7/src'
> Unable to build and install Singular
> Error building Singular (error in build_singular).
>
> ------------------
> I've Googled on it a bit & it is a not-uncommon error, but so far I
> haven't puzzled out where the fault lies nor how I might fix it ... so I
> thought I would post it here.


Yep, apparently some kind of Singular bug; on some systems / distros, it
puts inclusions of (mainly) C++ headers into cf_gmp.h, and these are not
in the default search path for header files when GCC compiles C.

Just fixing the generated header isn't that easy, as spkg-install
invokes 'make' a couple of times (and does other things inbetween, also
first patches the sources IIRC).

I don't recall any simple work-around (besides building Sage's GCC), but
adding the folder that contains <bits/c++config.h> to CPATH *may* work.
(It's usually in or below /usr/include/c++, or e.g.
/usr/lib/gcc/x86_64-linux-gnu/4.8.0/include/c++/x86_64-linux-gnu/bits/c++config.h.)


> Perhaps a gcc bug? I neglected to note the gcc version on the box in
> question (which is at home).

I'd say your GCC installation was broken if it didn't have
bits/c++config.h at all.


Before you make further attempts, could you save the offending cf_gmp.h
(and the corresponding config.log, from
spkg/build/singular-*/src/factory/ I think)?


-leif

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

leif

unread,
Jun 12, 2013, 12:04:33 PM6/12/13
to sage-s...@googlegroups.com
chexmix wrote:
> I ran a script session to capture the build output.

P.S.:

You don't have to do that.

There's $SAGE_ROOT/logs/install.log (cumulative, usually mostly
unreadable when 'make' is run with multiple jobs), and
$SAGE_ROOT/logs/pkgs/<package_name>.log for each of the Sage packages
(formerly in $SAGE_ROOT/spkg/logs/).

leif

unread,
Jun 12, 2013, 3:55:23 PM6/12/13
to sage-s...@googlegroups.com
leif wrote:
> chexmix wrote:
>> 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.
>> ------------------
>> I've Googled on it a bit & it is a not-uncommon error, but so far I
>> haven't puzzled out where the fault lies nor how I might fix it ... so I
>> thought I would post it here.
>
>
> Yep, apparently some kind of Singular bug; on some systems / distros, it
> puts inclusions of (mainly) C++ headers into cf_gmp.h, and these are not
> in the default search path for header files when GCC compiles C.


What does, in a Sage subshell ('./sage --sh'), the following give:


$ echo '#include <gmp.h>' > gen_cf_gmp.cc

$ $CXX -M gen_cf_gmp.cc | grep gmp.h


(Do that in some arbitrary directory; you can delete gen_cf_gmp.cc
afterwards, provided you've not been in the Singular source tree...)


And be warned that this is just the first step to debug this... ;-)


-leif


> Just fixing the generated header isn't that easy, as spkg-install
> invokes 'make' a couple of times (and does other things inbetween, also
> first patches the sources IIRC).

leif

unread,
Jun 12, 2013, 4:20:54 PM6/12/13
to sage-s...@googlegroups.com
leif wrote:
> What does, in a Sage subshell ('./sage --sh'), the following give:
>
>
> $ echo '#include <gmp.h>' > gen_cf_gmp.cc
>
> $ $CXX -M gen_cf_gmp.cc | grep gmp.h


Oh, forgot: And what does in contrast

$ $CXX -I$SAGE_LOCAL/include -M gen_cf_gmp.cc | grep gmp.h

give?


-leif

> (Do that in some arbitrary directory; you can delete gen_cf_gmp.cc
> afterwards, provided you've not been in the Singular source tree...)
>
>
> And be warned that this is just the first step to debug this... ;-)

Stephen Montgomery-Smith

unread,
Jun 12, 2013, 4:44:33 PM6/12/13
to sage-s...@googlegroups.com
On 06/12/2013 11:04 AM, leif wrote:
> chexmix wrote:
>> I ran a script session to capture the build output.
>
> P.S.:
>
> You don't have to do that.
>
> There's $SAGE_ROOT/logs/install.log (cumulative, usually mostly
> unreadable when 'make' is run with multiple jobs), and
> $SAGE_ROOT/logs/pkgs/<package_name>.log for each of the Sage packages
> (formerly in $SAGE_ROOT/spkg/logs/).

Where does it store the results of "sage -testall". It used to be in
~/.sage but I cannot find it there anymore.


leif

unread,
Jun 12, 2013, 5:01:52 PM6/12/13
to sage-s...@googlegroups.com
arojas wrote:
> In Arch Linux a workaround for this is exporting CPP='/usr/bin/cpp' before compilation


May I ask you the same?


What does, in a Sage subshell ('./sage --sh'), the following give?

$ echo '#include <gmp.h>' > gen_cf_gmp.cc

$ $CXX -I$SAGE_LOCAL/include -M gen_cf_gmp.cc | grep gmp.h


Thanks,

-leif

arojas

unread,
Jun 12, 2013, 5:07:02 PM6/12/13
to sage-s...@googlegroups.com


El miércoles, 12 de junio de 2013 23:01:52 UTC+2, leif escribió:

What does, in a Sage subshell ('./sage --sh'), the following give?

$ echo '#include <gmp.h>' > gen_cf_gmp.cc

$ $CXX -I$SAGE_LOCAL/include -M gen_cf_gmp.cc | grep gmp.h

 
 /opt/sage/local/include/gmp.h /usr/include/c++/4.8.1/iosfwd \
 

leif

unread,
Jun 12, 2013, 5:17:55 PM6/12/13
to sage-s...@googlegroups.com
Dear hijacker,


I did not know running 'sage -t ...' (or 'sage -testall') directly ever
created log files at all... :-)

Running 'make testall' in contrast creates $SAGE_ROOT/logs/testall.log;
similar for other test targets.

(In the top-level Makefile, meanwhile 'sage -t ... --logfile=...' is
used, so you could pass that as well. No idea whether some default
output file[name] is used otherwise.)

leif

unread,
Jun 12, 2013, 5:31:26 PM6/12/13
to sage-s...@googlegroups.com
arojas wrote:
> El mi�rcoles, 12 de junio de 2013 23:01:52 UTC+2, leif escribi�:
>
> What does, in a Sage subshell ('./sage --sh'), the following give?
>
> $ echo '#include <gmp.h>' > gen_cf_gmp.cc
>
> $ $CXX -I$SAGE_LOCAL/include -M gen_cf_gmp.cc | grep gmp.h
>
> /opt/sage/local/include/gmp.h /usr/include/c++/4.8.1/iosfwd \


Thanks!

Didn't think of multiple files on a single line (and the Singular
developers apparently didn't either) -- that does explain all...


Still weird that setting CPP appears to avoid that error, too.

leif

unread,
Jun 13, 2013, 10:23:03 AM6/13/13
to sage-s...@googlegroups.com
leif wrote:
> arojas wrote:
>> El mi�rcoles, 12 de junio de 2013 23:01:52 UTC+2, leif escribi�:
>>
>> What does, in a Sage subshell ('./sage --sh'), the following give?
>>
>> $ echo '#include <gmp.h>' > gen_cf_gmp.cc
>>
>> $ $CXX -I$SAGE_LOCAL/include -M gen_cf_gmp.cc | grep gmp.h
>>
>> /opt/sage/local/include/gmp.h /usr/include/c++/4.8.1/iosfwd \
>
>
> Thanks!
>
> Didn't think of multiple files on a single line (and the Singular
> developers apparently didn't either) -- that does explain all...


This hasn't changed in Singular 3-1-6.

I've opened #14737. (No new spkg or patch available yet; there are
various ways to fix this.)


-leif


[1] http://trac.sagemath.org/sage_trac/ticket/14737

chexmix

unread,
Jun 14, 2013, 8:04:28 AM6/14/13
to sage-s...@googlegroups.com
I'd like to thank all who have replied and apologize for my delay in getting back to the thread:

1) I wasn't sure it had successfully posted until someone over at stackoverflow referenced this thread;
2) Work has been beyond bat**** crazy.

I won't unfortunately be able to get to a real response (one that involves answering some of the questions / trying some of the suggestions) until tonight at the earliest, but ... again ... thanks.

/G

leif

unread,
Jun 14, 2013, 3:18:44 PM6/14/13
to sage-s...@googlegroups.com, chexmix
An initial spkg that /should/^TM work for you is here:

http://boxen.math.washington.edu/home/leif/Sage/spkgs/singular-3-1-5.p8.spkg


-leif

chexmix

unread,
Jun 15, 2013, 5:20:49 PM6/15/13
to sage-s...@googlegroups.com, chexmix
Thanks!

I of course got the same thing back from the manipulations of the 'gen_cf_gmp.cc' file that arojas did.

Just replaced the file with singular-3-1-5.p8.spkg and kicked off compilation.

/Glenn

leif

unread,
Jun 23, 2013, 9:07:13 AM6/23/13
to sage-s...@googlegroups.com, chexmix
Did the compilation meanwhile finish?

I.e., did the .p8 spkg work for you (without setting CPP)?


Cheers,

chexmix

unread,
Jun 23, 2013, 11:09:44 AM6/23/13
to sage-s...@googlegroups.com, chexmix


On Sunday, June 23, 2013 9:07:13 AM UTC-4, leif wrote:
chexmix wrote:
> Thanks!
>
> I of course got the same thing back from the manipulations of the
> 'gen_cf_gmp.cc' file that arojas did.
>
> Just replaced the file with singular-3-1-5.p8.spkg and kicked off
> compilation.

Did the compilation meanwhile finish?

I.e., did the .p8 spkg work for you (without setting CPP)?



It worked swell. Many thanks.

/GB

gmb...@gmail.com

unread,
Jul 19, 2013, 5:04:36 PM7/19/13
to sage-s...@googlegroups.com
On Wednesday, June 12, 2013 7:42:01 AM UTC-7, chexmix wrote:
> Hi --
>
> I b0rked the Sage install on my netbook by somehow bungling upgrade(), so decided to reinstall from source (I run Linux, but it's neither Red Hat-based nor Debian/Ubuntu-oid ... it's Slackware).
>
> For the first time ever, the Sage build failed.
>
> The details:
>
> OS is Slackware Linux 14.0, 64-bit 'current branch'.
>
> The cpu is an Intel(R) Atom(TM) CPU N570   @ 1.66GHz
>
> I ran a script session to capture the build output. Here is the end, where it crashes out:
>
> gcc -O2 -g  -fPIC -pipe  -I. -I.. -I/home/chexmix/sage-5.9/local  -I/home/chexmix/sage-5.9/local/include -I/home/chexmix/sage-5.9/local/include -I/home/chexmix/sage-5.9/local/include  -I/usr/local/include  -DNDEBUG -DOM_NDEBUG -Dx86_64_Linux -DHAVE_CONFIG_H -c weight0.c
> 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
> make[4]: Leaving directory `/home/chexmix/sage-5.9/spkg/build/singular-3-1-5.p7/src/kernel'
> make[3]: *** [install-nolns] Error 1
> make[3]: Leaving directory `/home/chexmix/sage-5.9/spkg/build/singular-3-1-5.p7/src'
> Unable to build and install Singular
> Error building Singular (error in build_singular).
>
> ------------------
> I've Googled on it a bit & it is a not-uncommon error, but so far I haven't puzzled out where the fault lies nor how I might fix it ... so I thought I would post it here.
>
> Perhaps a gcc bug? I neglected to note the gcc version on the box in question (which is at home).
>
> /Glenn

Good afternoon,

In case this is useful, I just tried to install Sage for the first time. I downloaded the 5.10 source via bittorrent. I'm running Debian unstable amd64 on a Lenovo X201 laptop. CPU model from /proc/cpuinfo is: Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz.

I got a similar error to that above regarding bits/c++config.h during the singular package build. I found this thread, downloaded the p8 version of the singular package leif posted, and the logs say that singular was built successfully.

Other things are still compiling, so I haven't actually run sage yet.

Brian
Reply all
Reply to author
Forward
0 new messages