mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Linux (https://www.mersenneforum.org/forumdisplay.php?f=39)
-   -   Compile Linux version for PFGW (https://www.mersenneforum.org/showthread.php?t=22018)

carpetpool 2017-02-08 09:25

Compile Linux version for PFGW
 
The Windows version, it is the newest version of [URL="https://sourceforge.net/projects/openpfgw/files/?source=navbar"]PFGW[/URL]. The Linux version is outdated by half a year. Is someone able to compile a Linux version of the newest version of PFGW which is 3.8.3? Thanks to someone who is advanced at Linux and can do it, I am just a beginner at it for now. I can spare CPUs on my upgraded Linux computer as I cannot for Windows. The upgrade to PFGW is listed in [URL="http://www.mersenneforum.org/showthread.php?t=21779"]this[/URL] thread. :smile:

nordi 2017-02-08 21:04

I gave it a try. First, the source code needs a bit of adjustment to compile:


[CODE]--- pform/pfio/pfdecimalfile.cpp (revision 642)
+++ pform/pfio/pfdecimalfile.cpp (working copy)
@@ -2,6 +2,7 @@
#include "pfiopch.h"
#include <stdio.h>
#include <string.h>
+#include <ctype.h>

// also includes pffile.h but defines PFNewPGenFile class which is needed for the openInputFile() function.
#include "pfnewpgenfile.h"
[/CODE]Without that, it complains about isdigit() not being defined.

But then, "make" still fails with

[CODE]g++ -O3 -m64 -DX86_64 -D_64BIT -I../../packages/gmp/64bit -I../../pfconfig/headers \
pform/pfgw/.libs/pfgw_main.a pform/pfio/.libs/pfio.a pform/pfoo/.libs/pfoo.a pform/pfgwlib/.libs/pfgwlib.a \
pform/pfmath/.libs/pfmath.a pform/pflib/.libs/pflib.a \
packages/gmp/64bit/libgmp.a packages/gwnum/64bit/gwnum.a -Wl,-no_pie -lpthread -lstdc++ -o pfgw64
g++: error: packages/gmp/64bit/libgmp.a: No such file or directory
g++: error: packages/gwnum/64bit/gwnum.a: No such file or directory
makefile:8: recipe for target 'pfgw64' failed[/CODE]
These packages are not fetched/built by the makefile.

rogue 2017-02-08 21:26

You need to build gwnum and gmp on your own and move the libraries to the correct folders in order for it to build. Fortunately that should be fairly easy to do.

If you can point me to the correct source file for isdigit(), I can add it to the source. I have a couple of pending changes that I haven't committed yet so I will include it with those.

paulunderwood 2017-02-08 21:40

After installing gwnum.a and libgmp.a, and adding "#include <ctype.h>", my make gets me to:

[CODE]g++ -O3 -m64 -DX86_64 -D_64BIT -I../../packages/gmp/64bit -I../../pfconfig/headers \
pform/pfgw/.libs/pfgw_main.a pform/pfio/.libs/pfio.a pform/pfoo/.libs/pfoo.a pform/pfgwlib/.libs/pfgwlib.a \
pform/pfmath/.libs/pfmath.a pform/pflib/.libs/pflib.a \
packages/gmp/64bit/libgmp.a packages/gwnum/64bit/gwnum.a -Wl,-no_pie -lpthread -lstdc++ -o pfgw64
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
makefile:8: recipe for target 'pfgw64' failed
make: *** [pfgw64] Error 1
[/CODE] :down:

nordi 2017-02-08 22:03

[QUOTE=rogue;452554]If you can point me to the correct source file for isdigit()[/QUOTE]isdigit() is already there, you just need to include it as shown in the diff.

@paulunderwood: Do you have some commands I can run? I'm trying to automate the build using a Docker container. So far, my Dockerfile is still quite modest:

[CODE]FROM gcc
RUN apt-get update && apt-get install -y libgmp-dev
COPY . /usr/src/openpfgw
WORKDIR /usr/src/openpfgw
RUN make
[/CODE]

paulunderwood 2017-02-08 22:09

I get libgmp.a from a recent installation of the latest GMP, and gwnum.a from compiling mprime -- so I guess you can wget it and make it to get GWNUM. HTH. :smile:

nordi 2017-02-08 22:36

I did get the libgmp.a, but cannot compile mprime:

[CODE]
/usr/src/mprime/linux64# make
[ ! -e ../security.h ] && touch ../security.h || true
[ ! -e ../security.c ] && touch ../security.c || true
[ ! -e ../secure5.c ] && touch ../secure5.c || true
gcc -I.. -I../gwnum -I/usr/local/include -DX86_64 -O2 -c prime.c
gcc -I.. -I../gwnum -I/usr/local/include -DX86_64 -O2 -c menu.c
make: *** No rule to make target 'factor64.o', needed by 'mprime'. Stop.
[/CODE]

paulunderwood 2017-02-08 22:42

Please try [c]make[/c] in the gwnum directory.

[code]/Downloads/p95/gwnum$ make -f make64
gcc -I.. -DX86_64 -O2 -c cpuid.c
gcc -I.. -DX86_64 -O2 -c gwnum.c
gcc -I.. -DX86_64 -O2 -c gwtables.c
gcc -I.. -DX86_64 -O2 -c gwthread.c
gcc -I.. -DX86_64 -O2 -c gwini.c
gcc -I.. -DX86_64 -O2 -c gwutil.c
g++ -I.. -I../qd -DX86_64 -O2 -c gwdbldbl.cpp
gcc -I.. -DX86_64 -O2 -c giants.c
gcc -I.. -DX86_64 -O2 -c ecmstag1.c
cp linux64/gwnum.a .
ar -rs gwnum.a cpuid.o gwnum.o gwtables.o gwthread.o gwini.o gwutil.o gwdbldbl.o giants.o ecmstag1.o
[/code]

nordi 2017-02-08 23:06

[QUOTE=paulunderwood;452563]Please try [c]make[/c] in the gwnum directory.[/QUOTE]
I also tried this, it also failed:

[CODE]/usr/src/mprime/gwnum# make -f make64
gcc -I.. -DX86_64 -O2 -c cpuid.c
gcc -I.. -DX86_64 -O2 -c gwnum.c
gcc -I.. -DX86_64 -O2 -c gwtables.c
gcc -I.. -DX86_64 -O2 -c gwthread.c
gcc -I.. -DX86_64 -O2 -c gwutil.c
g++ -I.. -I../qd -DX86_64 -O2 -c gwdbldbl.cpp
gcc -I.. -DX86_64 -O2 -c giants.c
gcc -I.. -DX86_64 -O2 -c ecmstag1.c
cp linux64/gwnum.a .
cp: cannot stat 'linux64/gwnum.a': No such file or directory
make64:19: recipe for target 'gwnum.a' failed
make: *** [gwnum.a] Error 1
[/CODE]Funny part is: There's not even a "linux64" directory in this directory. There's a linux64 directory at the top level of the project, but it also does not contain gwnum.a.

nordi 2017-02-08 23:13

Thanks for posting the example output! Turns out the repo on Github was missing a file. So far, it works now.

paulunderwood 2017-02-08 23:19

[QUOTE=nordi;452567]I also tried this, it also failed:

[CODE]/usr/src/mprime/gwnum# make -f make64
gcc -I.. -DX86_64 -O2 -c cpuid.c
gcc -I.. -DX86_64 -O2 -c gwnum.c
gcc -I.. -DX86_64 -O2 -c gwtables.c
gcc -I.. -DX86_64 -O2 -c gwthread.c
gcc -I.. -DX86_64 -O2 -c gwutil.c
g++ -I.. -I../qd -DX86_64 -O2 -c gwdbldbl.cpp
gcc -I.. -DX86_64 -O2 -c giants.c
gcc -I.. -DX86_64 -O2 -c ecmstag1.c
cp linux64/gwnum.a .
cp: cannot stat 'linux64/gwnum.a': No such file or directory
make64:19: recipe for target 'gwnum.a' failed
make: *** [gwnum.a] Error 1
[/CODE]Funny part is: There's not even a "linux64" directory in this directory. There's a linux64 directory at the top level of the project, but it also does not contain gwnum.a.[/QUOTE]

I just downloaded p95v2810.source.zip and [c]zipinfo[/c] gives

[CODE]
.....
drwx--- 6.3 fat 102 bx stor 16-Oct-30 14:42 gwnum/linux64/
-rw---- 6.3 fat 35851474 bx defN 16-Oct-30 10:33 gwnum/linux64/gwnum.a
-rw---- 6.3 fat 30960362 bx defN 16-Oct-30 10:32 gwnum/linux/gwnum.a
.....
[/CODE]


All times are UTC. The time now is 14:18.

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