Bill Allombert on Mon, 20 Jan 2025 20:33:25 +0100


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

Re: compilation of static binaries for Linux & Windows


On Mon, Jan 20, 2025 at 08:06:24PM +0100, Beckert wrote:
> Hello,
> 
> I want to distribute GP scripts to many hosts. For this I need static linked binaries, to have less prerequisites for
> the hosts.
> 
> Linux:
> 
> I compile pari/gp for Linux and got a version, where pari is static linked, but not the other libs and the binary itself
> is also static.
> 
> ESPRIMO-Mobile-U9200 ~/pari/pari $ ldd Olinux-x86_64/gp-sta
>     linux-vdso.so.1 (0x00007ffcd7bd5000)
>     libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007b6181c91000)
>     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007b6180f19000)
>     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007b6180c00000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007b6181d2a000)
> ESPRIMO-Mobile-U9200 ~/pari/pari $
> 
> As far as I know it has to be compiled with -static and linked with --static -static-libgcc.
> Any idea, how I can pass this through Configure?

Sure, do

CFLAGS=-static LDFLAGS='--static -static-libgcc' ./Configure -s 

> Windows:
> 
> I also need a static linked version for Windows. The provided binaries for Windows are dynamically linked and pari is a DLL.
> Can a static version be provided?

They are available there:
<https://pari.math.u-bordeaux.fr/pub/pari/windows/>
For example:
<https://pari.math.u-bordeaux.fr/pub/pari/windows/gp64-2-17-1.exe>

> Or with which environment should pari/gp be compiled?

I use mingw64 on Linux.

Cheers,
Bill