Opened 7 years ago

Closed 7 years ago

#13954 closed defect (fixed)

New Gap spkg (>=4.5) does not build with shared only GMP/MPIR

Reported by: jpflori Owned by: tbd
Priority: major Milestone: sage-5.7
Component: packages: standard Keywords: spkg gap cygwin
Cc: kcrisman, dimpase Merged in: sage-5.7.beta2
Authors: Jean-Pierre Flori Reviewers: Dmitrii Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jpflori)

And we only build a shared one on Cygwin because we cannot build both static and shared (although this limitation is not clearly still needed).

Try spkg at http://boxen.math.washington.edu/home/jpflori/gap-4.5.7.p3.spkg

Attachments (1)

gap-4.5.7.p3.diff (6.5 KB) - added by jpflori 7 years ago.
Spkg diff, for review only.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 7 years ago by jpflori

The configure script tests for libgmp.a if --with-gmp=... is passed.

comment:2 Changed 7 years ago by kcrisman

Would this explain my current problem that GAP doesn't build on XP? Configure fails with

configure: error: Could not locate GMP in the specified location

comment:3 Changed 7 years ago by jpflori

Yes that's it.

comment:4 Changed 7 years ago by jpflori

Ok, I got GAP to build but the script gap_cygwin is completely broken as well.

comment:5 Changed 7 years ago by jpflori

Ok we basically have to remove all Cygwin specific things from spkg-install.

comment:6 Changed 7 years ago by kcrisman

Great, provide something and I can still try it today!

Nice that the folks at #13211 managed to do this

if [ "x$GAP_DIR" = "x" ];  then
    GAP_DIR="$SAGE_ROOT/local/lib/gap-4.5.5" 
fi

but then somehow not update it to 4.5.7!?

comment:7 Changed 7 years ago by kcrisman

By the way, WHY do we need to start GAP to start Sage? I know that sage-location or some similar script does this upon the first start... but it does seem a bit much.

comment:8 Changed 7 years ago by jpflori

Anyway even the SAGE_ROOT part is wrong.

Try a dirty spkg at http://boxen.math.washington.edu/home/jpflori/gap-4.5.7.p2.spkg

comment:9 Changed 7 years ago by vbraun

Looks good to me.

Not sure what you mean by needing to start GAP for Sage. Sage startup doesn't start a GAP session. The GAP workspace cache needs to be rebuilt once, though.

comment:10 Changed 7 years ago by kcrisman

  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    8686    exit 1
    8787fi
    8888
    89 # On Cygwin installations the GAP build creates a file 'gap.exe',
    90 # and then tries to strip the file 'gap'.
    91 # This broke the build on old Cygwin installations.
    92 # On newer Cygwins, 'gap' is automatically "translated" to 'gap.exe'.
    93 if [[ "$UNAME" = CYGWIN ]]; then
    94     echo "Creating a dummy 'gap.exe' in 'bin/i686-pc-cygwin-gcc'..."
    95     cd "$SPKG_ROOT/src"
    96     mkdir -p bin/i686-pc-cygwin-gcc &&
    97     cd bin/i686-pc-cygwin-gcc &&
    98     touch gap.exe
    99     if [[ $? -ne 0 ]]; then
    100         # Something really went wrong.
    101         echo >&2 "Error creating a dummy gap.exe file."
    102         exit 1
    103     fi
    104     # Check if 'gap' is automatically "translated" to 'gap.exe'.
    105     # If not, create a symbolic link from 'gap' to 'gap.exe'.
    106     if [[ ! -f gap ]]; then
    107         echo "Creating a symbolic link from 'gap' to 'gap.exe'..."
    108         ln -s gap.exe gap
    109         if [[ $? -ne 0 ]]; then
    110             # Something really went wrong.
    111             echo >&2 "Error creating the symbolic link."
    112             exit 1
    113         fi
    114     fi
    115 fi
    116 
    11789echo "Building GAP..."
    11890cd "$SPKG_ROOT/src"
    11991$MAKE -j1
     
    144116echo "Copying GAP startup script..."
    145117rm -f "$SAGE_LOCAL/bin/gap"
    146118cd "$SPKG_ROOT"
    147 if [[ "$UNAME" = CYGWIN ]]; then
    148     cp patches/gap_cygwin "$SAGE_LOCAL/bin/gap"
    149 else
    150     cp src/bin/gap.sh "$SAGE_LOCAL/bin/gap"
    151 fi
     119cp src/bin/gap.sh "$SAGE_LOCAL/bin/gap"
    152120if [[ $? -ne 0 ]]; then
    153121    echo >&2 "Error copying customized GAP startup script."
    154122    exit 1

Yeah, if it works, then we are set. It just finished building for me... sage -b now... that worked... Trying to start, sage-location is being run... it works!!!

Commit and make the spkg, this is ready to go.

Not sure what you mean by needing to start GAP for Sage. Sage startup doesn't start a GAP session. The GAP workspace cache needs to be rebuilt once, though.

Well, there is a GAP command that is run (and fails here, gap -r -b -p -T -o 251m .../gap/sage.g), so that sounds like GAP to me. Also, upon a first start (or relocation), Sage always says something about stopping a GAP session. But if it's not technically a session, that's fine; my point was that it does something, which e.g. Singular and Maxima don't.

comment:11 Changed 7 years ago by jpflori

Ok, here you go, the spkg is updated and diff posted here. I directly patch configure and leave configure.in as is. This is dirty but what GAP does is so it's fair.

comment:12 Changed 7 years ago by jpflori

  • Authors set to Jean-Pierre Flori
  • Status changed from new to needs_review

comment:13 Changed 7 years ago by kcrisman

Thanks. Do we need to provide a dylib check for Mac, or is that not relevant (apparently not, since we never encountered trouble looking for the .a file)? I really need to read configure files more - the solution was just sitting there waiting to be found. Too bad you can't take a class on configure files...

Anyway, although the change in the config shouldn't make a difference on other platforms, it would be nice to test this on Mac and Linux. JP, I assume you developed on Linux.

comment:14 Changed 7 years ago by kcrisman

Also, another data point is #13588, which just (finally!) got positive review. I have no idea if that will make things tougher for us here, but I think that, given all the many months of work that went into that ticket, we should probably rebase this to that ticket.

comment:15 Changed 7 years ago by jpflori

Of course, it somehow got out of my head.

I'll take this chance to provide a slightly cleaner patch, maybe using -lgmp to let the linker chose, not sure though, because if we really check for the existence of a shared *gmp*.* we can as well pass its full path to the linker.

comment:16 follow-up: Changed 7 years ago by dimpase

  • Status changed from needs_review to needs_work

doesn't work for me. I get

$ ./sage -f gap-4.5.7.p2.spkg
gap-4.5.7.p2
====================================================
Extracting package /usr/local/src/sage/sage-5.7.beta0/gap-4.5.7.p2.spkg
-rw-r--r-- 1 dima Domain Users 8274155 Jan 15 23:18 /usr/local/src/sage/sage-5.7.beta0/gap-4.5.7.p2.spkg
Finished extraction
****************************************************
Host system:
CYGWIN_NT-6.1-WOW64 SPMS-DIMA-W7-64 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin
****************************************************
C compiler: gcc
C compiler version:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.5.3/lto-wrapper.exe
Target: i686-pc-cygwin
[...]
gcc version 4.5.3 (GCC)
****************************************************
spkg-install is using
VERSION = 4.5.7
GAP_DIR = gap-4.5.7
INSTALL_DIR = /usr/local/src/sage/sage-5.7.beta0/local/gap/gap-4.5.7
Applying patches...
patching file cnf/aclocal.m4
patching file cnf/configure.out
Hunk #1 succeeded at 4428 (offset 26 lines).
patching file configure
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file configure.rej
Error applying '../patches/configure.patch'

real    0m1.047s
user    0m0.120s
sys     0m0.521s
************************************************************************
Error installing package gap-4.5.7.p2

comment:17 in reply to: ↑ 16 Changed 7 years ago by dimpase

Replying to dimpase:

doesn't work for me.

however, I took the diff above and applied it in the gap spkg directory as follows:

patch -p1 <gap-4.5.7.p2.diff

the resulting spkg installed just fine on cygwin.

comment:18 Changed 7 years ago by jpflori

  • Cc dimapase added
  • Description modified (diff)
  • Status changed from needs_work to needs_review

Ive uploaded a new spkg based on #13963.

After a quick look it does not seem that libgap which uses better checks for GMP will need any action from here, but I've not actually tried to build it yet. As I've finally found where my Cygwin memleak came from, I might test 5.7.beta1 quickly though.

comment:19 Changed 7 years ago by jpflori

  • Cc dimpase added; dimapase removed

Changed 7 years ago by jpflori

Spkg diff, for review only.

comment:20 Changed 7 years ago by dimpase

  • Status changed from needs_review to positive_review

comment:21 Changed 7 years ago by jdemeyer

  • Reviewers set to Dmitrii Pasechnik

comment:22 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.7.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.