mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2012-10-29, 02:46   #12
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

4,003 Posts
Default

Thanks frmky,

I must have something else wrong. Both my IDE and command line give me the same trouble:

With pari_init(1000000000,2); or smaller:
Code:
[user@comp pariTest]$ ./ptest
a = 11
b = 17

  ***   the PARI stack overflows !
  current stack size: 100000000 (95.367 Mbytes)
  [hint] you can increase GP stack with allocatemem()

  ***   Error in the PARI system. End of program.
With pari_init(10000000000,2);:
Code:
[user@comp pariTest]$ ./ptest
a = 11
b = 17

  ***   segmentation fault: bug in PARI or calling program.
  ***   Error in the PARI system. End of program.
Must be a flaw in my system.

Off to try another system...
EdH is offline   Reply With Quote
Old 2012-10-29, 03:52   #13
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175B16 Posts
Default

The test program works on my system as well so it must be something with yours...
CRGreathouse is offline   Reply With Quote
Old 2012-10-29, 13:25   #14
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

4,003 Posts
Default

There's a minor printing issue with the first machine, but the second one is frustrating. The second one, is my main system and I totally removed/reinstalled from scratch, both pari and gp2c.

machine math06 (Ubuntu 32-bit, repository versions of pari and gp2c):
Code:
math06@math06:~/Mathwork/pari$ whereis pari
pari: /usr/lib/pari /usr/include/pari /usr/share/pari /usr/share/man/man1/pari.1.gz
math06@math06:~/Mathwork/pari$ whereis gp2c
gp2c: /usr/bin/gp2c /usr/share/gp2c /usr/share/man/man1/gp2c.1.gz
math06@math06:~/Mathwork/pari$ gcc -o ptest -g -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -fPIC -I"/usr/include" pariTest.gp.c -lc -lm -L/usr/lib -lpari
pariTest.gp.c: In function 'pTest':
pariTest.gp.c:28:7: warning: implicit declaration of function 'pari_printf'
pariTest.gp.c: In function 'main':
pariTest.gp.c:43:8: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result
pariTest.gp.c:45:8: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result
/tmp/ccgpmm0C.o: In function `pTest':
/home/math06/Mathwork/pari/pariTest.gp.c:28: undefined reference to `pari_printf'***
collect2: ld returned 1 exit status
math06@math06:~/Mathwork/pari$ gcc -o ptest -g -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -fPIC -I"/usr/include" pariTest.gp.c -lc -lm -L/usr/lib -lpari
pariTest.gp.c: In function 'main':
pariTest.gp.c:43:8: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result
pariTest.gp.c:45:8: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result
math06@math06:~/Mathwork/pari$ ./ptest
a = 11
b = 17
e is %Ps
e is %Ps
e is %Ps
e is %Ps
e is %Ps
e is %Ps
e is %Ps
***I had to change pari_print() to pariprint().

machine comp (Fedora 64-bit, manual installation of pari and gp2c):
Code:
[user@comp examples]$ whereis pari
pari: /usr/local/lib/pari
[user@comp examples]$ whereis libpari
libpari: /usr/local/lib/libpari.so
[user@comp examples]$ whereis libpari-gmp.so.3
libpari-gmp.so: /usr/local/lib/libpari-gmp.so.3
[user@comp examples]$ gcc -o ptest -g -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -fPIC -I"/usr/local/lib" ptest.gp.c -lc -lm -L/usr/local/lib -lpari 
[user@comp examples]$ ./ptest
./ptest: error while loading shared libraries: libpari-gmp.so.3: cannot open shared object file: No such file or directory
[user@comp examples]$ gcc -o ptest -g -O3 -Wall -fomit-frame-pointer -fno-strict-aliasing -fPIC -I"/usr/local/lib" ptest.gp.c -lc -lm -L"/usr/local/lib" -lpari
[user@comp examples]$ ./ptest
./ptest: error while loading shared libraries: libpari-gmp.so.3: cannot open shared object file: No such file or directory
EdH is offline   Reply With Quote
Old 2012-10-29, 16:46   #15
frmky
 
frmky's Avatar
 
Jul 2003
So Cal

22×547 Posts
Default

The problem on the 64-bit Fedora computer sounds like an ldconfig issue. See http://www.brunolinux.com/02-The_Terminal/ldconfig.html.
frmky is online now   Reply With Quote
Old 2012-10-29, 17:02   #16
jcrombie
 
jcrombie's Avatar
 
"Jonathan"
Jul 2010
In a tangled web...

21510 Posts
Default

Quote:
Originally Posted by frmky View Post
The problem on the 64-bit Fedora computer sounds like an ldconfig issue. See http://www.brunolinux.com/02-The_Terminal/ldconfig.html.
That was what I was thinking too.

I would try just typing: "sudo ldconfig" first without editing any system files and see if that works.

Also, you can type: "ldd ptest" to check if all shared libraries are going to be found at runtime without having to run the program.
jcrombie is offline   Reply With Quote
Old 2012-10-29, 19:14   #17
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

4,003 Posts
Default

Thanks guys! That did the trick, although it was very convoluted on this Fedora system. sudo anything doesn't work and you can't do any GUI type file management or text editing as the superuser. Also the ld.so.conf file only contains a single line to include all the files in the ld.so.conf.d directory. So, instead of trying to edit it, I wrote usr-local-lib.conf elsewhere (as user) and cp'd that into the ld.so.conf.d directory using superuser.

Prior to usr-local-lib.conf creation:
Code:
[user@comp examples]$ ldd ptest
    linux-vdso.so.1 =>  (0x00007fff0f95b000)
    libc.so.6 => /lib64/libc.so.6 (0x00000036e1200000)
    libm.so.6 => /lib64/libm.so.6 (0x00000036e2200000)
    /lib64/ld-linux-x86-64.so.2 (0x00000036e0e00000)
    libpari-gmp.so.3 => not found
After usr-local-lib.conf creation:
Code:
[user@comp examples]$ ldd ptest
    linux-vdso.so.1 =>  (0x00007fff005cb000)
    libc.so.6 => /lib64/libc.so.6 (0x00000036e1200000)
    libm.so.6 => /lib64/libm.so.6 (0x00000036e2200000)
    libpari-gmp.so.3 => /usr/local/lib/libpari-gmp.so.3 (0x00007f64ded57000)
    /lib64/ld-linux-x86-64.so.2 (0x00000036e0e00000)
    libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x00000036e3200000)
[user@comp examples]$ ./ptest
a = 11
b = 17
e is 11
e is 12
e is 13
e is 14
e is 15
e is 16
e is 17
BTW, ldconfig ran under superuser, but made no difference until I manually added the file to the directory.

Now, I'll see what happens when I modify it more into what I'm after and eventually see if I can get it all working in my IDE.

Thanks much, everyone...
EdH is offline   Reply With Quote
Old 2012-10-30, 03:41   #18
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

4,003 Posts
Default

Quote:
Originally Posted by frmky View Post
I doubt it. The idea of gp2c-run is to combine the speed of the c compiled function with the ease of use of the gp calculator.
They do indeed seem to run at extremely close to the same speed.

I still haven't figured out how to compile within my IDE. But, I'm going to study makefiles for a while, anyway, and set the IDE aside for these things...

Thanks for all...
EdH is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question regarding basic routines being used in Yafu. storflyt32 YAFU 2 2015-06-29 23:25
Porting my factorization applet to Android alpertron Programming 2 2013-03-19 11:28
PARI vs GAP skan Miscellaneous Math 0 2012-12-16 00:13
porting Prime95 to GTK+? ixfd64 Software 13 2012-02-21 07:36
Possibly stupid question about porting games to Linux. jasong Linux 4 2006-12-23 21:24

All times are UTC. The time now is 07:37.


Thu Oct 21 07:37:57 UTC 2021 up 90 days, 2:06, 1 user, load averages: 0.89, 1.05, 1.20

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.