Opened 11 years ago

Closed 11 years ago

Last modified 6 years ago

#9098 closed defect (fixed)

gap buillds 32-bit on OpenSolaris when SAGE64=yes

Reported by: drkirkby Owned by: drkirkby
Priority: major Milestone: sage-4.5
Component: porting: Solaris Keywords:
Cc: jsp Merged in: sage-4.5.alpha0
Authors: David Kirkby Reviewers: Jaap Spies
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by chapoton)

gap is building as a 32-bit application:

config.status: creating gac
config.status: creating Makefile
config.status: creating config.h
( cd bin/i386-pc-solaris2.11-gcc ; make CC='gcc' )
make[3]: Entering directory `/export/home/drkirkby/sage-4.4.2/spkg/build/gap-4.4.12.p3/src/bin/i386-pc-solaris2.11-gcc'
gcc -I. -I../.. -DCONFIG_H -Wall -g -O2  -o ariths.o -c ../../src/ariths.c
gcc -I. -I../.. -DCONFIG_H -Wall -g -O2  -o blister.o -c ../../src/blister.c

Although it builds, the binaries are 32-bit:

drkirkby@hawk:~/sage-4.4.2$ find . -exec file {} \; | grep 32-bit
./local/lib/gap-4.4.12/bin/i386-pc-solaris2.11-gcc/objcftl.o: ELF 32-bit LSB relocatable 80386 Version 1
./local/lib/gap-4.4.12/bin/i386-pc-solaris2.11-gcc/saveload.o: ELF 32-bit LSB relocatable 80386 Version 1
./local/lib/gap-4.4.12/bin/i386-pc-solaris2.11-gcc/listoper.o: ELF 32-bit LSB relocatable 80386 Version 1
./local/lib/gap-4.4.12/bin/i386-pc-solaris2.11-gcc/read.o: ELF 32-bit LSB relocatable 80386 Version 1

There's nothing in spkg-install to add the -m64 flag on any operating system, so I doubt this ever built as a 64-bit application on OS X.

Dave

Attachments (1)

64-bit-gap.patch (2.7 KB) - added by drkirkby 11 years ago.
Mercurial patch which enables gap to build 64-bit on Solaris 10 and OpenSolaris

Download all attachments as: .zip

Change History (6)

comment:1 Changed 11 years ago by drkirkby

Note, there is a note in spkg-install that one has to unset CXXFLAGS and CFLAGS otherwise gap does not like it. Hence this one could be problematic. We many need to alter the flags with a sed script, or something like that.

comment:2 Changed 11 years ago by drkirkby

  • Authors set to David Kirkby
  • Cc jsp added
  • Status changed from new to needs_review

Having looked at this more, I decided to ignore all the warnings in spkg-install, but only make the needed changes on Solaris. Hence the changes will not add '-m64' on OS X, FreeBSD or any other system apart from Solaris and OpenSolaris.

The revised .spkg may be found here.

http://boxen.math.washington.edu/home/kirkby/patches/gap-4.4.12.p4.spkg

The changes have been checked on the following systems. In each case, it was verified that gap worked.

  • Linux (64-bit)
  • OpenSolaris x64 (64-bit)
  • Solaris 10 SPARC (32-bit)
  • Solaris 10 SPARC (64-bit)

See below for further details of tests.

Linux (sage.math.washington.edu)

gcc -I. -I../.. -DCONFIG_H -Wall -g -O2  -o iostream.o -c ../../src/iostream.c
gcc -I. -I../.. -DCONFIG_H -Wall -g -O2  -o float.o -c ../../src/float.c
gcc -Wall -g -O2  -g -export-dynamic  -o gap ariths.o blister.o bool.o c_meths1.o c_type1.o c_oper1.o c_filt1.o c_random.o calls.o code.o compiler.o compstat.o costab.o cyclotom.o dt.o dteval.o exprs.o finfield.o funcs.o gap.o gasman.o gvars.o integer.o intrprtr.o listfunc.o listoper.o lists.o objcftl.o objects.o objfgelm.o objpcgel.o objscoll.o objccoll.o opers.o permutat.o plist.o precord.o range.o rational.o read.o records.o saveload.o scanner.o sctable.o set.o stats.o streams.o string.o sysfiles.o system.o tietze.o vars.o vecgf2.o vec8bit.o vector.o vecffe.o weakptr.o iostream.o float.o   -lm    -ldl 
make[1]: Leaving directory `/home/kirkby/sage-4.4.3/spkg/build/gap-4.4.12.p4/src/bin/x86_64-unknown-linux-gnu-gcc'
chmod +x bin/gap.sh
if ! grep darwin sysinfo.gap ; then ( cd bin/x86_64-unknown-linux-gnu-gcc ; strip gap) ; fi

real	1m3.882s
user	0m47.790s
sys	0m7.500s
Successfully installed gap-4.4.12.p4
Now cleaning up tmp files.
Making Sage/Python scripts relocatable...
Making script relocatable
Finished installing gap-4.4.12.p4.spkg
kirkby@sage:~/sage-4.4.3$ uname -a
Linux sage.math.washington.edu 2.6.24-26-server #1 SMP Tue Dec 1 18:26:43 UTC 2009 x86_64 GNU/Linux

OpenSolaris 64-bit 06/2009 ('hawk' a Sun Ultra 27)

make[1]: Leaving directory `/export/home/drkirkby/sage-4.4.4.alpha0/spkg/build/gap-4.4.12.p4/src/bin/i386-pc-solaris2.11-gcc'
chmod +x bin/gap.sh
if ! grep darwin sysinfo.gap ; then ( cd bin/i386-pc-solaris2.11-gcc ; strip gap) ; fi

real	0m35.057s
user	0m30.127s
sys	0m4.371s
Successfully installed gap-4.4.12.p4
Now cleaning up tmp files.
rm: Cannot remove any directory in the path of the current working directory
/export/home/drkirkby/sage-4.4.4.alpha0/spkg/build/gap-4.4.12.p4
Making Sage/Python scripts relocatable...
Making script relocatable
Finished installing gap-4.4.12.p4.spkg

We can see there is a 64-bit executable

drkirkby@hawk:~/sage-4.4.4.alpha0$ find . -name gap
./spkg/standard/gap-4.4.12.p4/patches/gap
./local/lib/gap-4.4.12/bin/i386-pc-solaris2.11-gcc/gap
./local/bin/gap
./data/extcode/gap
./data/extcode/.hg/data/gap

Although I do not know how to call gap from Sage, the program runs at the command line and is at least able to calculate something.

drkirkby@hawk:~/sage-4.4.4.alpha0$ ./local/bin/gap
Set the environment variable SAGE_ROOT.
drkirkby@hawk:~/sage-4.4.4.alpha0$ export SAGE_ROOT=.
drkirkby@hawk:~/sage-4.4.4.alpha0$ ./local/bin/gap
    
            #########           ######         ###########           ###  
         #############          ######         ############         ####  
        ##############         ########        #############       #####  
       ###############         ########        #####   ######      #####  
      ######         #         #########       #####    #####     ######  
     ######                   ##########       #####    #####    #######  
     #####                    ##### ####       #####   ######   ########  
     ####                    #####  #####      #############   ###  ####  
     #####     #######       ####    ####      ###########    ####  ####  
     #####     #######      #####    #####     ######        ####   ####  
     #####     #######      #####    #####     #####         #############
      #####      #####     ################    #####         #############
      ######     #####     ################    #####         #############
      ################    ##################   #####                ####  
       ###############    #####        #####   #####                ####  
         #############    #####        #####   #####                ####  
          #########      #####          #####  #####                ####  
                                                                          
     Information at:  http://www.gap-system.org
     Try '?help' for help. See also  '?copyright' and  '?authors'
    
   Loading the library. Please be patient, this may take a while.
GAP4, Version: 4.4.12 of 17-Dec-2008, i386-pc-solaris2.11-gcc -m64
gap> 10^20 + 1;
100000000000000000001
gap> 

Solaris 10 (SPARC) 32-bit ('redstart' a Sun Blade 1000)

On a SPARC in 32-bit mode (the only Solaris system which works fully with Sage), we can see that gap builds ok.

.o vec8bit.o vector.o vecffe.o weakptr.o iostream.o float.o   -lm    
make[1]: Leaving directory `/export/home/drkirkby/32/sage-4.4.3/spkg/build/gap-4.4.12.p4/src/bin/sparc-sun-solaris2.10-gcc'
chmod +x bin/gap.sh
if ! grep darwin sysinfo.gap ; then ( cd bin/sparc-sun-solaris2.10-gcc ; strip gap) ; fi
/bin/sh: !: not found

real    5m15.428s
user    4m42.147s
sys     0m26.935s
Successfully installed gap-4.4.12.p4
Now cleaning up tmp files.
rm: Cannot remove any directory in the path of the current working directory

Again, gap can be seen to work, but this time in 32-bit mode.

drkirkby@redstart:~/32/sage-4.4.3$ export SAGE_ROOT .
-bash: export: `.': not a valid identifier
drkirkby@redstart:~/32/sage-4.4.3$ export SAGE_ROOT=.
drkirkby@redstart:~/32/sage-4.4.3$ local/bin/gap
    
            #########           ######         ###########           ###  
         #############          ######         ############         ####  
        ##############         ########        #############       #####  
       ###############         ########        #####   ######      #####  
      ######         #         #########       #####    #####     ######  
     ######                   ##########       #####    #####    #######  
     #####                    ##### ####       #####   ######   ########  
     ####                    #####  #####      #############   ###  ####  
     #####     #######       ####    ####      ###########    ####  ####  
     #####     #######      #####    #####     ######        ####   ####  
     #####     #######      #####    #####     #####         #############
      #####      #####     ################    #####         #############
      ######     #####     ################    #####         #############
      ################    ##################   #####                ####  
       ###############    #####        #####   #####                ####  
         #############    #####        #####   #####                ####  
          #########      #####          #####  #####                ####  
                                                                          
     Information at:  http://www.gap-system.org
     Try '?help' for help. See also  '?copyright' and  '?authors'
    
   Loading the library. Please be patient, this may take a while.
GAP4, Version: 4.4.12 of 17-Dec-2008, sparc-sun-solaris2.10-gcc
gap> 12+2;
14
gap> 

Solaris 10 (SPARC) 64-bit ('redstart' a Sun Blade 1000)

Although little effort has been put into a 64-bit port to Solaris 10 on SPARC, changes made to build OpenSolaris? x64 will usually benefit Solaris 10 on SPARC too. We can see gap builds 64-bit.

drkirkby@redstart:~/32/sage-4.4.3$ export SAGE_ROOT=.
drkirkby@redstart:~/32/sage-4.4.3$ local/bin/gap
    
            #########           ######         ###########           ###  
         #############          ######         ############         ####  
        ##############         ########        #############       #####  
       ###############         ########        #####   ######      #####  
      ######         #         #########       #####    #####     ######  
     ######                   ##########       #####    #####    #######  
     #####                    ##### ####       #####   ######   ########  
     ####                    #####  #####      #############   ###  ####  
     #####     #######       ####    ####      ###########    ####  ####  
     #####     #######      #####    #####     ######        ####   ####  
     #####     #######      #####    #####     #####         #############
      #####      #####     ################    #####         #############
      ######     #####     ################    #####         #############
      ################    ##################   #####                ####  
       ###############    #####        #####   #####                ####  
         #############    #####        #####   #####                ####  
          #########      #####          #####  #####                ####  
                                                                          
     Information at:  http://www.gap-system.org
     Try '?help' for help. See also  '?copyright' and  '?authors'
    
   Loading the library. Please be patient, this may take a while.
GAP4, Version: 4.4.12 of 17-Dec-2008, sparc-sun-solaris2.10-gcc -m64
gap>  s8 := Group( (1,2), (1,2,3,4,5,6,7,8) );
Group([ (1,2), (1,2,3,4,5,6,7,8) ])
gap> a8 := DerivedSubgroup( s8 );
Group([ (1,2,3), (2,3,4), (2,4)(3,5), (2,6,4), (2,4)(5,7), (2,8,6,4)(3,5) ])
gap> Size( a8 ); IsAbelian( a8 ); IsPerfect( a8 );
20160
false
true
gap> 

We can see that the binary created is indeed 64-bit:

drkirkby@redstart:~/32/sage-4.4.3$ file ./local/bin/gap
./local/bin/gap:        executable shell script
drkirkby@redstart:~/32/sage-4.4.3$ file ./local/lib/gap-4.4.12/bin/sparc-sun-solaris2.10-gcc/gap
./local/lib/gap-4.4.12/bin/sparc-sun-solaris2.10-gcc/gap:       ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped, no debugging information available
drkirkby@redstart:~/32/sage-4.4.3$ 

Changed 11 years ago by drkirkby

Mercurial patch which enables gap to build 64-bit on Solaris 10 and OpenSolaris

comment:3 Changed 11 years ago by jsp

  • Reviewers set to Jaap Spies
  • Status changed from needs_review to positive_review

I can confirm, this effects only 64-bit on Solaris (10 and OpenSolaris?).

I'll give it a positive review.

Jaap

comment:4 Changed 11 years ago by rlm

  • Merged in set to sage-4.5.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:5 Changed 6 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.