A problem on building libgmp on WSL and a solution for it

Kai Takahashi / 高橋海 www.carrotsoft at gmail.com
Sat Aug 1 05:17:55 UTC 2020


Dear gmp developers,

Hello. I'm Kai Takahashi.
This is my first post to this ML.
I found it impossible to build gmp on WSL in current implementation.
To build gmp on WSL, I edited Makefile.am and  acinclude.m4.
If you don't mind, could you merge the patch below?

---
# HG changeset patch
# User Kai Takahashi <www.carrotsoft at gmail.com>
# Date 1596258366 -32400
#      Sat Aug 01 14:06:06 2020 +0900
# Branch patch-wsl
# Node ID 2ad84eb68651064d1dc0fb86890e8ab0ae27d6bd
# Parent  c5d0fcb069696e02aeff5b64108cd3ba299bf181
Execute <executable>.exe in Windows.

diff -r c5d0fcb06969 -r 2ad84eb68651 Makefile.am
--- a/Makefile.am Sat Jul 04 23:15:41 2020 +0200
+++ b/Makefile.am Sat Aug 01 14:06:06 2020 +0900
@@ -344,7 +344,7 @@
 EXTRA_DIST += bootstrap.c

 fac_table.h: gen-fac$(EXEEXT_FOR_BUILD)
- ./gen-fac $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fac_table.h || (rm -f
fac_table.h; exit 1)
+ ./gen-fac$(EXEEXT_FOR_BUILD) $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>fac_table.h || (rm -f fac_table.h; exit 1)
 BUILT_SOURCES += fac_table.h

 gen-fac$(EXEEXT_FOR_BUILD): gen-fac$(U_FOR_BUILD).c bootstrap.c
@@ -354,11 +354,11 @@


 fib_table.h: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f
fib_table.h; exit 1)
+ ./gen-fib$(EXEEXT_FOR_BUILD) header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>fib_table.h || (rm -f fib_table.h; exit 1)
 BUILT_SOURCES += fib_table.h

 mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm
-f mpn/fib_table.c; exit 1)
+ ./gen-fib$(EXEEXT_FOR_BUILD) table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
 BUILT_SOURCES += mpn/fib_table.c

 gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c bootstrap.c
@@ -368,11 +368,11 @@


 mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm
-f mp_bases.h; exit 1)
+ ./gen-bases$(EXEEXT_FOR_BUILD) header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>mp_bases.h || (rm -f mp_bases.h; exit 1)
 BUILT_SOURCES += mp_bases.h

 mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c ||
(rm -f mpn/mp_bases.c; exit 1)
+ ./gen-bases$(EXEEXT_FOR_BUILD) table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
 BUILT_SOURCES += mpn/mp_bases.c

 gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c bootstrap.c
@@ -382,7 +382,7 @@


 trialdivtab.h: gen-trialdivtab$(EXEEXT_FOR_BUILD)
- ./gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f
trialdivtab.h; exit 1)
+ ./gen-trialdivtab$(EXEEXT_FOR_BUILD) $(GMP_LIMB_BITS) 8000 >trialdivtab.h
|| (rm -f trialdivtab.h; exit 1)
 BUILT_SOURCES += trialdivtab.h

 gen-trialdivtab$(EXEEXT_FOR_BUILD): gen-trialdivtab$(U_FOR_BUILD).c
bootstrap.c
@@ -392,7 +392,7 @@


 mpn/jacobitab.h: gen-jacobitab$(EXEEXT_FOR_BUILD)
- ./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
+ ./gen-jacobitab$(EXEEXT_FOR_BUILD) >mpn/jacobitab.h || (rm -f
mpn/jacobitab.h; exit 1)
 BUILT_SOURCES += mpn/jacobitab.h

 gen-jacobitab$(EXEEXT_FOR_BUILD): gen-jacobitab$(U_FOR_BUILD).c
@@ -402,7 +402,7 @@


 mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD)
- ./gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f
mpn/perfsqr.h; exit 1)
+ ./gen-psqr$(EXEEXT_FOR_BUILD) $(GMP_LIMB_BITS) $(GMP_NAIL_BITS)
>mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
 BUILT_SOURCES += mpn/perfsqr.h

 gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c bootstrap.c
diff -r c5d0fcb06969 -r 2ad84eb68651 acinclude.m4
--- a/acinclude.m4 Sat Jul 04 23:15:41 2020 +0200
+++ b/acinclude.m4 Sat Aug 01 14:06:06 2020 +0900
@@ -3904,7 +3904,7 @@
 for i in .exe ,ff8 ""; do
   gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i"
   if AC_TRY_EVAL(gmp_compile); then
-    if (./conftest) 2>&AC_FD_CC; then
+    if (./conftest$i) 2>&AC_FD_CC; then
       gmp_cv_prog_exeext_for_build=$i
       break
     fi
---

Sincerely,
Kai Takahashi


More information about the gmp-discuss mailing list