Sage: Ticket #7932: _Complex_I undeclared - a new bug totally stops a Solaris 10 build.
https://trac.sagemath.org/ticket/7932
<p>
<a class="closed ticket" href="https://trac.sagemath.org/ticket/6595" title="defect: 'modified sage library code' fails at c_lib if /opt/SUNWspro/bin/CC ... (closed: fixed)">#6595</a> fixed a long standing bug which prevented Sage building on Solaris 10 (SPARC) if Sun Studio was installed. That allowed Sage to build properly on Solaris 10, so I set up
</p>
<p>
<a class="ext-link" href="http://t2nb.math.washington.edu:8000/"><span class="icon"></span>http://t2nb.math.washington.edu:8000/</a>
</p>
<p>
which clearly states
</p>
<p>
<em>v4.3-patched-for-Solaris(SPARC)</em>
</p>
<p>
<strong>Some changes(s) between Sage 4.3 and sage-4.3.1.alpha2 have completely broken the build on Solaris, so sage-4.3.1.alpha2 will not build on Solaris 10 (SPARC)</strong>. I noticed this on my own Sun Blade 2000, but have also observed it on 't2'.
</p>
<p>
Both my Sun Blade 2000 and 't2' use gcc 4.4.1. Neither compiler has been changed in any way since 4.3 was released.
</p>
<p>
I'm marking this as a blocker, as Sage would have built for the first time in years on Solaris 10 if this bug had not been introduced. This newly introduced bug needs fixing.
</p>
<p>
I have created a tar file /rootpool2/local/kirkby/newly-broken-Solaris-build-sage-4.3.1.alpha2.tar on 't2' so I have record of this. I've made the permissions on /rootpool2/local/kirkby/sage-4.3.1.alpha2 world writable, so anyone who feels able to try to test this. (or grab the tar file and do it elsewhere).
</p>
<p>
Dave
</p>
<pre class="wiki">gcc -shared build/temp.solaris-2.10-sun4v-2.6/sage/quadratic_forms/quadratic_form__evaluate.o -L/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//lib -lcsage -lstdc++ -lntl -o build/lib.solaris-2.10-sun4v-2.6/sage/quadratic_forms/quadratic_form__evaluate.so
building 'sage.rings.bernmm' extension
creating build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/bernmm.cpp -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/bernmm/bern_modp.cpp -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_modp.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/bernmm/bern_modp_util.cpp -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_modp_util.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/bernmm/bern_rat.cpp -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_rat.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
g++ -shared build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm.o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_modp.o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_modp_util.o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernmm/bern_rat.o -L/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//lib -lcsage -lgmp -lntl -lstdc++ -lpthread -lstdc++ -lntl -o build/lib.solaris-2.10-sun4v-2.6/sage/rings/bernmm.so
building 'sage.rings.bernoulli_mod_p' extension
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Isage/libs/ntl/ -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/bernoulli_mod_p.cpp -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernoulli_mod_p.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
g++ -shared build/temp.solaris-2.10-sun4v-2.6/sage/rings/bernoulli_mod_p.o -L/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//lib -lcsage -lntl -lstdc++ -lstdc++ -lntl -o build/lib.solaris-2.10-sun4v-2.6/sage/rings/bernoulli_mod_p.so
building 'sage.rings.complex_double' extension
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local//include/csage -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/devel//sage/sage/ext -I/rootpool2/local/kirkby/sage-4.3.1.alpha2/local/include/python2.6 -c sage/rings/complex_double.c -o build/temp.solaris-2.10-sun4v-2.6/sage/rings/complex_double.o -std=c99 -D_XPG6 -w
sage/rings/complex_double.c: In function ‘__pyx_t_double_complex_from_parts’:
sage/rings/complex_double.c:14891: error: ‘_Complex_I’ undeclared (first use in this function)
sage/rings/complex_double.c:14891: error: (Each undeclared identifier is reported only once
sage/rings/complex_double.c:14891: error: for each function it appears in.)
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.
ERROR installing SAGE
real 181m48.343s
user 147m51.334s
sys 7m45.185s
sage: An error occurred while installing sage-4.3.1.alpha2
Please email sage-devel http://groups.google.com/group/sage-devel
explaining the problem and send the relevant part of
of /rootpool2/local/kirkby/sage-4.3.1.alpha2/install.log. Describe your computer, operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/rootpool2/local/kirkby/sage-4.3.1.alpha2/spkg/build/sage-4.3.1.alpha2 and type 'make check' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
(cd '/rootpool2/local/kirkby/sage-4.3.1.alpha2/spkg/build/sage-4.3.1.alpha2' && '/rootpool2/local/kirkby/sage-4.3.1.alpha2/sage' -sh)
When you are done debugging, you can type "exit" to leave the
subshell.
make[1]: *** [installed/sage-4.3.1.alpha2] Error 1
make[1]: Leaving directory `/rootpool2/local/kirkby/sage-4.3.1.alpha2/spkg'
real 1536m11.177s
user 1092m45.904s
sys 102m19.699s
Error building Sage.
</pre>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/7932
Trac 1.1.6robertwbFri, 15 Jan 2010 02:42:03 GMT
https://trac.sagemath.org/ticket/7932#comment:1
https://trac.sagemath.org/ticket/7932#comment:1
<p>
This is probably my fault--maybe adding a --std=c99 flags or the like to the module list will help. (I know this code is valid, as we use it elsewhere, e.g. for the CDF fast float).
</p>
<p>
I'll try to track it down during Sage days if I don't see a resolution sooner.
</p>
TicketdrkirkbyFri, 15 Jan 2010 03:07:54 GMT
https://trac.sagemath.org/ticket/7932#comment:2
https://trac.sagemath.org/ticket/7932#comment:2
<p>
The compiler line that is causing the problem does have <em>-std=c99</em> I don't really understand what is going on in that library, the modules file, and I don't know C++ anyway, though I realise this bit is C.
</p>
<p>
The Sun compiler wont even build previous versions of the Sage library, complaining the code is invalid. It tends to be a lot more fussy than gcc/g++.
</p>
<p>
As can be seen in this patch,
</p>
<p>
<a class="ext-link" href="http://trac.sagemath.org/sage_trac/attachment/ticket/6595/sagelib_6595.patch"><span class="icon"></span>http://trac.sagemath.org/sage_trac/attachment/ticket/6595/sagelib_6595.patch</a>
</p>
<p>
a couple of functions that were declared to return something, did not, yet gcc/g++ did not complain about it. Line 1078 shows an answer calculated, but it was never returned to the function calling it. Likewise William added line 282, which the Sun compiler chocked on, but the GNU compilers accept. These are clear errors.
</p>
TicketrobertwbFri, 15 Jan 2010 05:33:46 GMT
https://trac.sagemath.org/ticket/7932#comment:3
https://trac.sagemath.org/ticket/7932#comment:3
<p>
I think it boils down to this: the file <a class="ext-link" href="http://sage.math.washington.edu/home/robertwb/solaris/simple_complex.c"><span class="icon"></span>http://sage.math.washington.edu/home/robertwb/solaris/simple_complex.c</a> compiles fine on sage.math, but not on t2. Any ideas why?
</p>
TicketdrkirkbyFri, 15 Jan 2010 08:05:08 GMT
https://trac.sagemath.org/ticket/7932#comment:4
https://trac.sagemath.org/ticket/7932#comment:4
<p>
I've no idea why, but it does build and run as expected with the Sun Studio compiler on t2.math.washington.edu (a Sun T5240 SPARC)
</p>
<pre class="wiki">kirkby@t2:[~] $ /opt/SUNWspro/bin/cc simple_complex.c
kirkby@t2:[~] $ ./a.out
CYTHON_CCOMPLEX 1
</pre><p>
and also on my Sun Sun Ultra 27 (Intel Xeon) with Sun Studio 12.1
</p>
<pre class="wiki">drkirkby@hawk:~$ /opt/sunstudio12.1/bin/cc simple_complex.c
drkirkby@hawk:~$ ./a.out
CYTHON_CCOMPLEX 1
</pre><p>
but as you say, not on t2 if one uses 'gcc'. Nor does it build with gcc on my Sun Ultra 27 which has gcc 4.3.4 (the least buggy gcc according to some).
</p>
<pre class="wiki">drkirkby@hawk:~$ gcc simple_complex.c
simple_complex.c: In function ‘__pyx_t_double_complex_from_parts’:
simple_complex.c:20: error: ‘_Complex_I’ undeclared (first use in this function)
simple_complex.c:20: error: (Each undeclared identifier is reported only once
simple_complex.c:20: error: for each function it appears in.)
</pre><p>
This rather makes me think it is gcc bug, rather than a system header file.
</p>
<p>
Dave
</p>
TicketdrkirkbyFri, 15 Jan 2010 10:47:35 GMT
https://trac.sagemath.org/ticket/7932#comment:5
https://trac.sagemath.org/ticket/7932#comment:5
<p>
I've submitted bug reports for Solaris 10 (SPARC)
</p>
<p>
<a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42753"><span class="icon"></span>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42753</a>
</p>
<p>
and Open Solaris (x86)
</p>
<p>
<a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42755"><span class="icon"></span>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42755</a>
</p>
<p>
Dave
</p>
TicketdrkirkbyFri, 15 Jan 2010 10:47:59 GMTupstream changed
https://trac.sagemath.org/ticket/7932#comment:6
https://trac.sagemath.org/ticket/7932#comment:6
<ul>
<li><strong>upstream</strong>
changed from <em>N/A</em> to <em>Reported upstream. Little or no feedback.</em>
</li>
</ul>
TicketrobertwbSat, 16 Jan 2010 00:24:29 GMTupstream changed
https://trac.sagemath.org/ticket/7932#comment:7
https://trac.sagemath.org/ticket/7932#comment:7
<ul>
<li><strong>upstream</strong>
changed from <em>Reported upstream. Little or no feedback.</em> to <em>Reported upstream. Developers acknowledge bug.</em>
</li>
</ul>
TicketrobertwbSat, 16 Jan 2010 00:25:43 GMT
https://trac.sagemath.org/ticket/7932#comment:8
https://trac.sagemath.org/ticket/7932#comment:8
<p>
See spkg at <a class="ext-link" href="http://sage/home/robertwb/cython/cython-0.12.p1"><span class="icon"></span>http://sage/home/robertwb/cython/cython-0.12.p1</a>
</p>
<p>
This changes
</p>
<pre class="wiki">#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#include <complex>
#else
#include <complex.h>
#endif
#endif
</pre><p>
to
</p>
<pre class="wiki">#if CYTHON_CCOMPLEX
#ifdef __cplusplus
#include <complex>
#else
#include <complex.h>
#if defined(__sun__) && defined(__GNUC__)
#undef _Complex_I
#define _Complex_I 1j
#endif
#endif
#endif
</pre><p>
but it feels a bit hackish.
</p>
TicketrobertwbSat, 16 Jan 2010 00:26:02 GMT
https://trac.sagemath.org/ticket/7932#comment:9
https://trac.sagemath.org/ticket/7932#comment:9
<p>
Also, <a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42753"><span class="icon"></span>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42753</a>
</p>
TicketdrkirkbyFri, 12 Feb 2010 23:22:37 GMT
https://trac.sagemath.org/ticket/7932#comment:10
https://trac.sagemath.org/ticket/7932#comment:10
<p>
This does actually solve the problem, so if you could make this into an updated package, it would allow the Solaris build to get further, though it has recently been broken again by <a class="closed ticket" href="https://trac.sagemath.org/ticket/7867" title="defect: GCC reports incorrect flags compiling descent_two_isogeny.c on Solaris 10 (closed: fixed)">#7867</a>
</p>
<p>
Dave
</p>
TicketdrkirkbySat, 13 Feb 2010 00:40:12 GMT
https://trac.sagemath.org/ticket/7932#comment:11
https://trac.sagemath.org/ticket/7932#comment:11
<p>
I should rephrase that.
</p>
<p>
The .spkg you posted the other day did solve the problem, but I can't see it so obviously now.
</p>
<p>
I hunted around a bit more, and found this one:
</p>
<p>
<a class="ext-link" href="http://sage/home/robertwb/cython/cython-0.12.p1.spkg"><span class="icon"></span>http://sage/home/robertwb/cython/cython-0.12.p1.spkg</a>
</p>
<p>
which seems as though it was probably the one that solved the problem, but now I still have it. There's nothing in SPKG.txt to indicate whether this the one you patched for Solaris or not, so I am not sure. But whatever you changed before, did get this building. But now I find it failing at the same point. I suspect I downloaded the wrong file, or I need to remake more of the build. I can't power up the machine where I put the file - it is too noisy to start up just now, as my wife is asleep!
</p>
<p>
Dave
</p>
TicketrobertwbMon, 15 Feb 2010 19:49:43 GMT
https://trac.sagemath.org/ticket/7932#comment:12
https://trac.sagemath.org/ticket/7932#comment:12
<p>
The new version of Cython at <a class="closed ticket" href="https://trac.sagemath.org/ticket/8163" title="enhancement: Upgrade to Cython 0.12.1 (closed: fixed)">#8163</a> fixes this issue. You need to do a sage -ba after installing.
</p>
TicketmvnguMon, 01 Mar 2010 01:53:02 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/7932#comment:13
https://trac.sagemath.org/ticket/7932#comment:13
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Close as fixed by <a class="closed ticket" href="https://trac.sagemath.org/ticket/8163" title="enhancement: Upgrade to Cython 0.12.1 (closed: fixed)">#8163</a>.
</p>
Ticket