Bill Allombert on Wed, 23 Jun 2010 23:18:22 +0200


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

Re: gp2c howto


On Wed, Jun 23, 2010 at 09:11:07PM +0200, Sac-Epee Jean-Marc wrote:
> 
> Hi everybody,
> 
> I try to use gp2c... unsuccessfully for the moment.
> 
> 1. For example, in a file named test.gp, I wrote the line
> 
> l=polroots(x^2-3*x+1); print(l);
> 
> 2. In a console, I wrote
> 
> gp2c test.gp > test.c
> 
> The file test.c is :

... is correct, so gp2c itself is working fine.

> 3. I run the usual Makefile (see below), and obtained :
> 
> 
> [jmse@hal Pari]$ make
> /usr/bin/gcc -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer
> -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer    -I.
> -I/usr/local/include  test.c
> /usr/bin/gcc -o test-dyn -O3 -Wall -fno-strict-aliasing
> -fomit-frame-pointer    -Wl,--export-dynamic  test.o
> -Wl,-rpath,/usr/local/lib -ldl -lm -L/usr/local/lib -lpari
> /usr/lib/gcc/i586-manbo-linux-gnu/4.3.2/../../../crt1.o: In function
> `_start':
> /home/qateam/rpm/BUILD/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115:
> undefined reference to `main'
> collect2: ld a retourné 1 code d'état d'exécution
> make: *** [test-dyn] Erreur 1
> 
> 
> Actually, the file test.c has no main procedure...

Yes, but you can add your own.
GP2C generate source code for a shared library that can be used inside GP using
the install() command.

> This the Makefile found in /usr/local/pari-2.3.4/examples, which run
> well with the file extgcd.c  (in my Makefile, the line TARGET =
> extgcd is replaced with TARGET = test).
> dyn: $(TARGET)-dyn
> 
> dynlib: $(DYN)

You should try to do "make dynlib".

> For you, what is the problem in my process ?

I have two suggestions:
First read the GP2C manual
  <http://pari.math.u-bordeaux.fr/pub/pari/manuals/gp2c/gp2c.html>
Second investigate the option --with-paricfg to configure and
the program gp2c-run which help with compiling gp2c-generated code.

Cheers,
Bill.