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]>
Now I modified configure.in and re-generated the "configure" (by the
same version of autoconf), but during the building process I saw another
error message regarding the missing of gmp.h:

> gcc -E -I../h foo.c | sed -n -e '/#/d' -e '/DO_/d' -e '/[a-zA-Z;]/p' > tmpini
> ../xbin/move-if-changed mv tmpini ../h/new_decl.h
> tmpini and ../h/new_decl.h were not the same.
> ln tmpini ../h/new_decl.h
> rm -f foo.c tmpini
> rm symbol.c list.c string.c hash.c character.c gcl_readline.c sequence.c print.c read.c pathname.c file.c package.c
> gawk 'BEGIN {print "#include \"include.h\"";print "#include \"page.h\"";print "---"} {a=$1;gsub("\\.\\.\\.","",a);print "\"#define " $1 "\" " a}' h/compdefs.h |\
> 	gcc -E -P -I./h/ - |\
> 	gawk '/^\-\-\-$/ {i=1;next} {if (!i) next} {gsub("\"","");print}' >h/mcompdefs.h
> In file included from <stdin>:1:
> In file included from ./h/include.h:92:
> ./h/../h/mp.h:5:10: fatal error: 'gmp.h' file not found
> #include "gmp.h"
>          ^~~~~~~
> 1 error generated.
> echo "#include <stdint.h>" | gcc -E -I./h/ - | gawk '/_u?int/ {print}' >h/mstdint.h
> cp h/mcompdefs.h cmpinclude.h
> cat h/cmpincl1.h h/gclincl.h h/compbas.h h/type.h h/mgmp.h h/lu.h h/globals.h  h/vs.h h/bds.h h/frame.h h/lex.h h/mstdint.h h/compbas2.h h/compprotos.h  h/immnum.h | gcc -E -I./h/ - | gawk '/^# |^$|^#pragma/ {next}{print}' >> cmpinclude.h
> cat h/cmponly_last.h >>cmpinclude.h
> ./xbin/move-if-changed mv cmpinclude.h h/cmpinclude.h
> cmpinclude.h and h/cmpinclude.h were not the same.
> ln cmpinclude.h h/cmpinclude.h
> ./xbin/move-if-changed cp h/cmpinclude.h o/cmpinclude.h
> h/cmpinclude.h and o/cmpinclude.h were not the same.
> ln h/cmpinclude.h o/cmpinclude.h

But this time I can't figure out where to fix...

--Chun

On 08/02/24 13:31, Chun Tian (binghe) wrote:
> 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+4laoC0TwmVKFUkg2jrYR8gFAmXEQssACgkQFUkg2jrY
R8jAbxAAlvhybB1tQDGw4jRIDFxDng9k1H+ncRLR47p1DxoAbUsykUDHAWXXk3bg
D4p2SwW0bg9oF06svNF1i3TSN4ELDK4fVQslNNqDnovlx+Vzc9vTDxAzGh+rBLFC
9UZtrU1aogoDXKagekCqwZWBkoDy1/Kl9in4/VAEXRL454i3sO7YBsrHKGBWLw4F
AmoalfidiXNCFsAylKqEc8l5KEMcK03d7p+8s8r0Usjjrm+IShfzlFxIegLBh7ju
NCZVshBjvLZRmjK/CkwBp/jl0VrLM15N1PPWyWBEo/7Q+umLSsmHAAS7FqGZqw5m
FTiRS12q/3/2OLm938cxGG1FODAdXEq3dnyl5UE/W0hn7SlsYo+ute9oMqCkkmIg
Hcppo+EcoXLZO/En2YS6VSa828p/ESzn6LHaZWVmspyMsfmMGhAurpnd7TJYt/Ki
Z7YIKqp4s9O7ocC0aP6vhEiH9n4Sv3MuBQhSqWWpxnk6L28C9fziFA9IePcy7pG8
pA9zB+6hd+boAYaafU5qryEvjJXMsGUljulyZ35i4H7gspHHo+3F0vIqIBEZuOyC
VImYSUzBbuRTOJf0BMhrnWSnouknFkJadZlXNESI/8FwECpuUQL051DegDRck/Xy
Ow2ERN7sh9QuU9oJP6poWYAGvRzrm+upllVDJoy3SveSYY/qDFE=
=3Cak
-----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.