Re: macOS building issues after dc9eba0760dedcd3d042a408e715b38ac2222aa3

"Chun Tian (binghe)" <[email protected]>
Newsgroups gmane.lisp.gcl.devel
Organization The Australian National University
Message-ID <[email protected]>
Greetings,

thanks for your explanation about the <stdint.h> issue. I will take a
look at the regexp you mentioned and see if I can provide a patch.

Regarding to external gmp, in my system the GMP library and headers are
installed (through MacPorts) at /opt/local/lib and /opt/local/include. I
think when I'm using GCC 13, these directories are automatically used.
But when I'm compiling with Apple's clang from Xcode, I have to let
clang know these directories. However, the following "standard" way
doesn't help:

export CFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib

With the above environment variables, and with --enable-dynsysgmp when
calling ./configure of GCL, I still got the following error messages
saying system GMP cannot be used:

> checking for gmp.h... yes
> checking for __gmpz_init in -lgmp... yes
> checking for external gmp version... good
> foo.c:1:10: fatal error: 'gmp.h' file not found
> #include "gmp.h"
>          ^~~~~~~
> 1 error generated.
> Cannot use dynamic gmp lib
> checking doing configure in gmp directory... 
> #
> #
> # -------------------
> # Subconfigure of GMP
> #
> #

By looking at your ways of detecting GMP in configure.in:

> if test "$enable_dynsysgmp" != "no" ; then
>     AC_CHECK_HEADERS(
> 	[gmp.h],
> 	[AC_CHECK_LIB(
> 		[gmp],[__gmpz_init],
> 		[AC_MSG_CHECKING([for external gmp version])
> 		 AC_RUN_IFELSE(
> 		     [AC_LANG_PROGRAM(
> 			     [[
> 				 #include <gmp.h>
> 			     ]],
> 			     [[
> 				 #if __GNU_MP_VERSION > 3
> 				 return 0;
> 				 #else
> 				 return -1;
> 				 #endif
> 			     ]])],
> 		     [AC_MSG_RESULT([good])
> 		      TLIBS="$TLIBS -lgmp"
> 		      echo "#include \"gmp.h\"" >foo.c
> 		      echo "int main() {return 0;}" >>foo.c
> 		      MP_INCLUDE=`cpp foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'`
> 		      rm -f foo.c])])])
> 
>     if test "$MP_INCLUDE" = "" ; then
> 	AC_MSG_RESULT([Cannot use dynamic gmp lib])
>     fi
> 
> fi

I think, when the command "cpp foo.c" was getting called, the "cpp"
(from Xcode) program still doesn't know the location of GMP headers,
unless "cpp $CFLAGS" is used instead. My following manual tests
confirmed my guess:

$ echo "#include \"gmp.h\"" >foo.c
$ echo "int main() {return 0;}" >>foo.c
$ cpp foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' | tr -d '"'
foo.c:1:10: fatal error: 'gmp.h' file not found
#include "gmp.h"
         ^~~~~~~
1 error generated.
$ cpp $CFLAGS foo.c | $AWK '/(\/|\\\\)gmp.h/ {if (!i) print $3;i=1}' |
tr -d '"'
/opt/local/include/gmp.h

Therefore, I think you should at least put $CFLAGS inside the above
configure.in code pieces, to handle non-standard position of GMP headers
given by CFLAGS.

P.S. in you macOS Catalina environment, if you have GMP libraries
installed at /usr/local, that must be installed from Homebrew. I suggest
completely removing Homebrew because the installation location of
Homebrew has moved to /opt/ in higher versions of macOS. Its advantage
of staying at the "default" directory (/usr/local) is no more.

Regards,

Chun TIAN

On 08/02/24 02:31, Camm Maguire wrote:
> Greetings, and thannks as always for your feedback.
> 
> "Chun Tian (binghe)" <[email protected]> writes:
> 
>> Greetings,
>>
>> In the commit dc9eba0760dedcd3d042a408e715b38ac2222aa3 [1], I saw   the
>> following line from gcl/h/compbas2.h was removed:
>>
>> diff --git a/gcl/h/compbas2.h b/gcl/h/compbas2.h
>> index 20a2b5c..cc7d87c 100755
>> --- a/gcl/h/compbas2.h
>> +++ b/gcl/h/compbas2.h
>> @@ -10,7 +10,6 @@ EXTER int Rset;
>>
>>  #ifndef U8_DEFINED
>>
>> -#include <stdint.h>
>>
>>  typedef int8_t  i8 ;
>>  typedef int16_t i16;
> 
> This is a step toward securing a fricas build, which on my box at least
> is just about done.  signal.h, from bsdsignal.c, conflicts with my full
> stdint on some symbol containing 'fds', which I do not need.   The
> intent is to extract the needed parts in h/mstdint.h.  This is an
> intermediate file removed by make, but you can look at it with 'make
> h/mstdint.h' from the top level.  Apparently the regexp used there needs
> adjusting for your system.
> 
>> Also note that I had to use GCC 13 instead of clang, because with clang
>> even the GMP building part doesn't success at the linking stage. (My
>> previous successful GCL 2.7.0 build was also based on GCC 13.)
>>
> 
> Good to hear.  I had trouble with gcc13 on Catalina which I did not
> pursue as it would not get me gprof anyway :-(.  I'm using the external
> gmp library which works well -- does this not work for you?  I'm
> thinking of removing the convenience copy of gmp4.
> 
> Take care,
>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEES+aY+4laoC0TwmVKFUkg2jrYR8gFAmXEPOsACgkQFUkg2jrY
R8imag/9FQzTI4zWbw5XOp0i3sWj/8ykMdBkH1t6FUmsZufXqTso2VRxQy9tzcqB
5+8B9Gqp3SIy2SLZiLFdeLrI4ZPD4Ld96zL2VGL0xT5UxSgGyOCMMmMmkNEm1s/Z
hRx2WlP50yMm/ZizwG35p9OXkz/fhydyYX9wDEe3BYNuaP3lVCFhdmW7O0G9nzwl
Zl6RbJG8f5nj+KyITp6grGV0AcKm1C/8dlCM8uK5LKsPY7883IRw5a9SIgDt4MuT
lkigsrAG5qov6dIL0iafYdhblHPp/I3kwjmFoPqUDeyz791EzrZpDxDE2LtniGuX
aCpwaUeWWwisWDYrtEtqgWdbUtBNDStorg0E7Iw4fMJb2ep6zFeMv82+mVdp5YrK
m9gBIfTYqu4BUhTT46vMvpSSnt+Q0JYjuognLTKm3V2edY2pZDCF/Ade9deh1o+o
2MHQvcQGE2Z6BNQ8JBE5q5wieF6Pz0QwxGD2sIOmp/gohtvdY+owVgIkKQE+rpMA
+pbpucqbCOzKMGb6XnihoEHDD7IuU95xCFoQVpRBGh6ejY6pKzl3WOhwgcfL5Q5y
LD6KO+lFHNr1XIfffV3fWD6R0oJ+g+nj1d/+LeAyckywbGRDSBUfb9WmN5TURcza
S6TU3/PDrku7L/aoZTAx7GmSE914+Wlco3SOjjq1zGQWCvEX020=
=SRYU
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.