Robert Bradshaw wrote:
> On Jan 15, 2009, at 2:23 PM, Michael Abshoff wrote:

<SNIP>

>>>> Do you have your changes anywhere so I can play with them?
>>> I pushed them to sage-devel, and an spkg is up in http://
>>> sage.math.washington.edu/home/robertwb/cython/ too.
>> Ok, I will take a look hopefully today.
> 
> Excellent.

Ok, adding std:: makes the code compile, but this is not the real fix.

The next issue is this:

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC 
-I/scratch/mabshoff/junk/sage-3.2.3/local/include/fplll 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include/csage 
-I/scratch/mabshoff/junk/sage-3.2.3/devel//sage/sage/ext 
-I/scratch/mabshoff/junk/sage-3.2.3/local/include/python2.5 -c 
sage/libs/fplll/fplll.cpp -o 
build/temp.linux-x86_64-2.5/sage/libs/fplll/fplll.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
In file included from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.h:59,
                  from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/fplll.h:45,
                  from sage/libs/fplll/fplll.cpp:136:
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp: In 
member function ‘int wrapper::heuristicLoop(int)’:
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:142: 
error: call of overloaded ‘min(int, int&)’ is ambiguous
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:69: 
note: candidates are: int min(int, int)
/usr/include/c++/4.2/bits/stl_algobase.h:182: note: 
const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:158: note: 
                 long int NTL::min(long int, int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:155: note: 
                 long int NTL::min(int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:152: note: 
                 long int NTL::min(long int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:149: note: 
                 int NTL::min(int, int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp: In 
member function ‘int wrapper::LLL()’:
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:208: 
error: call of overloaded ‘min(int, int&)’ is ambiguous
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:69: 
note: candidates are: int min(int, int)
/usr/include/c++/4.2/bits/stl_algobase.h:182: note: 
const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:158: note: 
                 long int NTL::min(long int, int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:155: note: 
                 long int NTL::min(int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:152: note: 
                 long int NTL::min(long int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:149: note: 
                 int NTL::min(int, int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:218: 
error: call of overloaded ‘min(int, int&)’ is ambiguous
/scratch/mabshoff/junk/sage-3.2.3/local//include/fplll/wrapper.cpp:69: 
note: candidates are: int min(int, int)
/usr/include/c++/4.2/bits/stl_algobase.h:182: note: 
const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:158: note: 
                 long int NTL::min(long int, int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:155: note: 
                 long int NTL::min(int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:152: note: 
                 long int NTL::min(long int, long int)
/scratch/mabshoff/junk/sage-3.2.3/local//include/NTL/tools.h:149: note: 
                 int NTL::min(int, int)
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.


Ok, I cursed the person who defined a function called "min" in the 
global namespace and prefixing the calls with "::" makes the extension 
compile.

The this error popped up:


gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -DGSL_DISABLE_DEPRECATED=1 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include/csage 
-I/scratch/mabshoff/junk/sage-3.2.3/devel//sage/sage/ext 
-I/scratch/mabshoff/junk/sage-3.2.3/local/include/python2.5 -c 
sage/rings/real_double.c -o 
build/temp.linux-x86_64-2.5/sage/rings/real_double.o -w
In file included from sage/rings/real_double.c:148:
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_bessel.h:287: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_bessel.h:295: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_bessel.h:334: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_bessel.h:387: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_bessel.h:437: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
In file included from sage/rings/real_double.c:167:
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:53: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:63: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:132: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:143: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:172: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:184: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:194: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
/scratch/mabshoff/junk/sage-3.2.3/local//include/gsl/gsl_sf_legendre.h:311: 
error: expected ‘;’, ‘,’ or ‘)’ before ‘gmax’
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.


This is getting strange, so for the hell of it I disabled the pari 
import since gmax is defined there:

--- a/sage/rings/real_double.pyx        Mon Jan 05 23:03:45 2009 -0800
+++ b/sage/rings/real_double.pyx        Thu Jan 15 15:27:34 2009 -0800
@@ -1,4 +1,4 @@
-r"""
+"""
  Double Precision Real Numbers

  EXAMPLES:
@@ -30,7 +30,7 @@

  import math, operator

-cimport sage.libs.pari.gen
+#cimport sage.libs.pari.gen
  import sage.libs.pari.gen


@@ -1025,8 +1025,8 @@
              sage: RDF(1.5)._pari_()
              1.50000000000000
          """
-        cdef sage.libs.pari.gen.PariInstance P = sage.libs.pari.gen.pari
-        return P.double_to_gen_c(self._value)
+        #cdef sage.libs.pari.gen.PariInstance P = sage.libs.pari.gen.pari
+        return 1 #P.double_to_gen_c(self._value)


      ###########################################


This made Cython throw this:

Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Building modified file sage/rings/real_double.pyx.
python2.5 `which cython` --embed-positions --incref-local-binop 
-I/scratch/mabshoff/junk/sage-3.2.3/devel/sage-main -o 
sage/rings/real_double.c sage/rings/real_double.pyx
Traceback (most recent call last):
   File 
"/scratch/mabshoff/junk/sage-3.2.3/local/lib/python2.5/site-packages/Cython/Compiler/Optimize.py",
 
line 557, in _calculate_const
     node.calculate_constant_result()
   File 
"/scratch/mabshoff/junk/sage-3.2.3/local/lib/python2.5/site-packages/Cython/Compiler/ExprNodes.py",
 
line 4028, in calculate_constant_result
     self.operand2.constant_result)
ZeroDivisionError: float division
Traceback (most recent call last):
   File 
"/scratch/mabshoff/junk/sage-3.2.3/local/lib/python2.5/site-packages/Cython/Compiler/Optimize.py",
 
line 557, in _calculate_const
     node.calculate_constant_result()
   File 
"/scratch/mabshoff/junk/sage-3.2.3/local/lib/python2.5/site-packages/Cython/Compiler/ExprNodes.py",
 
line 4028, in calculate_constant_result
     self.operand2.constant_result)
ZeroDivisionError: float division
sage/rings/real_double.pyx --> 
/scratch/mabshoff/junk/sage-3.2.3/local//lib/python/site-packages//sage/rings/real_double.pyx
Time to execute 1 commands: 7.37845206261 seconds
Finished compiling Cython code (time = 7.78979706764 seconds)
running install

Anyway, moving on since the pattern of the problem is shown with the 
next failure:

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include 
-I/scratch/mabshoff/junk/sage-3.2.3/local//include/csage 
-I/scratch/mabshoff/junk/sage-3.2.3/devel//sage/sage/ext 
-I/scratch/mabshoff/junk/sage-3.2.3/local/include/python2.5 -c 
sage/rings/real_rqdf.cpp -o 
build/temp.linux-x86_64-2.5/sage/rings/real_rqdf.o -w
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
In file included from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:30,
                  from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/dd_real.h:282:30: 
error: macro "min" requires 2 arguments, but only 1 given
In file included from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:274:81: 
error: macro "max" passed 3 arguments, but takes just 2
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:276:81: 
error: macro "min" passed 3 arguments, but takes just 2
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:306:30: 
error: macro "min" requires 2 arguments, but only 1 given
In file included from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:324,
                  from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1012:36: 
error: macro "max" passed 3 arguments, but takes just 2
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1021:36: 
error: macro "min" passed 3 arguments, but takes just 2
In file included from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:30,
                  from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/dd_real.h:282: 
error: function definition does not declare parameters
In file included from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:273: 
error: expected unqualified-id before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:273: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:273: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:274: 
error: field ‘max’ has incomplete type
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:275: 
error: expected unqualified-id before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:275: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:275: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:276: 
error: field ‘min’ has incomplete type
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:306: 
error: function definition does not declare parameters
In file included from 
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_real.h:324,
                  from sage/rings/real_rqdf.cpp:140:
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1007: 
error: expected unqualified-id before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1007: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1007: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1011: 
error: function definition does not declare parameters
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1016: 
error: expected unqualified-id before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1016: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1016: 
error: expected `)' before ‘const’
/scratch/mabshoff/junk/sage-3.2.3/local//include/qd/qd_inline.h:1020: 
error: function definition does not declare parameters


and again we are having a problem with min and so on. Cython seems to be 
  at fault for all the above issues. I.e. for some reason we end up 
using symbols from Sage's library like set, min, gmax and so on that in 
0.10 we did not use. For C++ we can monkey patch around them which is a 
bad idea and for C code we seem to be screwed for now.

Thoughts? I know way to little about Cython internals to have an idea 
what is going on here :)

> - Robert

Cheers,

Michael

> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
> 

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to