-
Notifications
You must be signed in to change notification settings - Fork 195
Successes and Failures of Building LibTomMath
LibTomMath builds with a lot of compilers on a lot of architectures but not in every combination possible and not always out of the box. Test-base is LibTomMath version 1.1.0 with some floating point operations on top (get/set float, double, and long double) to evaluate the usability of the FPU, if available, on the tested platform. The architectures were emulated with qemu version 3.1.0. unless stated otherwise.
-
amd64 (hardware)
-
ARM926EJ-S rev 5 (v5l)
- Debian 8.11 (jessie)
Out of the box. This is a system with `double == long double`.$ cat dbl_print.c #include #include #include
int main (void) { printf("%d == %d %d == %d\n", LDBL_MANT_DIG, DBL_MANT_DIG, LDBL_MAX_EXP, DBL_MAX_EXP); exit(EXIT_SUCCESS); } $ ./dbl_print 53 == 53 1024 == 1024 $ uname -a Linux debian 3.16.0-6-versatile #1 Debian 3.16.57-2 (2018-07-14) armv5tejl GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie $ cat /proc/cpuinfo processor : 0 model name : ARM926EJ-S rev 5 (v5l) BogoMIPS : 500.22 Features : swp half thumb fastmult vfp edsp java CPU implementer : 0x41 CPU architecture: 5TEJ CPU variant : 0x0 CPU part : 0x926 CPU revision : 5
Hardware : ARM-Versatile PB Revision : 0000 Serial : 0000000000000000
- Debian 8.11 (jessie)
-
Sparc64
- Debian sid (buster)
cpu : TI UltraSparc IIi (Sabre) fpu : UltraSparc IIi integrated FPU pmu : ultra12 prom : OBP 3.10.24 1999/01/01 01:01 type : sun4u ncpus probed : 1 ncpus active : 1 D$ parity tl1 : 0 I$ parity tl1 : 0 Cpu0ClkTck : 0000000005f5e100 cpucaps : flush,stbar,swap,muldiv,v9,mul32,div32,v8plus,vis MMU Type : Spitfire MMU PGSZs : 8K,64K,512K,4MB $ uname -a Linux debiansparc64 4.15.0-2-sparc64 #1 Debian 4.15.11-1 (2018-03-20) sparc64 GNU/Linux $ gcc -dM -E -x c /dev/null | grep BYTE_ORDER #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ $ gcc -dM -E -x c /dev/null | grep LDBL #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L #define __LDBL_MAX_EXP__ 16384 #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_HAS_DENORM__ 1 #define __LDBL_DECIMAL_DIG__ 36 #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L #define __LDBL_MANT_DIG__ 113 #define __LDBL_MIN_EXP__ (-16381) #define __LDBL_MAX_10_EXP__ 4932 #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L #define __LDBL_MIN_10_EXP__ (-4931) #define __LDBL_DIG__
- OpenBSD 6.4
The static library builds but the shared library needs both `gmake` and the GNU `libtool` installed. The wrong `make` will result in a lot of errors of the kind:*** Parse error in /home/user/GITHUB/libtommath: Need an operator in 'LIBNAME' ) *** Parse error: Need an operator in 'endif' (makefile.shared:8) *** Parse error: Need an operator in 'CROSS_COMPILE' (makefile_include.mk:16) *** Parse error: Need an operator in 'endif' (makefile_include.mk:18) *** Parse error: Missing dependency operator (makefile_include.mk:22) *** Parse error: Missing dependency operator (makefile_include.mk:23)
The wrong libtool gives this error at linking time:
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo... libtool --mode=link --tag=CC cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_mo libtool: link: cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_montgomery_reduce0 bn_error.lo: file not recognized: File format not recognized cc: error: linker command failed with exit code 1 (use -v to see invocation) Error while executing cc bn_error.lo bn_fast_mp_invmod.lo bn_fast_mp_montgomery0 gmake: *** [makefile.shared:64: libtommath.la] Error 1
As a little extra gift the GNU libtool and the build-in libtool are both named
libtool
. If those two packets have been installed bysudo pkg_add gmake libtool
the GNU libtool will be placed in/usr/local/bin/
and the native version in/usr/bin/
. To be sure ask the programs (actual version numbers may differ, of course):$ /usr/local/bin/libtool --version libtool (GNU libtool) 2.4.2 Written by Gordon Matzigkeit , 1996 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ libtool --version libtool (not (GNU libtool)) 1.5.26
The shared library should build now with the command
LIBTOOL="/usr/local/bin/libtool" gmake -f makefile.shared
- Debian sid (buster)
-
M68K Atari Falcon (Aranym 1.0.2 emulating a M68040 with MMU and FPU)
- Debian on a pre-made image
Out of the box
- Debian on a pre-made image
-
MIPS (32-bit big-endian)
- Debian 9.8.0 (stretch)
$ cat /proc/cpuinfo system type : MIPS Malta machine : mti,malta processor : 0 cpu model : MIPS 24Kc V0.0 FPU V0.0 BogoMIPS : 688.12 wait instruction : yes microsecond timers : yes tlb_entries : 16 extra interrupt vector : yes hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : mips16 shadow register sets : 1 kscratch registers : 0 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available $ uname -a Linux debianmips32 4.9.0-8-4kc-malta #1 Debian 4.9.144-3.1 (2019-02-19) mips GNU/Linux $ gcc -dM -E -x c /dev/null | grep BYTE_ORDER #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ $ gcc -dM -E -x c /dev/null | grep LDBL #define __LDBL_MAX__ 1.7976931348623157e+308L #define __LDBL_MAX_EXP__ 1024 #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_MIN__ 2.2250738585072014e-308L #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_HAS_DENORM__ 1 #define __LDBL_EPSILON__ 2.2204460492503131e-16L #define __LDBL_MANT_DIG__ 53 #define __LDBL_MIN_EXP__ (-1021) #define __LDBL_MAX_10_EXP__ 308 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L #define __LDBL_MIN_10_EXP__ (-307) #define __LDBL_DIG__ 15
- Debian 9.8.0 (stretch)
-
S390x
- Debian 9.8.0 (stretch)
user@debians390x:~/GITHUB/libtommath$ cat /proc/cpuinfo vendor_id : IBM/S390 # processors : 1 bogomips per cpu: 13370.00 max thread id : 0 features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs processor 0: version = 00, identification = 000000, machine = 2827 user@debians390x:~/GITHUB/libtommath$ uname -a Linux debians390x 4.9.0-8-s390x #1 SMP Debian 4.9.144-3.1 (2019-02-19) s390x GNU/Linux user@debians390x:~/GITHUB/libtommath$ gcc -dM -E -x c /dev/null | grep BYTE_ORDER #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ user@debians390x:~/GITHUB/libtommath$ gcc -dM -E -x c /dev/null | grep LDBL #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L #define __LDBL_MAX_EXP__ 16384 #define __LDBL_HAS_INFINITY__ 1 #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L #define __LDBL_HAS_QUIET_NAN__ 1 #define __LDBL_HAS_DENORM__ 1 #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L #define __LDBL_MANT_DIG__ 113 #define __LDBL_MIN_EXP__ (-16381) #define __LDBL_MAX_10_EXP__ 4932 #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L #define __LDBL_MIN_10_EXP__ (-4931) #define __LDBL_DIG__ 33
- Debian 9.8.0 (stretch)
-
x86 (hardware)
- Debian Versions 8 (jessie) to 10 (buster)
Out of the box.
- Debian Versions 8 (jessie) to 10 (buster)
-
x86_64 (hardware)
- Debian Versions 8 (jessie) to 10 (buster)
Out of the box
- Debian Versions 8 (jessie) to 10 (buster)
- GCC
- clang
Versions greater than 7 with optimizations greater than-O0
need a newer version of Valgrind. Version 3.14.0 works, newer ones are recommended. Version 3.13.0, which does not work is in Ubuntu "bionic", 3.15.0 in Ubuntu "focal" and 3.16.1 is in Ubuntu "groovy". - Intel compiler ICC version used was 19.0.2.187 20190117
The makefiles assume a GCC compatible compiler which ICC is. Mostly. Just do a `CC=/path/to/bin/icc make` to build the static and CC=/path/to/bin/icc make -f makefile.shared` to build the shared library.It does not support two of GCC's diagnostic options used to build LibTomMath and complains with
icc: command line warning #10148: option '-Wbad-function-cast' not supported icc: command line warning #10148: option '-Wcast-align' not supported
To suppress this warnings use the option
-diag-disable=10006
. Although it is not really the best advise to switch warnings off it does no harm here, the GCC diagnostics just get ignored.