Bill Allombert on Wed, 02 Sep 2009 15:51:43 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: pari svn fails on solaris , missing -fPIC


On Wed, Sep 02, 2009 at 12:39:51PM +0100, Jason Moxham wrote:
> On Wednesday 02 September 2009 10:49:31 Bill Allombert wrote:
> > On Thu, Aug 06, 2009 at 10:13:11PM +0100, Jason Moxham wrote:
> > > jasonmoxham@t2:~/pari$ uname -a
> > > SunOS t2 5.10 Generic_141414-02 sun4v sparc SUNW,T5240
> > >
> > >
> > > jasonmoxham@t2:~/pari$ gcc -v
> > > Using built-in specs.
> > > Target: sparc-sun-solaris2.10
> > > Configured
> > > with: ../gcc-4.2.4/configure --prefix=/usr/local/gcc-4.2.4-sun-linker/
> > > --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld
> > > --without-gnu-ld --enable-languages=c,c++,fortran
> > > --with-mpfr-include=/usr/local/include --with-mpfr-lib=/usr/local/lib
> > > --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib
> > > Thread model: posix
> > > gcc version 4.2.4
> > >
> > > ./Configure --without-gmp
> > > make gp
> > >
> > > ./Configure: svnversion: not found
> > > Configuring pari-2.4.3 (DEVELOPMENT VERSION) [ development svn- ]
> > > Checking echo to see how to suppress newlines...
> > > ...using \c
> > > Looking for some tools first ...
> > > ...ld is /usr/ccs/bin/ld
> > > ...zcat is /bin/zcat
> > > ...gzip is /bin/gzip
> > > ...ranlib is /usr/ccs/bin/ranlib
> > > ...perl is /bin/perl
> > > Looking for the compilers ...
> > > ...cc is /usr/ucb/cc
> > > ...gcc is /usr/local/gcc-4.2.4-sun-linker/bin/gcc
> > > GNU compiler version 4.2.4
> > > Given the previous choices, sizeof(long) is 4 chars.
> > > The internal word representation of a double is l[0], l[1].
> > > =========================================================================
> > >= Building for: unknown running solaris (portable C kernel) 32-bit version
> > > =========================================================================
> > >= C compiler
> > > is          /usr/local/gcc-4.2.4-sun-linker/bin/gcc -O3 -Wall
> > > -fno-strict-aliasing -fomit-frame-pointer Executable linker
> > > is   /usr/local/gcc-4.2.4-sun-linker/bin/gcc  -O3 -Wall
> > > -fno-strict-aliasing -fomit-frame-pointer Dynamic Lib linker is 
> > > /usr/local/gcc-4.2.4-sun-linker/bin/gcc  -shared $(CFLAGS) $(DLCFLAGS)
> > > -Wl,-G,-h,$(LIBPARI_SONAME)
> > > Looking in C lib for some symbols...
> > > ...Found exp2.
> > > ...Found log2.
> > > ...Found strftime.
> > > ...Found getrusage.
> > > ...Found sigaction.
> > > ...Found TIOCGWINSZ.
> > > ...Found getrlimit.
> > > ...Found stat.
> > > ...Found vsnprintf.
> > > ...Found waitpid.
> > > ...Found setsid.
> > > ...Found getenv.
> > > ...Found isatty.
> > > ...Found alarm.
> > > ...Found dlopen.
> > > Checking for optional libraries and headers...
> > > ### Building without GNU MP support
> > > ...Found libX11 in /usr/openwin/lib
> > > ...Found X11 header files in /usr/openwin/include/X11
> > > ...Extra Libraries are -lsocket -lnsl
> > > Hi-Res Graphics: X11
> > > ### Building without GNU readline support
> > > Installation prefix ? [/usr/local]
> > > ...for architecture-independent files (share-prefix) ? [/usr/local/share]
> > > Installation directories for:
> > > ...executables (gp, gphelp) ? [/usr/local/bin]
> > > ...libraries (libpari) ? [/usr/local/lib]
> > > ...include files ? [/usr/local/include]
> > > ...manual pages ? [/usr/local/share/man/man1]
> > > ...other system-dependent data ? [/usr/local/lib/pari]
> > > ...other system-independent data ? [/usr/local/share/pari]
> > > Default is dynamic executable and shared library
> > > =========================================================================
> > >= Extracting examples/Makefile.solaris-none
> > > Extracting Osolaris-none/Makefile
> > > Extracting Makefile
> > > Extracting Osolaris-none/paricfg.h
> > > Extracting Osolaris-none/../Odos/paricfg.h
> > > Extracting scripts and macros
> > > ...in doc
> > > ...in misc
> > > =========================================================================
> > >= Shall we try to build pari 2.4.3 (development svn-) now (y/n)? [n] Ok.
> > > Type "make install" when you are ready
> > > Bye !
> > > Making gp in Osolaris-none
> > > make[1]: Entering directory `/home/jasonmoxham/pari/Osolaris-none'
> > >
> > > But doing
> > >
> > > CFLAGS="-fPIC" ./Configure
> > > make gp
> > >
> > > and the build goes OK
> >
> > Hello Jason,
> > In the past, -fPIC was not required on 32bit sparc.
> > Anyway, I added -fPIC in revision 11889.
> > Thanks for your report.
> >
> > Cheers,
> > Bill.
> 
> This one works
> 
> bash-3.00$ uname -a
> SunOS mark 5.10 Generic_127111-01 sun4u sparc SUNW,Sun-Blade-2500
> 
> -bash-3.00$ ./Configure
> ./Configure: svnversion: not found
> Configuring pari-2.4.3 (DEVELOPMENT VERSION) [ development svn- ]
> Checking echo to see how to suppress newlines...
> ...using \c
> Looking for some tools first ...
> ...ld is /usr/ccs/bin/ld
> ...zcat is /usr/bin/zcat
> ...gzip is /usr/bin/gzip
> ...ranlib is /usr/ccs/bin/ranlib
> ...perl is /usr/bin/perl
> Looking for the compilers ...
> ...cc is /usr/local/bin/sparc-SunOS-ultrasparc3/cc
> ...gcc is /usr/local/bin/sparc-SunOS-ultrasparc3/gcc
> GNU compiler version 4.4.1 (GCC)
> Given the previous choices, sizeof(long) is 4 chars.
> The internal word representation of a double is l[0], l[1].
> ==========================================================================
> Building for: UltraSparc running solaris (MicroSparc/GMP kernel) 32-bit 
> version
> ==========================================================================
> C compiler 
> is          /usr/local/bin/sparc-SunOS-ultrasparc3/gcc -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer    -fPIC
> Executable linker 
> is   /usr/local/bin/sparc-SunOS-ultrasparc3/gcc  -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer    -Wl,--export-dynamic
> Dynamic Lib linker 
> is  /usr/local/bin/sparc-SunOS-ultrasparc3/gcc  -shared -mimpure-text 
> $(CFLAGS) $(DLCFLAGS) -Wl,-shared,-soname=$(LIBPARI_SONAME)
> Looking in C lib for some symbols...
> ...Found exp2.
> ...Found log2.
> ...Found strftime.
> ...Found getrusage.
> ...Found sigaction.
> ...Found TIOCGWINSZ.
> ...Found getrlimit.
> ...Found stat.
> ...Found vsnprintf.
> ...Found waitpid.
> ...Found setsid.
> ...Found getenv.
> ...Found isatty.
> ...Found alarm.
> ...Found dlopen.
> Checking for optional libraries and headers...
> ### Building without GNU MP support
> ...Found libX11 in /usr/openwin/lib
> ...Found X11 header files in /usr/openwin/include/X11
> ...Extra Libraries are -lsocket -lnsl
> Hi-Res Graphics: X11
> ### Building without GNU readline support
> Installation prefix ? [/usr/local]
> ...for architecture-independent files (share-prefix) ? [/usr/local/share]
> Installation directories for:
> ...executables (gp, gphelp) ? [/usr/local/bin]
> ...libraries (libpari) ? [/usr/local/lib]
> ...include files ? [/usr/local/include]
> ...manual pages ? [/usr/local/share/man/man1]
> ...other system-dependent data ? [/usr/local/lib/pari]
> ...other system-independent data ? [/usr/local/share/pari]
> Default is dynamic executable and shared library
> ==========================================================================
> Extracting examples/Makefile.solaris-sparcv9
> Extracting Osolaris-sparcv9/Makefile
> Extracting Makefile
> Extracting Osolaris-sparcv9/paricfg.h
> Extracting Osolaris-sparcv9/../Odos/paricfg.h
> Extracting scripts and macros
> ...in doc
> ...in misc
> ==========================================================================
> Shall we try to build pari 2.4.3 (development svn-) now (y/n)? [n]
> Ok. Type "make install" when you are ready
> Bye !
> -bash-3.00$                              
> 
> But this one still fails
> 
> jasonmoxham@t2:~/pari$ uname -a
> SunOS t2 5.10 Generic_141414-02 sun4v sparc SUNW,T5240
> jasonmoxham@t2:~/pari$ ./Configure
> ./Configure: svnversion: not found
> Configuring pari-2.4.3 (DEVELOPMENT VERSION) [ development svn- ]
> Checking echo to see how to suppress newlines...
> ...using \c
> Looking for some tools first ...
> ...ld is /usr/ccs/bin/ld
> ...zcat is /bin/zcat
> ...gzip is /bin/gzip
> ...ranlib is /usr/ccs/bin/ranlib
> ...perl is /bin/perl
> Looking for the compilers ...
> ...cc is /usr/ucb/cc
> ...gcc is /usr/local/gcc-4.2.4-sun-linker/bin/gcc
> GNU compiler version 4.2.4
> Given the previous choices, sizeof(long) is 4 chars.
> The internal word representation of a double is l[0], l[1].
> ==========================================================================
> Building for: unknown running solaris (portable C/GMP kernel) 32-bit version
> ==========================================================================
> C compiler 
> is          /usr/local/gcc-4.2.4-sun-linker/bin/gcc -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer
> Executable linker 
> is   /usr/local/gcc-4.2.4-sun-linker/bin/gcc  -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer
> Dynamic Lib linker is  /usr/local/gcc-4.2.4-sun-linker/bin/gcc  -shared  
> $(CFLAGS) $(DLCFLAGS) -Wl,-G,-h,$(LIBPARI_SONAME)
> Looking in C lib for some symbols...
> ...Found exp2.
> ...Found log2.
> ...Found strftime.
> ...Found getrusage.
> ...Found sigaction.
> ...Found TIOCGWINSZ.
> ...Found getrlimit.
> ...Found stat.
> ...Found vsnprintf.
> ...Found waitpid.
> ...Found setsid.
> ...Found getenv.
> ...Found isatty.
> ...Found alarm.
> ...Found dlopen.
> Checking for optional libraries and headers...
> ...Found libgmp in /usr/local/lib
> ...Found gmp header in /usr/local/include
> Using GNU MP, version 4.3.1
> ...Found libX11 in /usr/openwin/lib
> ...Found X11 header files in /usr/openwin/include/X11
> ...Extra Libraries are -lsocket -lnsl
> Hi-Res Graphics: X11
> ### Building without GNU readline support
> Installation prefix ? [/usr/local]
> ...for architecture-independent files (share-prefix) ? [/usr/local/share]
> Installation directories for:
> ...executables (gp, gphelp) ? [/usr/local/bin]
> ...libraries (libpari) ? [/usr/local/lib]
> ...include files ? [/usr/local/include]
> ...manual pages ? [/usr/local/share/man/man1]
> ...other system-dependent data ? [/usr/local/lib/pari]
> ...other system-independent data ? [/usr/local/share/pari]
> Default is dynamic executable and shared library
> ==========================================================================
> Extracting examples/Makefile.solaris-none
> Extracting Osolaris-none/Makefile
> Extracting Makefile
> Extracting Osolaris-none/paricfg.h
> Extracting Osolaris-none/../Odos/paricfg.h
> Extracting scripts and macros
> ...in doc
> ...in misc
> ==========================================================================
> Shall we try to build pari 2.4.3 (development svn-) now (y/n)? [n]
> Ok. Type "make install" when you are ready
> Bye !
> jasonmoxham@t2:~/pari$                     
> 
> there is no -fPIC in the compiler flags

Yes, but we are using -mimpure-text in the linker flag.

So to summary the situation:
1) PARI need to know about sun4v.
2) PARI must either use -fPIC or -mimpure-text on 32bit sparc because
of [1] below.
3) Since sun4v was not reckognized, PARI did not set -mimpure-text
so -fPIC was required.

At this point, what is required is some benchmark to see whether 
-mimpure-text is actually faster than -fPIC. The flag -mimpure-text
used to be required because the assembly sparc kernel was not PIC, but
this has been fixed now, so it should work.

So could you run some tests to see whether it is better to keep -mimpure-text
instead of -fPIC ?

Cheers,
Bill.
[1]: from GCC documentation:
`-mimpure-text'
     `-mimpure-text', used in addition to `-shared', tells the compiler
     to not pass `-z text' to the linker when linking a shared object.
     Using this option, you can link position-dependent code into a
     shared object.

     `-mimpure-text' suppresses the "relocations remain against
     allocatable but non-writable sections" linker error message.
     However, the necessary relocations will trigger copy-on-write, and
     the shared object is not actually shared across processes.
     Instead of using `-mimpure-text', you should compile all source
     code with `-fpic' or `-fPIC'.