Vincent Delecroix wrote:
> On 30/07/16 20:35, Simon King wrote:
>> Hi Vincent,
>>
>> On 2016-07-31, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
>>> At least, adding explicitely to the include_dirs in setup.py the line
>>>
>>>    os.path.join(SAGE_LOCAL, "lib/python2.7/site-packages/cysignals/")
>>>
>>> the error disappear (I guess this is a Sage part bug). But there is
>>> another incompatible API change on the recent versions. All of _add_,
>>> _mul_ etc is now untyped
>>
>> With these changes, it seems that the package builds! Thank you very
>> much. As soon as I will have a better bandwidth, I'll publish the new
>> old-style spkg version 2.1.6. That way, I will at least be able to point
>> people to something that works...
> 
> Be careful that dropping the type from _add_, _sub_ is recent (ticket
> #20740). Not included in 7.2.

Well, then conditionally apply a patch regarding the API change to the
sources, based on the Sage version, in spkg-install.


For me the following works with Sage 7.3.beta9, GCC 6.1.0, and the
attached patch to the spkg (now .p1):

$ ./sage -p tmp/p_group_cohomology-2.1.5.p1.spkg
...
$ make build
...
$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.3.beta9, Release Date: 2016-07-22               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Forcing sage-location, probably because a new package was installed.
Updating various hardcoded paths...
(Please wait at most a few minutes.)
DO NOT INTERRUPT THIS.
Done updating paths.
sage: import pGroupCohomology
sage:


-leif

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
diff -Naur p_group_cohomology-2.1.5/src/Makefile p_group_cohomology-2.1.5.p1/src/Makefile
--- p_group_cohomology-2.1.5/src/Makefile	2013-05-11 02:50:29.000000000 -0700
+++ p_group_cohomology-2.1.5.p1/src/Makefile	2016-07-30 20:13:55.721822088 -0700
@@ -1,6 +1,7 @@
 #CC=gcc # this is set by sage-env
 ROOT=$(PWD)
-OO="-O2"
+OO=-O2
+GNU89=-std=gnu89 -fgnu89-inline -fno-strict-aliasing -Wno-unused-function
 
 .PHONY : all
 all    : 
@@ -9,10 +10,10 @@
 	(cd $(ROOT)/bin/; $(MAKE) clean ROOTDIR=$(ROOT) -f $(ROOT)/present/Makefile)
 
 	# Building MeatAxe
-	$(MAKE) OO=$(OO) ROOTDIR=$(ROOT) -f $(ROOT)/mtx2.2.4/Makefile
+	$(MAKE) OO="$(OO) $(GNU89)" ROOTDIR=$(ROOT) -f $(ROOT)/mtx2.2.4/Makefile
 
 	# Building David Green's binaries
-	(cd $(ROOT)/bin/; $(MAKE) OO=$(OO) ROOTDIR=$(ROOT) -f $(ROOT)/present/Makefile)
+	(cd $(ROOT)/bin/; $(MAKE) OO="$(OO) $(GNU89)" ROOTDIR=$(ROOT) -f $(ROOT)/present/Makefile)
 
 clean	:
 	$(MAKE) clean ROOTDIR=$(ROOT) -f $(ROOT)/mtx2.2.4/Makefile
diff -Naur p_group_cohomology-2.1.5/src/pGroupCohomology/cochain.pyx p_group_cohomology-2.1.5.p1/src/pGroupCohomology/cochain.pyx
--- p_group_cohomology-2.1.5/src/pGroupCohomology/cochain.pyx	2015-09-11 03:59:23.328771829 -0700
+++ p_group_cohomology-2.1.5.p1/src/pGroupCohomology/cochain.pyx	2016-07-30 21:44:05.692738136 -0700
@@ -154,7 +154,8 @@
 # auxiliary class from pGroupCohomology (the Cython classes are imported in cochain.pxd
 from pGroupCohomology.auxiliaries import OPTION, print_protocol, safe_save
 
-include "interrupt.pxi"
+# include "interrupt.pxi"
+include "cysignals/signals.pxi"
 
 #####################################################################
 #####################################################################
@@ -1306,7 +1307,7 @@
         """
         return self.Data.lead()[0]!=0
 
-    cpdef ModuleElement _add_(self, ModuleElement other):
+    cpdef _add_(self, other):
         r"""
         Sum of cochains of the same degree
 
@@ -1362,7 +1363,7 @@
         else:
             raise TypeError, "Cochains must be defined over a common resolution"
 
-    cpdef ModuleElement _sub_(self, ModuleElement other):
+    cpdef _sub_(self, other):
         """
         Difference of two cochains of the same degree
 
@@ -1402,7 +1403,7 @@
                 return COCH(self._parent, self.Deg, self.Name+'-('+C.Name+')', self.Data-C.Data, is_polyrep=self._polyrep and C._polyrep)
         else:
             raise TypeError, "Cochains must be defined over a common resolution"
-    cpdef ModuleElement _neg_(self):
+    cpdef _neg_(self):
         r"""
         Additive inverse of a cochain
 
@@ -1433,7 +1434,7 @@
         """
         return COCH(self._parent, self.Deg, '(-('+self.Name+'))', -self.Data, is_polyrep=self._polyrep)
 
-    cpdef ModuleElement _lmul_(self, RingElement right):
+    cpdef _lmul_(self, RingElement right):
         """
         Scalar multiplication from the right side.
 
@@ -1454,7 +1455,7 @@
         else:
             return COCH(self._parent, self.Deg, '('+self.Name+')*'+str(Right%self.Data.Data.fl), self.Data._mulInt_(Right), is_polyrep=self._polyrep)
 
-    cpdef ModuleElement _rmul_(self, RingElement left):
+    cpdef _rmul_(self, RingElement left):
         """
         Scalar multiplication from the left side.
 
@@ -1510,7 +1511,7 @@
                     '('+self.Name+')*'+str(n%self.Data.Data.fl),
                     self.Data._mulInt_(n), is_polyrep=self._polyrep)
 
-    cpdef RingElement _mul_(self, RingElement right):
+    cpdef _mul_(self, right):
         """
         Cup product of two cochains, or scalar multiplication
 
diff -Naur p_group_cohomology-2.1.5/src/pGroupCohomology/mtx.pyx p_group_cohomology-2.1.5.p1/src/pGroupCohomology/mtx.pyx
--- p_group_cohomology-2.1.5/src/pGroupCohomology/mtx.pyx	2015-05-28 04:40:11.403922434 -0700
+++ p_group_cohomology-2.1.5.p1/src/pGroupCohomology/mtx.pyx	2016-07-30 21:43:23.322737962 -0700
@@ -58,7 +58,8 @@
 import os
 os.environ['MTXLIB'] = SAGE_ROOT + '/local/pGroupCohomology/mtx_tables/'
 
-include "interrupt.pxi"
+# include "interrupt.pxi"
+include "cysignals/signals.pxi"
 
 #########################################################################
 #########################################################################
diff -Naur p_group_cohomology-2.1.5/src/pGroupCohomology/resolution.pyx p_group_cohomology-2.1.5.p1/src/pGroupCohomology/resolution.pyx
--- p_group_cohomology-2.1.5/src/pGroupCohomology/resolution.pyx	2015-06-01 14:57:35.275651323 -0700
+++ p_group_cohomology-2.1.5.p1/src/pGroupCohomology/resolution.pyx	2016-07-30 21:40:46.911889214 -0700
@@ -54,7 +54,8 @@
 # import gc
 
 from pGroupCohomology.cochain cimport COCH
-include "interrupt.pxi"
+# include "interrupt.pxi"
+include "cysignals/signals.pxi"
 
 ####################
 ## MTX related auxiliary functions
diff -Naur p_group_cohomology-2.1.5/src/setup.py p_group_cohomology-2.1.5.p1/src/setup.py
--- p_group_cohomology-2.1.5/src/setup.py	2015-09-10 23:06:50.099965806 -0700
+++ p_group_cohomology-2.1.5.p1/src/setup.py	2016-07-30 21:25:00.882738266 -0700
@@ -67,6 +67,18 @@
             os.path.join(SAGE_SRC, "c_lib", "include"),
             SAGE_EXTCODE, SRC_EXT]
 
+sage_inc_dirs = sage_include_directories()
+
+cysignals = os.path.join(SAGE_LOCAL, "lib", "python2.7",
+                         "site-packages", "cysignals")
+
+if os.path.isdir(cysignals):
+    sage_inc_dirs += [ cysignals ]
+
+silence_flags = [ "-fgnu89-inline" ] # in fact not just silencing,
+                                     # but needed if standard is
+                                     # >= gnu99/c99
+
 # Copy our singular libraries to the right place
 
 try:
@@ -116,9 +128,9 @@
                          os.path.join("pGroupCohomology","c_sources","urbild.c"),
                          os.path.join("pGroupCohomology","c_sources","uvr.c")],
               libraries = ["mtx"] + CSAGE,
-              extra_compile_args=["-O3"],
+              extra_compile_args=["-O3"] + silence_flags,
               #extra_link_args=["-g"],
-              include_dirs = sage_include_directories() + [
+              include_dirs = sage_inc_dirs + [
                               os.path.join("mtx2.2.4","src"),
                               os.path.join("pGroupCohomology","c_sources"),
                               "pGroupCohomology"]
@@ -136,8 +148,8 @@
                          os.path.join("pGroupCohomology","c_sources","urbild.c"),
                          os.path.join("pGroupCohomology","c_sources","uvr.c")],
               libraries = ["mtx"] + CSAGE,
-              extra_compile_args=["-O3"],
-              include_dirs = sage_include_directories() + [
+              extra_compile_args=["-O3"] + silence_flags,
+              include_dirs = sage_inc_dirs + [
                               os.path.join("mtx2.2.4","src"),
                               os.path.join("pGroupCohomology","c_sources"),
                               "pGroupCohomology"]
@@ -155,8 +167,8 @@
                          os.path.join("pGroupCohomology","c_sources","urbild.c"),
                          os.path.join("pGroupCohomology","c_sources","uvr.c")],
               libraries = ["mtx"] + CSAGE,
-              extra_compile_args=["-O3"],
-              include_dirs = sage_include_directories() + [
+              extra_compile_args=["-O3"] + silence_flags,
+              include_dirs = sage_inc_dirs + [
                               os.path.join("mtx2.2.4","src"),
                               os.path.join("pGroupCohomology","c_sources"),
                               "pGroupCohomology"]
@@ -174,8 +186,8 @@
                          os.path.join("pGroupCohomology","c_sources","urbild.c"),
                          os.path.join("pGroupCohomology","c_sources","uvr.c")],
               libraries = ["mtx"]+CSAGE,
-              extra_compile_args=["-O3"],
-              include_dirs = sage_include_directories() + [
+              extra_compile_args=["-O3"] + silence_flags,
+              include_dirs = sage_inc_dirs + [
                               os.path.join("mtx2.2.4","src"),
                               os.path.join("pGroupCohomology","c_sources"),
                               "pGroupCohomology"]
@@ -183,9 +195,9 @@
     Extension("pGroupCohomology.mtx",
               sources = [os.path.join("pGroupCohomology","mtx.pyx")],
               libraries = ["mtx"] + CSAGE,
-              extra_compile_args=["-O3"],
+              extra_compile_args=["-O3"] + silence_flags,
               #extra_link_args=["-g"],
-              include_dirs = sage_include_directories() + [
+              include_dirs = sage_inc_dirs + [
                               os.path.join("mtx2.2.4","src"),
                               os.path.join("pGroupCohomology","c_sources"),
                               "pGroupCohomology"]

Reply via email to