Opened 9 years ago

Closed 8 years ago

#10247 closed defect (fixed)

Sage 4.6 has PARI problems on Cygwin

Reported by: mhansen Owned by: tbd
Priority: major Milestone: sage-4.7.1
Component: packages: standard Keywords: PARI, cygwin
Cc: jdemeyer Merged in: sage-4.7.1.alpha0
Authors: Mike Hansen Reviewers: Dmitrii Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

While the spkg builds fine (modulo #10240), it introduces the some errors when building the following extension modules in the Sage library:

gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.5-i686-2.6/sage/libs/pari/gen.o -L/home/mhansen/sage-4.6/local//lib -L/home/mhansen/sage-4.6/local/lib/python2.6/config -lcsage -lpari -lgmp -lstdc++ -lntl -lpython2.6 -o build/lib.cygwin-1.7.5-i686-2.6/sage/libs/pari/gen.dll
Cannot export bid_get_cyc: symbol not found
Cannot export bid_get_gen: symbol not found
Cannot export bnf_get_cyc: symbol not found
Cannot export bnf_get_fu: symbol not found
Cannot export bnf_get_fu_nocheck: symbol not found
Cannot export bnf_get_gen: symbol not found
Cannot export bnf_get_reg: symbol not found
Cannot export cxcompotor: symbol not found
Cannot export cxtofp: symbol not found
Cannot export gtodouble: symbol not found
Cannot export is_bigint: symbol not found
Cannot export is_intreal_t: symbol not found
Cannot export isintzero: symbol not found
Cannot export nf_get_sign: symbol not found
Cannot export nf_get_zk: symbol not found
Cannot export pari_free: symbol not found
Cannot export pr_get_e: symbol not found
Cannot export pr_get_f: symbol not found
Cannot export pr_get_gen: symbol not found
Cannot export pr_get_p: symbol not found
Cannot export zerocol: symbol not found
Cannot export zeromat: symbol not found
Cannot export zerovec: symbol not found
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.5-i686-2.6/sage/matrix/matrix_integer_dense.o -L/home/mhansen/sage-4.6/local//lib -L/home/mhansen/sage-4.6/local/lib/python2.6/config -lcsage -liml -lgmp -lm -lpari -lgslcblas -lgslcblas -lstdc++ -lntl -lpython2.6 -o build/lib.cygwin-1.7.5-i686-2.6/sage/matrix/matrix_integer_dense.dll
Cannot export zerocol: symbol not found
Cannot export zeromat: symbol not found
gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.5-i686-2.6/sage/matrix/matrix_rational_dense.o -L/home/mhansen/sage-4.6/local//lib -L/home/mhansen/sage-4.6/local/lib/python2.6/config -lcsage -lgmp -lpari -lstdc++ -lntl -lpython2.6 -o build/lib.cygwin-1.7.5-i686-2.6/sage/matrix/matrix_rational_dense.dll
Cannot export zerocol: symbol not found
Cannot export zeromat: symbol not found

Attachments (1)

trac_10247.patch (589 bytes) - added by mhansen 8 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 9 years ago by jdemeyer

1) Please try the new PARI spkg from #10114: http://sage.math.washington.edu/home/jdemeyer/spkg/pari-2.4.3.alpha.p0.spkg (I doubt this will solve the problem, but it's better to try the latest version anyway)

2) Try compiling PARI outside of Sage, i.e. download http://sage.math.washington.edu/home/jdemeyer/spkg/pari-2.4.3.alpha.p0.spkg and then:

$ tar xjf pari-2.4.3.alpha.p0.spkg
$ cd pari-2.4.3.alpha.p0/src
$ ./Configure
$ make gp

3) It would be good to see the full log file (spkg/logs/pari*.log).

4) The functions which fail are all inline functions, so it seems that inline functions are not exported somehow (they should be).

comment:2 Changed 9 years ago by mhansen

1) This package still has the same issues.

2) Compiling inside Sage works fine. I can use the gp shell just fine. (Same goes for outside of Sage).

3) http://sage.math.washington.edu/home/mhansen/pari-2.4.3.alpha.p0.log

4) I tried building with DISABLE_INLINE, and it did not fix the problem.

comment:3 Changed 9 years ago by jdemeyer

Mike, I think you misunderstood step 2). I meant "try to compile the PARI/GP package independently of Sage by doing the following steps:"

$ tar xjf pari-2.4.3.alpha.p0.spkg
$ cd pari-2.4.3.alpha.p0/src
$ ./Configure
$ make gp

comment:4 Changed 9 years ago by jdemeyer

Sorry, I'm the one who misunderstood :-) The problem is that PARI/GP compiles fine but the Sage library files depending on PARI do not.

comment:5 Changed 9 years ago by jdemeyer

Can you compile the PARI spkg with -DINLINE=inline added to CFLAGS and see if that works?

comment:6 Changed 9 years ago by jdemeyer

Sorry, ignore the last post. Since the problem is not with PARI itself, but with the sagelib modules, instead do the following: after the PARI spkg is installed, find the file SAGE_ROOT/local/include/pari/paricfg.h.

Try adding #define INLINE inline there and try again (in any case, it would be useful if you would post the contents of that file).

comment:7 Changed 9 years ago by mhansen

Adding that did not work. (I had to added in parisys.h after where it is normally defined.)

The headers are at http://sage.math.washington.edu/home/mhansen/paricfg.h and http://sage.math.washington.edu/home/mhansen/parisys.h

comment:8 Changed 8 years ago by fbissey

You know looking at this output, I can only think that there is a link order problem. Could you show us the bit of log when libcsage is linked? It may seem a bit far fetched but I think libcsage is linked in the wrong order.

comment:9 Changed 8 years ago by mhansen

You mean

gcc -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.5-i686-2.6/sage/libs/pari/gen.o -L/home/mhansen/sage-4.6/local//lib -L/home/mhansen/sage-4.6/local/lib/python2.6/config -lcsage -lpari -lgmp -lstdc++ -lntl -lpython2.6 -o build/lib.cygwin-1.7.5-i686-2.6/sage/libs/pari/gen.dll

?

comment:10 Changed 8 years ago by fbissey

No earlier, when you link libcsage, on linux it looks like this:

g++ -o libcsage.so -shared src/convert.os src/interrupt
.os src/mpn_pylong.os src/mpz_pylong.os src/mpz_longlong.os src/stdsage.os src/gmp_globals.os src/ZZ_py
long.os src/ntl_wrap.os -L/usr/lib -L/usr/lib/python/config -lntl -lgmp -lpari -lpython2.6

My own thinking is that on platform, or compiler, where ordering is important pari should be before gmp. However thinking again, I don't know why compilation would break where it does for you and not when you build libcsage.

comment:11 Changed 8 years ago by mhansen

It was in the "wrong" order for csage, but after changing that, I still get the same error in building gen.dll.

comment:12 Changed 8 years ago by fbissey

Do you have any tools similar to readelf to check that these symbols are in the pari dll that you have built?

comment:13 Changed 8 years ago by mhansen

I'm pretty sure the fix is to change

cdef extern:

to

cdef extern from "pari/pari.h":

sage/libs/pari/declinl.pxi . I'll try testing this out later tonight.

comment:14 Changed 8 years ago by mhansen

Yep, this is the issue. Cython was generating lines such as

__PYX_EXTERN_C DL_EXPORT(GEN) bid_get_cyc(GEN); /*proto*/

which gcc didn't like in Cygwin.

Changed 8 years ago by mhansen

comment:15 follow-up: Changed 8 years ago by mhansen

  • Authors set to Mike Hansen
  • Status changed from new to needs_review

comment:16 in reply to: ↑ 15 Changed 8 years ago by dimpase

  • Status changed from needs_review to positive_review

Replying to mhansen:

works for me on Windows 7 with Cygwin 1.7.9. Positive review!

(please see more Cygwin-related ready for review tickets on http://trac.sagemath.org/sage_trac/wiki/CygwinPort)

comment:17 Changed 8 years ago by jdemeyer

  • Milestone set to sage-4.7.1

comment:18 Changed 8 years ago by jdemeyer

  • Merged in set to sage-4.7.1.alpha0
  • Resolution set to fixed
  • Reviewers set to Dmitrii Pasechnik
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.