[cc'ing the libtool list because of the issues marked [LIBTOOL] below; these may or may not already be resolved in more recent libtools - the version included with gmp is 1.5.6 according to ltmain.sh (1.220.2.94)]
I just finished building gmp 4.2.1 under OpenMVS ("370-ibm-openedition", the Unixy subsystem of z/OS). All in all the build was a fairly painless experience (especially compared to trying to compile some GNU tools). However, the testsuite is providing me with headaches... A few platform notes: - the compiler considers missing headers a warning, which breaks many configure tests. So the equivalent of -Werror needs to be used, which is setting the envvar _CC/C89/CXX_ACCEPTABLE_RC to 0 (depending on whether the K&R C/ANSI C/C++ compiler is used) - [LIBTOOL?] there is no separate linker executable, and configure/libtool don't handle this case ('no acceptable LD found in path'), so configure needs to be told LD is $CC (or $CXX if the C++ wrappers are needed). Not a big deal, but it would be nice if this test would fall back on $CC if no separate linker is found. - not all C library functions/declarations are visible by default; configure should ideally be told that CPPFLAGS contains -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED - [LIBTOOL] by default, the compilers require that files come last on the command line, and many versions of libtool (including the one included with GMP) break this rule when configure has determined -c and -o can both be used (it puts the -o last). To work around this, the envvar _CC/C89/CXX_CCMODE needs to be set to 1. - I didn't build the C++ wrappers, but because they use the .cc extension, the _CXX_CXXSUFFIX envvar would need to be set to "cc" to succeed (by default, the compiler only accepts foo.C as a C++ source). - the system compiler does not use IEEE floats/doubles by default (the default is the "base 16 zSeries hexadecimal format"), so configure complains about it (but other than performance, this should not have any impact). Might be useful to mention in the platform notes in the manual that the IEEE format can be selected by adding "-Wc,'float(ieee)'" to CFLAGS (although it would also have to be used for any application using libgmp). Configuring + building gmp takes the better part of the day, so I haven't redone the build with IEEE floats enabled (yet). Build issues encountered: - gmp.h doesn't know about OpenMVS' include guard for stdio (__stdio), so configure warns that FILE prototypes won't be available - easily fixed by adding a test for __stdio to gmp-h.in. - gmp.h doesn't know whether "extern inline" works as needed (and neither do I, so I didn't modify gmp-h.in for this). The warning given by configure ('gmp.h doesnt recognise compiler "__inline"') was rather confusing however (leaving aside the "doesnt" typo which is repeated a few times in acinclude.m4). Perhaps something like "gmp.h doesn't know whether the compiler supports external inlining; inlining disabled" more closely matches the actual situation? - OpenMVS has no obstacks, so the obstack-related functionality in printf is disabled, which is fine. However, so much of the ob*.c sources is #ifdef'ed out that the compilation unit ends up being empty (only config.h is included, and that has only preprocessor stuff). This causes a warning, which due to the required -Werror-like behaviour (see above) stops the build. Simply moving the stdarg/vararg #includes out of the obstack-available test makes things compile smoothly. - [LIBTOOL] MAJOR: The system 'ar' does not store paths, only basenames, and during the (piecewise) link of libgmp.la, multiple files with the same basename are given to ar, resulting in messages like: ar: FSUM9942 "mpn/mul.o" ignored, same basename as "mpq/mul.o". I made a little script that copied all relevant objects to a single directory (replacing / by _ so I got files like mpf_fits_sint.o) in order to easily (re)create a complete libgmp.a. I would consider this a libtool bug; adding the same file (or files with the same basename) to a library multiple times works fine as long as it is not in a single invocation of ar. So perhaps the libtool configury should detect this issue and avoid including multiple files with the same basename during piecewise linking. - [LIBTOOL] During installation, the "libraries have been installed in" message is shown, but the shell's print builtin (used in $echo) shows an error for the line of dashes: print: ./libtool 6200: FSUM6241 Unknown option "--" print: ./libtool 6200: Usage: print [-nprRsu[n]] [arg ...] Preceding the string with -- makes this go away ($echo -- "--..."). Test results: - top-level: 9/9 tests passed - mpn: 9/10 tests passed - mpz: 35/56 tests passed - mpq: 3/11 tests passed - mpf: 20/26 tests passed - rand: 7/7 tests passed - misc: 0/3 tests passed total: 83/122 => 68% passed (not exactly great) Several of the tests seem to run into the limits of the default floating-point system on zSeries. Its exponent is only in the -64..63 range (according to float.h anyway), and it seems to be limited to 248 bits (8 31-bit words). This causes compilation errors (e.g. mpz/t-cmp_d) due to out-of-range floating-point literals, as well as runtime exceptions (e.g. most of the t-get_d tests). I manually adjusted mpn/t-get_d for these limits, but the test still failed: mpn_get_d wrong on random data sign -1 n =0xC6843F29A331B7 nsize 2 exp -45 want =[C3 63 42 1F 94 D1 98 D8] -1588.132710283984 got =[C3 63 42 1F 94 D1 98 DB] -1588.132710283984 CEE5207E The signal SIGABRT was received. I also added #if defined (__MVS__) && !defined(_FP_MODE_VARIABLE) #define LOW_BOUND 1e-64 #define HIGH_BOUND 8e63 #endif to mpf/t-get_d.c (inspired by the VAX settings), which fixed similar compilation issues there, and also lets the test pass (judging by float.h, _FP_MODE_VARIABLE is defined when IEEE floats are enabled). The other major source of errors is that mp_dv_tab.c assumes ASCII while this is an EBCDIC host; and the unfortunate decision to use only 224 positions for base < 36 (instead of 256, or separate tables) means it is not possible to have a 100% working table without adjusting many places in the code (because '0' through '9' are 0xF0 through 0xF9, which falls in the area where the 2 base ranges overlap). Attached is a version of the file that handles both ASCII and EBCDIC; ideally the table should be increased to the full 2x256 size, and the offset used for base >36 changed to 256. It relies on the ability of the preprocessor to compare a character literal against an integer; I'm not sure how portable that is - if it cannot be done this way portably, the best solution would be to have a "gmp_get_digit_value_table(int base)" method that returns the correct table (determining ASCII vs EBCDIC at runtime). With these changes (limits in mpf/t-get_d.c, and EBCDIC-friendly mp_dv_tab.c), the test results change to - top-level: 9/9 tests passed - mpn: 9/10 tests passed - mpz: 53/56 tests passed - mpq: 9/11 tests passed - mpf: 26/26 tests passed - rand: 7/7 tests passed - misc: 0/3 tests passed total: 113/122 => 93% passed (much, much better) The output of the remaining errors is attached.
make[2]: Entering directory `/u/tim/gmp-4.2.1/tests/mpn' mpn_get_d wrong on random data sign -1 n =0xC6843F29A331B7 nsize 2 exp -45 want =[C3 63 42 1F 94 D1 98 D8] -1588.132710283984 got =[C3 63 42 1F 94 D1 98 DB] -1588.132710283984 CEE5207E The signal SIGABRT was received. FAIL: t-get_d make[2]: Entering directory `/u/tim/gmp-4.2.1/tests/mpz' CEE3212S The system detected an exponent-overflow exception (System Completion Code=0CC). From entry point check_onebit at compile unit offset +0000015E at entry offset +0000015E at address 12608C36. FAIL: t-get_d mpz_set_d wrong on 2^53+1 d =[4E 20 00 00 00 00 00 01] 9007199254740993 got =9007199254740992 want =9007199254740993 CEE5207E The signal SIGABRT was received. FAIL: t-set_d CEE3212S The system detected an exponent-overflow exception (System Completion Code=0CC). From entry point __gmpn_get_d at compile unit offset +00000644 at entry offset +00000644 at address 1261818C. FAIL: t-cmp_d make[2]: Entering directory `/u/tim/gmp-4.2.1/tests/mpq' CEE3212S The system detected an exponent-overflow exception (System Completion Code=0CC). From entry point __gmpn_get_d at compile unit offset +000006A4 at entry offset +000006A4 at address 1261E23C. FAIL: t-get_d mpq_get_str wrong (passing NULL) base -16 got "FFFFFFFF" want "ffffffff" q=0xFFFFFFFF CEE5207E The signal SIGABRT was received. FAIL: t-get_str make[2]: Entering directory `/u/tim/gmp-4.2.1/tests/misc' CEE3204S The system detected a protection exception (System Completion Code=0C4). From entry point __gmpz_get_str at compile unit offset +00000064 at entry offset +00000064 at address 1262BDCC. FAIL: t-printf gmp_sscanf wrong result gmp_sscanf wrong upto fmt "%Zd" input "0" ignore 0 ret want=1 got =1 value want=0x0 got =0x-3e7 upto want =1 got =-555 CEE5207E The signal SIGABRT was received. FAIL: t-scanf CEE3204S The system detected a protection exception (System Completion Code=0C4). From entry point __gmpn_mul_basecase at compile unit offset +00000064 at entry offset +00000064 at address 1262AE34. FAIL: t-locale
/* __gmp_digit_value_tab -- support for mp*_set_str THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MP RELEASE. Copyright 2003 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU MP Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "gmp.h" #include "gmp-impl.h" /* Table to be indexed by character, to get its numerical value. Supports both ASCII and EBCDIC. First part of table supports common usages, where 'A' and 'a' have the same value; this supports bases 2..36 At offset 224, values for bases 37..62 start. Here, 'A' has the value 10 (in decimal) and 'a' has the value 36. Note that while for ASCII this takes advantage of an overlap of invalid characters in the two sets of 256 characters, for EBCDIC this has the side effect that for base 36 and above, several control characters are deemed 'acceptable' as digits (0x02 - 0x09 would be treated as equivalent to digits S-Z, and 0x10-0x19 as equivalent to 0-9). */ #define X 0xff #if (' ' == 0x20) /* ASCII */ const unsigned char __gmp_digit_value_tab[] = { X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X, X, X, X, X, X, X,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,X, X, X, X, X, X,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X, X, X, X, X, X, X,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, 25,26,27,28,29,30,31,32,33,34,35,X, X, X, X, X, X,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60,61,X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X }; #elif (' ' == 0x40) /* EBCDIC */ const unsigned char __gmp_digit_value_tab[] = { X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,10,11,12,13,14,15,16,17,18, X, X, X, X, X, X, X,19,20,21,22,23,24,25,26,27, X, X, X, X, X, X, X, X,28,29,30,31,32,33,34,35, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,10,11,12,13,14,15,16,17,18, X, X, X, X, X, X, X,19,20,21,22,23,24,25,26,27, X, X, X, X, X, X, X, X,28,29,30,31,32,33,34,35, X, X, X, X, X, X, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,36,37,38,39,40,41,42,43,44, X, X, X, X, X, X, X,45,46,47,48,49,50,51,52,53, X, X, X, X, X, X, X, X,54,55,56,57,58,59,60,61, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,10,11,12,13,14,15,16,17,18, X, X, X, X, X, X, X,19,20,21,22,23,24,25,26,27, X, X, X, X, X, X, X, X,28,29,30,31,32,33,34,35, X, X, X, X, X, X, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, X, X, X, X, X, X, }; #else #error Only ASCII and EBCDIC character sets are supported. #endif
_______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool