gmp-6.1.2, acinclude.m4, configure
Ralf Gerhauser
Ralf.Gerhauser at gmx.de
Wed Apr 17 07:38:20 UTC 2019
Version: gmp-6.1.2 (non patched)
Issue: ./configure fails on some platforms
Compiler: gcc, tried with gcc-4.8, gcc-5, and gcc-7
Platforms: x86_64 SuSE Leap 42.3 (failed) and x86_64 Lubuntu 18.04 (works)
Patches attached: these are applicable for latest version gmp-6.1.99-20180106, found in file "snapshot" from ftp://gmplib.org/pub/
Dear GMP Team,
I tried to compile gmp-6.1.2 as part of the embedded Linux project openwrt.org, but
this failed during "./configure" on my SuSE Leap 42.3 system:
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking compiler gcc -O2 -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
checking ABI=x32
checking compiler gcc -O2 -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
checking ABI=32
checking compiler gcc -O2 -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include -I/home/rage/Development/OpenWrt/openwrt/staging_dir/host/include ... no, mpn_lshift_com optimization 2, program does not run
configure: error: could not find a working compiler, see config.log for details
Searching this error message on the web only brought some rare hits, e.g.
https://mail-index.netbsd.org/pkgsrc-bugs/2017/01/06/msg061287.html
which usually means there are less people that have this kind of problem.
My second try was to compile it on a Lubuntu 18.04 system. It did, without any problems.
Next I checked the compiler versions: gcc-4.8 on my SuSE system, gcc-7 on the Lubuntu system.
I installed gcc-7 on SuSE - gmp-6.1.2 still failed in the same manner.
I tried older versions of gmp on the SuSE system: gmp-5.0.0, gmp-5.1.3, gmp-6.1.0, gmp-6.1.1
All of them could be configured and compiled without problems.
Next I found and downloaded the file "snapshot" from ftp://gmplib.org/pub/ which unpacks as
version gmp-6.1.99-20180106. I tried to compile this on SuSE, and it worked either.
Comparing gmp-6.1.2/configure with gmp-6.1.99-20180106/configure showed me the usage of calloc()
instead of malloc(). Now I extracted a standalone test program "conftest.c" from the configure
script and modified it to show the buffer content. After some testing, e.g. using malloc()
again, changing step width from 23 to 22 (because 22 was the value in older versions) it also
worked on the SuSE system.
Displaying the buffer content after calling malloc() showed values of 0xBABABABA on the SuSE
system and 0x00000000 on Lubuntu - which explains the initial behaviour.
Conclusions:
- The increment within the for-loop should be 22 instead of 23, otherwise the location
2048 (0x800) will never be reached (see pictures of comparison 22 versus 23).
- A calloc() instead of malloc() doesn't really solve the problem because the check
whether area 2048..2054 is not zero requires this area to be initialized with a value
other than zero - and later be set to zero by lshift_com() which writes 8 long words
per call. So malloc() should be sufficient, memset() could be used to initialize the
buffer. I always use 0x3F, which is ASCII character '?'.
Attachments:
22_vs_23_a.png - using "22" reaches offset 0x0807, using "23" terminates loop before reaching it
22_vs_23_b.png - shows buffer at location 0x0800 (2048) where the pass/fail test happens
conftest.c - little program to show buffer content and test 22 versus 23 when changed
acinclude.m4.patch - changes for "acinclude.m4"
configure.patch - changes for "configure"
Thank you in advance!
Best regards,
Ralf Gerhauser
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 22_vs_23_a.png
Type: image/png
Size: 324451 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20190417/52033014/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 22_vs_23_b.png
Type: image/png
Size: 145878 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20190417/52033014/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acinclude.m4.patch
Type: text/x-patch
Size: 677 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20190417/52033014/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20190417/52033014/attachment-0003.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: conftest.c
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20190417/52033014/attachment-0001.c>
More information about the gmp-bugs
mailing list