Building GMPlib on Mac M1

Bjørn Christensen bhc at dyalog.com
Tue Nov 15 20:12:37 CET 2022


 

Have downloaded gmp-6.2.1.

 

It seems that all the tests for different headers are failing eg fcntl.h , float.h

 

Resulting in errors when I make install.

 

set_str.c:132:24: error: implicit declaration of function 'localeconv' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

  const char  *point = GMP_DECIMAL_POINT;

                       ^

../gmp-impl.h:4435:29: note: expanded from macro 'GMP_DECIMAL_POINT'

#define GMP_DECIMAL_POINT  (localeconv()->decimal_point)

                            ^

/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -D__GMP_WITHIN_GMP -I..   -g -m64 -O2 -pedantic -fomit-frame-pointer  -mmacosx-version-min=10.10 -Werror=unguarded-availability -c -o sqrt.lo sqrt.c

set_str.c:132:24: error: member reference type 'int' is not a pointer

  const char  *point = GMP_DECIMAL_POINT;

                       ^~~~~~~~~~~~~~~~~

../gmp-impl.h:4435:43: note: expanded from macro 'GMP_DECIMAL_POINT'

#define GMP_DECIMAL_POINT  (localeconv()->decimal_point)

                            ~~~~~~~~~~~~  ^

/

 

 

Trying to configure with

 

CFLAGS="-g -m64 -O2 -pedantic -fomit-frame-pointer  -mmacosx-version-min=10.10 -Werror=unguarded-availability" ./configure --prefix=/Volumes/devt/users/bhc/tmp/congassl/mac-arm/64 --disable-shared --with-pic ABI=64

 

 

Output:

checking fcntl.h usability... no

checking fcntl.h presence... yes

configure: WARNING: fcntl.h: present but cannot be compiled

configure: WARNING: fcntl.h:     check for missing prerequisite headers?

configure: WARNING: fcntl.h: see the Autoconf documentation

configure: WARNING: fcntl.h:     section "Present But Cannot Be Compiled"

configure: WARNING: fcntl.h: proceeding with the compiler's result

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

configure: WARNING:     ## Report this to gmp-bugs at gmplib.org <mailto:gmp-bugs at gmplib.org>  ##

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

checking for fcntl.h... no

checking float.h usability... no

checking float.h presence... yes

configure: WARNING: float.h: present but cannot be compiled

configure: WARNING: float.h:     check for missing prerequisite headers?

configure: WARNING: float.h: see the Autoconf documentation

configure: WARNING: float.h:     section "Present But Cannot Be Compiled"

configure: WARNING: float.h: proceeding with the compiler's result

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

configure: WARNING:     ## Report this to gmp-bugs at gmplib.org <mailto:gmp-bugs at gmplib.org>  ##

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

checking for float.h... no

checking invent.h usability... no

checking invent.h presence... no

checking for invent.h... no

checking langinfo.h usability... no

checking langinfo.h presence... yes

configure: WARNING: langinfo.h: present but cannot be compiled

configure: WARNING: langinfo.h:     check for missing prerequisite headers?

configure: WARNING: langinfo.h: see the Autoconf documentation

configure: WARNING: langinfo.h:     section "Present But Cannot Be Compiled"

configure: WARNING: langinfo.h: proceeding with the compiler's result

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

configure: WARNING:     ## Report this to gmp-bugs at gmplib.org <mailto:gmp-bugs at gmplib.org>  ##

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

checking for langinfo.h... no

checking locale.h usability... no

checking locale.h presence... yes

configure: WARNING: locale.h: present but cannot be compiled

configure: WARNING: locale.h:     check for missing prerequisite headers?

configure: WARNING: locale.h: see the Autoconf documentation

configure: WARNING: locale.h:     section "Present But Cannot Be Compiled"

configure: WARNING: locale.h: proceeding with the compiler's result

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

configure: WARNING:     ## Report this to gmp-bugs at gmplib.org <mailto:gmp-bugs at gmplib.org>  ##

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

checking for locale.h... no

checking nl_types.h usability... no

checking nl_types.h presence... yes

configure: WARNING: nl_types.h: present but cannot be compiled

configure: WARNING: nl_types.h:     check for missing prerequisite headers?

configure: WARNING: nl_types.h: see the Autoconf documentation

configure: WARNING: nl_types.h:     section "Present But Cannot Be Compiled"

configure: WARNING: nl_types.h: proceeding with the compiler's result

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

configure: WARNING:     ## Report this to gmp-bugs at gmplib.org <mailto:gmp-bugs at gmplib.org>  ##

configure: WARNING:     ## ssssssssssssssssssssssssssssssssss ##

checking for nl_types.h... no

 

Are there any suggestions on how to build gmp 6.2.1 on Mac M1? 

Is this only a problem for me?

 

I have created a small test program that includes the locale.h and that compiles fine. Also I have copied from the config.log the content of confdefs.h and included that with no problems.

 

/bhc

 

PS Notice I have created the confdefs.h from content in config.log.

 

 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: application/octet-stream
Size: 414229 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20221115/c35232c0/attachment-0001.obj>
-------------- next part --------------
#include <stdio.h>
#include <locale.h>
#include "confdefs.h"




int main(int argc, char ** argv)
{
	printf("hello world\n");

	printf("Decimal point %s\n", localeconv()->decimal_point);

	printf("End of world\n");

}
-------------- next part --------------
 /* confdefs.h */
 #define PACKAGE_NAME "GNU MP"
 #define PACKAGE_TARNAME "gmp"
 #define PACKAGE_VERSION "6.2.1"
 #define PACKAGE_STRING "GNU MP 6.2.1"
 #define PACKAGE_BUGREPORT "gmp-bugs at gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html"
 #define PACKAGE_URL "http://www.gnu.org/software/gmp/"
 #define PACKAGE "gmp"
 #define VERSION "6.2.1"
 #define WANT_FFT 1
 #define HAVE_HOST_CPU_aarch64 1
 #define LT_OBJDIR ".libs/"
 /* end confdefs.h.  */
 #include <stdio.h>
 #ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
 #ifdef STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
 # ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
 #ifdef HAVE_STRING_H
 # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
 #ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
 #endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 #include <fcntl.h>


More information about the gmp-bugs mailing list