Re: Branch Version_2_7_0pre

"Kirill A. Korinsky" <[email protected]>
Newsgroups gmane.lisp.gcl.devel
Message-ID <[email protected]>
I've used f123e3d0df9201082c9168671e103dd8835cb81f as local root.

1. ./configure still doesn't work well with readline and failed like this:

checking for rl_completion_matches in -lreadline... yes
checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_FUNCTION... no
checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_RL_COMPENTRY_FUNC_T... no
configure: error: Unknown rl_completion_entry_function return type

I've attached a patch which I've used to bypass it.

2. anyway, gprof aren't disabled completley; build failed with error:

error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: ../o/gprof.o is not an object file (not allowed in a library)
make[1]: *** [libpre_gcl.a] Error 1

and here the second patch attached.

3. after that build failed like this:

>;; Loading "boot.lisp"
;; Compiling /opt/local/var/macports/build/_Users_catap_src_macports-ports_lang_gcl/gcl-devel/work/.tmp/gazonk_9510_0.lsp.
;; End of Pass 1.
;; End of Pass 2.

Error: ERROR "Caught fatal error [memory may be damaged]: Segmentation violation."
Signalled by MULTIPLE-VALUE-BIND.
Segmentation violation: c stack ok:signalling errorERROR "Caught fatal error [memory may be damaged]: Segmentation violation."

Broken at LET*.  Type :H for Help.
    1  Return to top level.
COMPILER>>make: *** [unixport/saved_gcl0] Error 255

and if I apply patch https://github.com/macports/macports-ports/blob/master/lang/gcl/files/fix-memory-corruption-on-macOS.patch <https://github.com/macports/macports-ports/blob/master/lang/gcl/files/fix-memory-corruption-on-macOS.patch> it start to build.

The build was for about two hours with output like:

OPTIMIZE levels: Safety=3, Space=0, Speed=3
;; Finished compiling /opt/local/var/macports/build/_Users_catap_src_macports-ports_lang_gcl/gcl-devel/work/f123e3d0df9201082c9168671e103dd8835cb81f/gcl/lsp/gcl_c.o.
real time       :     35.360 secs
run-gbc time    :     27.820 secs
child run time  :      0.200 secs
gbc time        :      0.000 secs
;; Compiling ../lsp/gcl_listlib.lsp.
[GC for 85 STRUCTURE pages..(T=304).GC finished]
[GC for 4171976 CONS pages..(T=273).GC finished]
[GC for 85 STRUCTURE pages..(T=338).GC finished]
[GC for 86 STRUCTURE pages..(T=241).GC finished]
[GC for 97 STRUCTURE pages..(T=257).GC finished]
[GC for 1653 RELOCATABLE-BLOCKS pages..(T=227).GC finished]
[GC for 119 STRUCTURE pages..(T=223).GC finished]
[GC for 130 STRUCTURE pages..(T=244).GC finished]
[GC for 143 STRUCTURE pages..(T=327).GC finished]
[GC for 154 STRUCTURE pages..(T=299).GC finished]
[GC for 164 STRUCTURE pages..(T=265).GC finished]
[GC for 173 STRUCTURE pages..(T=258).GC finished]
;; End of Pass 1.
[GC for 4171976 CONS pages..(T=241).GC finished]
[GC for 1653 RELOCATABLE-BLOCKS pages..(T=244).GC finished]
[GC for 4171976 CONS pages..(T=383).GC finished]
[GC for 4171976 SPICE pages..(T=268).GC finished]
[GC for 4171976 CONS pages..(T=237).GC finished]
;; End of Pass 2.
OPTIMIZE levels: Safety=3, Space=0, Speed=3
;; Finished compiling /opt/local/var/macports/build/_Users_catap_src_macports-ports_lang_gcl/gcl-devel/work/f123e3d0df9201082c9168671e103dd8835cb81f/gcl/lsp/gcl_listlib.o.
real time       :   1256.190 secs
run-gbc time    :    921.810 secs
child run time  :      2.860 secs
gbc time        :     46.290 secs
;; Compiling ../lsp/gcl_predlib.lsp.

I think that increase memory usage may speed up build, am I wrong?

Anyway, the build failed with error:

real time       :      4.590 secs
run-gbc time    :      3.200 secs
child run time  :      1.100 secs
gbc time        :      0.000 secs
;; Compiling ../lsp/gcl_mnum.lsp.

Error: ERROR "There is no package with the name \"libc\"."
Fast links are on: do (si::use-fast-links nil) for debugging
Signalled by MULTIPLE-VALUE-CALL.
ERROR "There is no package with the name \"libc\"."

Broken at FUNCALL.  Type :H for Help.
    1  Return to top level.
SYSTEM>>make: *** [unixport/saved_gcl0] Error 255

Thus, the patch about memory corruption contains two hunk. Without the second one build failed as (3), and I've just tested it

>;; Loading "boot.lisp"
;; Compiling /opt/local/var/macports/build/_Users_catap_src_macports-ports_lang_gcl/gcl-devel/work/.tmp/gazonk_25122_0.lsp.
;; End of Pass 1.
;; End of Pass 2.

Error: ERROR "Caught fatal error [memory may be damaged]: Segmentation violation."
Signalled by MULTIPLE-VALUE-BIND.
Segmentation violation: c stack ok:signalling errorERROR "Caught fatal error [memory may be damaged]: Segmentation violation."

Broken at LET*.  Type :H for Help.
    1  Return to top level.
COMPILER>>make: *** [unixport/saved_gcl0] Error 255
rm h/mcompdefs.h

and without the first one, if I recall right, it's failed near the similar way but at the end, when it saves the image.

--
wbr, Kirill



> On 22. Dec 2023, at 00:25, Camm Maguire <[email protected]> wrote:
> 
> Greetings, and thanks so much!  I think master should now address these
> issues.  Please keep me informed.
> 
> Take care,
> 
> "Kirill A. Korinsky" <[email protected]> writes:
> 
>> With a few hacks (see attached patches) I was able to build it on macOS 12.
>> 
>> Anyway, it failed on start as:
>> 
>> cp init_raw.lsp foo
>> echo "(unless si::*quit-tags* (in-package \"USER\")(system:save-system \"saved_pre_gcl\"))" >>foo
>> ar x libpre_gcl.a $(ar t libpre_gcl.a |grep ^gcl_)
>> /Users/catap/src/gcl/gcl/unixport/raw_pre_gcl /Users/catap/src/gcl/gcl/unixport/ -libdir /Users/catap/src/gcl/gcl/ < foo
>> GCL (GNU Common Lisp)  April 1994  9465290 pages
>> Building symbol table for /Users/catap/src/gcl/gcl/unixport/raw_pre_gcl ..
>> loading /Users/catap/src/gcl/gcl/unixport/../lsp/gcl_export.lsp
>> loading /Users/catap/src/gcl/gcl/unixport/../lsp/gcl_defmacro.lsp
>> loading /Users/catap/src/gcl/gcl/unixport/../lsp/gcl_evalmacros.lsp
>> loading /Users/catap/src/gcl/gcl/unixport/../lsp/gcl_top.lsp
>> UNDEFINED-FUNCTION NIL SETQ   NAME KCL-SELF
>> Lisp initialization failed.
>> [ "" = "" ] || \
>> ! [ -x /usr/bin/objdump ] || \
>> ! /usr/bin/objdump -f saved_pre_gcl | grep "file format" | grep "elf" || \
>> ! /usr/bin/objdump -R saved_pre_gcl |grep R_.*_COPY || \
>> ! echo "saved_pre_gcl cannot be prelinked"
>> rm raw_pre_gcl
>> cd unixport && echo '(time (let ((*features* (cons :pre-gcl *features*)))(load "boot.lisp")(si::save-system "saved_pre_gcl_temp")))' | ./saved_pre_gcl
>> /bin/sh: ./saved_pre_gcl: No such file or directory
>> 
>> --
>> wbr, Kirill
>> 
>> From e2bd77215300986fcf46f5202abe08833bcf6b4d Mon Sep 17 00:00:00 2001
>> From: "Kirill A. Korinsky" <[email protected]>
>> Date: Thu, 21 Dec 2023 17:01:47 +0100
>> Subject: [PATCH 1/5] Disable gprof on macOS by default
>> 
>> ---
>> gcl/configure    | 1 +
>> gcl/configure.in | 1 +
>> 2 files changed, 2 insertions(+)
>> 
>> diff --git a/gcl/configure b/gcl/configure
>> index 74100ec18..15573a0c6 100755
>> --- a/gcl/configure
>> +++ b/gcl/configure
>> @@ -5742,6 +5742,7 @@ if test "$GPROF" != "" ; then
>> printf %s "checking working gprof... " >&6; }
>>    case $use in
>>        powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
>> +       *macos*) GPROF="";;#macOS uses clang by default which doesn't support gprof for years
>>        s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
>>        sh4*)  GPROF="";;
>>        m68k*) GPROF="";;
>> diff --git a/gcl/configure.in b/gcl/configure.in
>> index 3cc62a06c..eabf55659 100644
>> --- a/gcl/configure.in
>> +++ b/gcl/configure.in
>> @@ -391,6 +391,7 @@ if test "$GPROF" != "" ; then
>>    AC_MSG_CHECKING([working gprof])
>>    case $use in
>>        powerpc*) if test "$host_cpu" = "powerpc64le" ; then GPROF=""; fi;;
>> +       *macos*) GPROF="";;#macOS uses clang by default which doesn't support gprof for years
>>        s390*) GPROF="";;#mcount smashes float args in make_shortfloat 20180313
>>        sh4*)  GPROF="";;
>>        m68k*) GPROF="";;
>> --
>> 2.43.0
>> 
>> 
>> From 577fd4a6b3c7cd36f8d3d5fced25c0780ceb2f24 Mon Sep 17 00:00:00 2001
>> From: "Kirill A. Korinsky" <[email protected]>
>> Date: Thu, 21 Dec 2023 18:01:59 +0100
>> Subject: [PATCH 2/5] macOS-friendly check for readline
>> 
>> ---
>> gcl/configure    | 4 ++++
>> gcl/configure.in | 4 ++++
>> 2 files changed, 8 insertions(+)
>> 
>> diff --git a/gcl/configure b/gcl/configure
>> index 15573a0c6..fabaad897 100755
>> --- a/gcl/configure
>> +++ b/gcl/configure
>> @@ -9836,6 +9836,7 @@ printf %s "checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_FUNCTION... " >&6; }
>>                                  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> /* end confdefs.h.  */
>> 
>> +                                                  #include <stdio.h>
>>                                                   #include <readline/readline.h>
>> 						  extern Function *rl_completion_entry_function __attribute__((weak));
>> 
>> @@ -9862,6 +9863,7 @@ printf %s "checking RL_COMPLETION_ENTRY_FUNCTION_TYPE_RL_COMPENTRY_FUNC_T... " >
>>                                          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> /* end confdefs.h.  */
>> 
>> +		                                          #include <stdio.h>
>> 		                                          #include <readline/readline.h>
>> 							  extern rl_compentry_func_t *rl_completion_entry_function __attribute__((weak));
>> 
>> @@ -9894,6 +9896,7 @@ printf %s "checking RL_READLINE_NAME_TYPE_CHAR... " >&6; }
>>                                  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> /* end confdefs.h.  */
>> 
>> +		                                  #include <stdio.h>
>> 		                                  #include <readline/readline.h>
>> 		                                  extern char *rl_readline_name __attribute__((weak));
>> 
>> @@ -9920,6 +9923,7 @@ printf %s "checking RL_READLINE_NAME_TYPE_CONST_CHAR... " >&6; }
>>                                          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
>> /* end confdefs.h.  */
>> 
>> +		                                          #include <stdio.h>
>> 		                                          #include <readline/readline.h>
>> 		                                          extern const char *rl_readline_name __attribute__((weak));
>> 
>> diff --git a/gcl/configure.in b/gcl/configure.in
>> index eabf55659..15a637f90 100644
>> --- a/gcl/configure.in
>> +++ b/gcl/configure.in
>> @@ -1892,6 +1892,7 @@ if test "$enable_readline" != "no" ; then
>>                                  AC_COMPILE_IFELSE(
>>                                         [AC_LANG_PROGRAM(
>> 	                                       [[
>> +                                                  #include <stdio.h>
>>                                                   #include <readline/readline.h>
>> 						  extern Function *rl_completion_entry_function __attribute__((weak));
>> 	    				       ]],
>> @@ -1903,6 +1904,7 @@ if test "$enable_readline" != "no" ; then
>>                                          AC_COMPILE_IFELSE(
>>                                                 [AC_LANG_PROGRAM(
>> 	                                               [[
>> +		                                          #include <stdio.h>
>> 		                                          #include <readline/readline.h>
>> 							  extern rl_compentry_func_t *rl_completion_entry_function __attribute__((weak));
>> 	                                               ]],
>> @@ -1916,6 +1918,7 @@ if test "$enable_readline" != "no" ; then
>>                                  AC_COMPILE_IFELSE(
>>                                         [AC_LANG_PROGRAM(
>> 	                                       [[
>> +		                                  #include <stdio.h>
>> 		                                  #include <readline/readline.h>
>> 		                                  extern char *rl_readline_name __attribute__((weak));
>> 	                                       ]],
>> @@ -1927,6 +1930,7 @@ if test "$enable_readline" != "no" ; then
>>                                          AC_COMPILE_IFELSE(
>>                                                 [AC_LANG_PROGRAM(
>> 	                                               [[
>> +		                                          #include <stdio.h>
>> 		                                          #include <readline/readline.h>
>> 		                                          extern const char *rl_readline_name __attribute__((weak));
>> 	                                               ]],
>> --
>> 2.43.0
>> 
>> 
>> From b8876a37dc07fcebc9e7b179168db86a33f27a91 Mon Sep 17 00:00:00 2001
>> From: "Kirill A. Korinsky" <[email protected]>
>> Date: Thu, 21 Dec 2023 18:12:53 +0100
>> Subject: [PATCH 3/5] make moder clang happy
>> 
>> ---
>> gcl/o/print.d | 4 ++++
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/gcl/o/print.d b/gcl/o/print.d
>> index 569d07eb5..1d944b746 100644
>> --- a/gcl/o/print.d
>> +++ b/gcl/o/print.d
>> @@ -579,6 +579,7 @@ flush_queue(int force,struct printContext *p) {
>>       if (flush_queue_indent(force,p)) return;
>>       break;
>>     case CURRENT: case BLOCK:
>> +    {
>>       short sh=p->b.p_queue[mod(p->b.p_qh+1)];
>>       if (p->b.p_qc<2) return;
>>       sh<<=1;sh>>=1;
>> @@ -587,6 +588,7 @@ flush_queue(int force,struct printContext *p) {
>>       p->b.p_indent_stack[p->b.p_isp] = sh;
>>       flush_queue_flush(force,2,p);
>>       break;
>> +    }
>>     case LINE:case SECTION:case LINE_RELATIVE:case SECTION_RELATIVE:
>>       if (p->b.p_qc<3) return;
>>       flush_queue_flush(force,3,p);
>> @@ -1680,6 +1682,7 @@ write_object(object x,int level) {
>> 		break;
>> 
>> 	case t_structure:
>> +  {
>> 	  object y=structure_to_list(x);
>> 	  if (PRINTcircle)
>> 	    if (write_sharp_eq(x,FALSE)==DONE) return;
>> @@ -1707,6 +1710,7 @@ write_object(object x,int level) {
>> 	    break;
>> 	  }
>> 	  break;
>> +  }
>> 
>> 	case t_readtable:
>> 	        write_unreadable_str(x,"#<readtable ");
>> --
>> 2.43.0
>> 
>> 
>> From a5845d09971d0e9ee121424a8579e022a806bd86 Mon Sep 17 00:00:00 2001
>> From: "Kirill A. Korinsky" <[email protected]>
>> Date: Thu, 21 Dec 2023 18:16:59 +0100
>> Subject: [PATCH 4/5] Use FPE_SET_CTXT_ADDR and FPE_CLR_CTXT_CWD only when
>> defined
>> 
>> ---
>> gcl/o/usig.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/gcl/o/usig.c b/gcl/o/usig.c
>> index 66810c28f..3a83f2107 100644
>> --- a/gcl/o/usig.c
>> +++ b/gcl/o/usig.c
>> @@ -232,8 +232,12 @@ sigfpe3(int sig,siginfo_t *i,void *v) {
>> #endif
>>   ifuncall3(sSfloating_point_error,FPE_CODE(i,v),FPE_ADDR(i,v),FPE_CTXT(v));
>> 
>> +#ifdef FPE_SET_CTXT_ADDR
>>   FPE_SET_CTXT_ADDR(v,FPE_ADDR(i,v));
>> +#endif
>> +#ifdef FPE_CLR_CTXT_CWD
>>   FPE_CLR_CTXT_CWD(v);
>> +#endif
>> 
>> }
>> 
>> --
>> 2.43.0
>> 
>> 
>> From 2c5c2c7362a6bd913fed16f8e250eae01d2ac241 Mon Sep 17 00:00:00 2001
>> From: "Kirill A. Korinsky" <[email protected]>
>> Date: Thu, 21 Dec 2023 18:53:54 +0100
>> Subject: [PATCH 5/5] Reallu disable gprof
>> 
>> ---
>> gcl/configure.in | 3 ++-
>> gcl/o/main.c     | 4 ++++
>> gcl/o/makefile   | 4 ++--
>> 3 files changed, 8 insertions(+), 3 deletions(-)
>> 
>> diff --git a/gcl/configure.in b/gcl/configure.in
>> index 15a637f90..3a2a9ac10 100644
>> --- a/gcl/configure.in
>> +++ b/gcl/configure.in
>> @@ -383,7 +383,7 @@ fi
>> AC_SUBST(GCL_CC)
>> 
>> 
>> -GPROF="gprof_objs"
>> +GPROF="gprof"
>> AC_ARG_ENABLE([gprof],[  --enable-gprof builds gcl with -pg in CFLAGS to enable profiling with gprof],
>> 	      [if test "$enableval" != "yes" ; then GPROF=""; fi])
>> 
>> @@ -408,6 +408,7 @@ if test "$GPROF" != "" ; then
>>        OLD_CFLAGS=$CFLAGS  # Do not run configure tests with -pg
>>        assert_arg_to_cflags -pg
>>        CFLAGS=$OLD_CFLAGS
>> +       AC_DEFINE(USE_GPROF,1,[use gprof])
>>    fi
>> fi
>> AC_SUBST(GPROF)
>> diff --git a/gcl/o/main.c b/gcl/o/main.c
>> index ae93a228f..ba945bee0 100644
>> --- a/gcl/o/main.c
>> +++ b/gcl/o/main.c
>> @@ -370,7 +370,9 @@ minimize_image(void) {
>>   nrbpage=0;
>>   resize_hole(0,t_relocatable,0);
>> 
>> +#ifdef USE_GPROF
>>   gprof_cleanup();
>> +#endif
>> 
>> #if defined(BSD) || defined(ATT)
>>   mbrk(core_end=heap_end);
>> @@ -470,7 +472,9 @@ gcl_cleanup(int gc) {
>>   {extern void _cleanup(void);_cleanup();}
>> #endif
>> 
>> +#ifdef USE_GPROF
>>   gprof_cleanup();
>> +#endif
>> 
>>   if (gc) {
>> 
>> diff --git a/gcl/o/makefile b/gcl/o/makefile
>> index 349d84d7a..5b1c7d56b 100644
>> --- a/gcl/o/makefile
>> +++ b/gcl/o/makefile
>> @@ -22,7 +22,7 @@ OBJS:=$(addsuffix .o,typespec alloc gbc bitop boot main eval macros lex bds fram
>> 	 hash array string regexpr structure toplevel file read backq print format\
>> 	 pathname unixfsys unixfasl error unixtime unixsys unixsave funlink  fat_string\
>> 	 run_process nfunlink usig usig2 utils makefun sockets gmp_wrappers clxsocket\
>> -	 init_pari nsocket new_init prelink sfasl gprof $(RL_OBJS))
>> +	 init_pari nsocket new_init prelink sfasl $(RL_OBJS))
>> OBJS:=$(OBJS) $(EXTRAS)
>> 
>> INI_FILES=$(patsubst %.o,%.ini,${OBJS})
>> @@ -30,7 +30,7 @@ INI_FILES:=$(filter-out new_init.ini,$(filter-out boot.ini,$(INI_FILES)))
>> 
>> OBJECTS:=$(OBJS) $(LIBFILES) new_init.o  $(GCLIB) $(LAST_FILE)  $(FIRST_FILE)
>> 
>> -all:  $(OBJECTS) #$(GPROF)
>> +all:  $(OBJECTS) $(GPROF)
>> 
>> gprof_objs: $(addprefix ../gprof/,$(OBJECTS))
> 
> --
> Camm Maguire			     		    [email protected]
> ==========================================================================
> "The earth is but one country, and mankind its citizens."  --  Baha'u'llah
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE3/KLNtcfWfLw7JxqmNjZhndZIm4FAmWE6N0ACgkQmNjZhndZ
Im4StQ//UTm3LvZJxyP5XdKm12e8WRkPqPdFHEXGGqjDFUVywDEbcygMdJ7rQzHs
/BE0Zt9AlwQZcfAMZVRFEN8As0lxixyxMBFEcDkOAbOk6d/i04L+dNTcTXKufrWx
XtefjjaVxNdOn/SfPE9L26gDOo3Miy8CSVEc4/poMnlg8bOZwHiZz9NUtDS6b4le
isw8ElHn5CS0zEuhIc0ziRVbhxOnOf27o1Arpwzm0K9fAP+2hjuiftKg7eXeccoA
AIueWlSxzOPTtch25BEzULxZplA9eqPb6zGpWFIjR8A2xKT1jC4188odAtn+Kbk6
LBqtZkW/0yo3Fajo70yHglzdbvP9cXteX/PSLGfX337aLF17TrJC619E/p4rLrMZ
MtFWsDSg0R3wGQSTAH+Ckvpl6GRerzCSaoN7+RJwSkU1jNkSseORBOwIxzyftpjO
eNVVVSg6fijrY7Ap3wKTy7vp9OlqlT8HY81+pYHrm0KTd5JAiZjqhjdyDBd8HvsL
GtHtFxF8gcOKcnjZcVpkngATL+NXUr6ciDcIiyBLqCwLA/XANu7qIzRbK2iUsBNO
xJ9hUIrNZZlHF0Mdy7LNy5MUuK8X8EPYXQHbXmpcJqFvVdb5kV9KBW75KtetHEUl
6A/zgYpUnEs56m1VBqbg4R33Lmo9awqO6gD31zdDoZ8Mjuywb74=
=FE3b
-----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.