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,

With -O0 (disabled optimizations) now the building process moved from
"raw_pre_gcl" to "saved_pre_gcl", and then crashed again with a "symbol
not found in flat namespace".  Now this looks like a fixable linking
issue, perhaps related to the new clang compiler on Sonoma w.r.t Catalina.

> rm raw_pre_gcl
> touch h/cmpinclude.h unixport/saved_pre_gcl
> cd unixport && echo '(time (load "boot.lisp"))' | ../unixport/saved_pre_gcl
> dlopen(/Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/libboot.so, 0x0009): symbol not found in flat namespace '_Cnil_body'
> dlsym(0x0, gcl_init_boot): invalid handle
> Segmentation violation: c stack ok:signalling errorSegmentation violation: c stack ok:signalling error
> Unrecoverable error: Segmentation violation..
> /bin/sh: line 1: 33223 Done                    echo '(time (load "boot.lisp"))'
>      33224 Abort trap: 6           | ../unixport/saved_pre_gcl
> make: *** [unixport/saved_gcl0] Error 134
> rm h/mcompdefs.h h/mstdint.h

No useful information if I try to print a backtrace:

> binghe@binghe-mac7:~/Lisp/gcl/gcl$ lldb unixport/saved_pre_gcl 
> (lldb) target create "unixport/saved_pre_gcl"
> Current executable set to '/Users/binghe/Lisp/gcl/gcl/unixport/saved_pre_gcl' (x86_64).
> (lldb) run
> Process 33304 launched: '/Users/binghe/Lisp/gcl/gcl/unixport/saved_pre_gcl' (x86_64)
> Process 33304 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
>     frame #0: 0x0000000000000000
> error: memory read failed for 0x0
> Target 0: (saved_pre_gcl) stopped.
> (lldb) bt
> * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
>   * frame #0: 0x0000000000000000
>     frame #1: 0x000000010000c949 saved_pre_gcl`init_boot at main.c:438:3
>     frame #2: 0x000000010000cff2 saved_pre_gcl`main(argc=1, argv=0x00007ff7bfefee58, envp=0x00007ff7bfefee68) at main.c:633:21
>     frame #3: 0x00007ff811831386 dyld`start + 1942
> (lldb) 

What does "flat namespace" mean? Is GCL's C code being (wrongly)
considered/handle as C++ code and is somehow miscompiled due to the new
C++ standard?

Hope this helps,

Chun

On 09/02/24 14:04, Chun Tian (binghe) wrote:
> Quick updates: using CFLAGS=-O0, the previous mentioned crashing
> disappeared. This matches MacPorts maintainer's suggestions on setting
> environment variables.
> 
> Chun
> 
> On Fri, Feb 9, 2024 at 1:15 PM Camm Maguire <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Greetings, and thanks again so much as always for your helpful feedback.
> 
>     You were right about brew on my Catalina -- I have disabled these and am
>     testing against the Macports gmp now.
> 
>     I've committed a stdint.h fix and a gmp.h location detection fix for
>     you.  Building with cc/clang now and all appears to work out of the box
>     with the right environment settings.  In particular, I cannot reproduce
>     the issue you list here.
> 
>     I would do a disassemble at this point in lldb and post the results.  Is
>     this Catalina?  Perhaps disable C optimization too, either through
>     CFLAGS or --enable-debug to configure.
> 
>     Take care,
> 
> 
>     "Chun Tian (binghe)" <[email protected]
>     <mailto:[email protected]>> writes:
> 
>     > Greetings!
>     >
>     > Ah, I didn't know these environment variables at all. Now I have put
>     > them into my ~/.profile. Thanks.
>     >
>     > After using them, now the previous issues about gmp.h disappeared.
>     Then
>     > I met the issue, which was the reason that I chose GCC 13 over Apple
>     > clang, that "raw_pre_gcl" crashed (Illegal instruction) when doing
>     > (init-system). This time I added CFLAGS=-g when building, run
>     > "raw_pre_gcl" by lldb (LLVM debugger) and try to manually evaluate the
>     > "foo" script line by one, until (init-system):
>     >
>     >> (defun make-package (name &key nicknames use)
>     >>   (si::make-package-int name nicknames use))
>     >>
>     >> (make-package :s :use '(:cl))
>     >> (make-package :compiler :use '(:cl :si :s))
>     >> (make-package :sloop :use '(:cl))
>     >> (make-package :ansi-loop :use'(:cl))
>     >> (make-package :defpackage :use '(:cl))
>     >> (make-package :tk :use '(:cl :sloop))
>     >> (make-package :fpe :use '(:cl))
>     >> (make-package :cltl1-compat)
>     >>
>     >> (in-package :system)
>     >> (use-package '(:fpe :s :gmp))
>     >>
>     >> (export 'si::(object double cnum system cmp-inline cmp-eval
>     type-propagator c1no-side-effects defcfun clines defentry) :si);FIXME
>     >>
>     >> (setq *features* (cons :raw-image *features*))
>     >> (init-system)
>     >
>     > And this is the backtrace:
>     >
>     >> SYSTEM>(init-system)
>     >> loading /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_s.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_sf.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_rm.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_dl.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_fle.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_defmacro.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_hash.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_evalmacros.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_module.lsp
>     >> loading
>     /Volumes/CaseSensitive/Lisp/gcl/gcl/unixport/../lsp/gcl_predlib.lsp
>     >> Process 22566 stopped
>     >> * thread #1, queue = 'com.apple.main-thread', stop reason =
>     EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
>     >>     frame #0: 0x00000001000aa8d6 raw_pre_gcl`siLheap_report at
>     gbc.c:0:3 [opt]
>     >>    1268      }
>     >>    1269     
>     >>    1270      static void
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     >> -> 1271      FFN(siLheap_report)(void) {
>     >>    1272     
>     >>    1273        int i;
>     >>    1274       
>     >> Note: this address is compiler-generated code in function
>     siLheap_report that has no source code associated with it.
>     >> Target 0: (raw_pre_gcl) stopped.
>     >> warning: raw_pre_gcl was compiled with optimization - stepping
>     may behave oddly; variables may not be available.
>     >> (lldb) bt
>     >> * thread #1, queue = 'com.apple.main-thread', stop reason =
>     EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
>     >>   * frame #0: 0x00000001000aa8d6 raw_pre_gcl`siLheap_report at
>     gbc.c:0:3 [opt]
>     >>     frame #1: 0x0000000100059586
>     raw_pre_gcl`fSeval_src(first=<unavailable>) at eval.c:963:29 [opt]
>     >>     frame #2: 0x0000000100056f86
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n(f=<unavailable>, n=1, x=<unavailable>) at apply_n.h:6:19 [opt]
>     >>     frame #3: 0x0000000100056f80
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>, b=<unavailable>)
>     at apply_n.h:79:38 [opt]
>     >>     frame #4: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=<unavailable>) at eval.c:74:10 [opt]
>     >>     frame #5: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x0000000100305928) at eval.c:96:7 [opt]
>     >>     frame #6: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #7: 0x00000001000581fa raw_pre_gcl`eval [inlined]
>     funcall_no_event(fun=0x0000000102ed2040) at eval.c:414:5 [opt]
>     >>     frame #8: 0x00000001000581cb
>     raw_pre_gcl`eval(form=<unavailable>) at eval.c:762:4 [opt]
>     >>     frame #9: 0x0000000100064635
>     raw_pre_gcl`Fmultiple_value_list(form=0x0000000102f061c0) at
>     multival.c:68:2 [opt]
>     >>     frame #10: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f061a0) at eval.c:707:3 [opt]
>     >>     frame #11: 0x00000001000580e3
>     raw_pre_gcl`eval(form=0x0000000102f061d0) at eval.c:747:3 [opt]
>     >>     frame #12: 0x00000001000580e3
>     raw_pre_gcl`eval(form=0x0000000102f061e0) at eval.c:747:3 [opt]
>     >>     frame #13: 0x00000001000580e3
>     raw_pre_gcl`eval(form=0x0000000102f061f0) at eval.c:747:3 [opt]
>     >>     frame #14: 0x00000001000580e3
>     raw_pre_gcl`eval(form=0x0000000102f06410) at eval.c:747:3 [opt]
>     >>     frame #15: 0x0000000100029fa0
>     raw_pre_gcl`Fprogn(body=0x0000000102f06460) at prog.c:250:4 [opt]
>     >>     frame #16: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f06450) at eval.c:707:3 [opt]
>     >>     frame #17: 0x0000000100059c64
>     raw_pre_gcl`ieval(x=<unavailable>) at eval.c:1070:3 [opt]
>     >>     frame #18: 0x0000000100036fec raw_pre_gcl`load(s="lsp") at
>     file.d:1701:3 [opt]
>     >>     frame #19: 0x00000001000bbd98
>     raw_pre_gcl`lsp_init(a=<unavailable>, b=<unavailable>) at sys.c:75:3
>     [opt] [artificial]
>     >>     frame #20: 0x00000001000bbf05
>     raw_pre_gcl`gcl_init_system(no_init=<unavailable>) at
>     sys_init.c:51:3 [opt]
>     >>     frame #21: 0x0000000100009dc3 raw_pre_gcl`siLinit_system at
>     main.c:1055:3 [opt]
>     >>     frame #22: 0x0000000100059586
>     raw_pre_gcl`fSeval_src(first=<unavailable>) at eval.c:963:29 [opt]
>     >>     frame #23: 0x0000000100056f86
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n(f=<unavailable>, n=1, x=<unavailable>) at apply_n.h:6:19 [opt]
>     >>     frame #24: 0x0000000100056f80
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>, b=<unavailable>)
>     at apply_n.h:79:38 [opt]
>     >>     frame #25: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=<unavailable>) at eval.c:74:10 [opt]
>     >>     frame #26: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x00000001003058d0) at eval.c:96:7 [opt]
>     >>     frame #27: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #28: 0x00000001000581fa raw_pre_gcl`eval [inlined]
>     funcall_no_event(fun=0x0000000102edf400) at eval.c:414:5 [opt]
>     >>     frame #29: 0x00000001000581cb
>     raw_pre_gcl`eval(form=<unavailable>) at eval.c:762:4 [opt]
>     >>     frame #30: 0x000000010005936b
>     raw_pre_gcl`fLeval(x0=<unavailable>) at eval.c:866:3 [opt]
>     >>     frame #31: 0x0000000100056f6a
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>,
>     b=0x00000001003058a8) at apply_n.h:79:74 [opt]
>     >>     frame #32: 0x0000000100056f5a
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=0x00000001003058a8) at eval.c:74:10 [opt]
>     >>     frame #33: 0x0000000100056f5a
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x00000001003058a8) at eval.c:96:7 [opt]
>     >>     frame #34: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #35: 0x00000001000581fa raw_pre_gcl`eval [inlined]
>     funcall_no_event(fun=0x0000000102e996a0) at eval.c:414:5 [opt]
>     >>     frame #36: 0x00000001000581cb
>     raw_pre_gcl`eval(form=<unavailable>) at eval.c:762:4 [opt]
>     >>     frame #37: 0x0000000100029fa0
>     raw_pre_gcl`Fprogn(body=0x0000000102f0b0d0) at prog.c:250:4 [opt]
>     >>     frame #38: 0x000000010003e077
>     raw_pre_gcl`Flocally(body=<unavailable>) at toplevel.c:205:2 [opt]
>     >>     frame #39: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0b050) at eval.c:707:3 [opt]
>     >>     frame #40: 0x0000000100064635
>     raw_pre_gcl`Fmultiple_value_list(form=0x0000000102f0b0e0) at
>     multival.c:68:2 [opt]
>     >>     frame #41: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0b040) at eval.c:707:3 [opt]
>     >>     frame #42: 0x000000010008e709
>     raw_pre_gcl`let_bind(body=0x0000000102f0b2b0,
>     start=0x0000000100305858, end=0x0000000100305878) at bind.c:705:3 [opt]
>     >>     frame #43: 0x000000010002b81c
>     raw_pre_gcl`Flet(form=0x0000000102f0b110) at let.c:79:9 [opt]
>     >>     frame #44: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0b020) at eval.c:707:3 [opt]
>     >>     frame #45: 0x0000000100029fa0
>     raw_pre_gcl`Fprogn(body=0x0000000102f0b4b0) at prog.c:250:4 [opt]
>     >>     frame #46: 0x0000000100049c00
>     raw_pre_gcl`Fcatch(args=0x0000000102f0aba0) at catch.c:47:3 [opt]
>     >>     frame #47: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab90) at eval.c:707:3 [opt]
>     >>     frame #48: 0x00000001000b7b18
>     raw_pre_gcl`Fwhen(form=0x0000000102f0b4c0) at conditional.c:150:2 [opt]
>     >>     frame #49: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab80) at eval.c:707:3 [opt]
>     >>     frame #50: 0x0000000100025e73
>     raw_pre_gcl`Floop(form=0x0000000102f0b5b0) at iteration.c:58:3 [opt]
>     >>     frame #51: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab70) at eval.c:707:3 [opt]
>     >>     frame #52: 0x0000000100029fa0
>     raw_pre_gcl`Fprogn(body=0x0000000102f0b5c0) at prog.c:250:4 [opt]
>     >>     frame #53: 0x0000000100049c00
>     raw_pre_gcl`Fcatch(args=0x0000000102f0ab60) at catch.c:47:3 [opt]
>     >>     frame #54: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab50) at eval.c:707:3 [opt]
>     >>     frame #55: 0x00000001000b7b18
>     raw_pre_gcl`Fwhen(form=0x0000000102f0b5e0) at conditional.c:150:2 [opt]
>     >>     frame #56: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab40) at eval.c:707:3 [opt]
>     >>     frame #57: 0x0000000100025e3c
>     raw_pre_gcl`Floop(form=0x0000000102f0b610) at iteration.c:52:3 [opt]
>     >>     frame #58: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0ab30) at eval.c:707:3 [opt]
>     >>     frame #59: 0x0000000100029fa0
>     raw_pre_gcl`Fprogn(body=0x0000000102f0b620) at prog.c:250:4 [opt]
>     >>     frame #60: 0x000000010002b82f
>     raw_pre_gcl`Flet(form=0x0000000102f0a660) at let.c:83:2 [opt]
>     >>     frame #61: 0x0000000100057f14
>     raw_pre_gcl`eval(form=0x0000000102f0a3d0) at eval.c:707:3 [opt]
>     >>     frame #62: 0x00000001000577e4
>     raw_pre_gcl`funcall(fun=<unavailable>) at eval.c:386:2 [opt]
>     >>     frame #63: 0x000000010005958d
>     raw_pre_gcl`fSeval_src(first=<unavailable>) at eval.c:963:60 [opt]
>     >>     frame #64: 0x0000000100056f86
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n(f=<unavailable>, n=1, x=<unavailable>) at apply_n.h:6:19 [opt]
>     >>     frame #65: 0x0000000100056f80
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>, b=<unavailable>)
>     at apply_n.h:79:38 [opt]
>     >>     frame #66: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=<unavailable>) at eval.c:74:10 [opt]
>     >>     frame #67: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x00000001003057c0) at eval.c:96:7 [opt]
>     >>     frame #68: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #69: 0x00000001000581fa raw_pre_gcl`eval [inlined]
>     funcall_no_event(fun=0x0000000102f1a190) at eval.c:414:5 [opt]
>     >>     frame #70: 0x00000001000581cb
>     raw_pre_gcl`eval(form=<unavailable>) at eval.c:762:4 [opt]
>     >>     frame #71: 0x000000010005781c
>     raw_pre_gcl`funcall(fun=<unavailable>) at eval.c:386:2 [opt]
>     >>     frame #72: 0x000000010005958d
>     raw_pre_gcl`fSeval_src(first=<unavailable>) at eval.c:963:60 [opt]
>     >>     frame #73: 0x0000000100056f86
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n(f=<unavailable>, n=1, x=<unavailable>) at apply_n.h:6:19 [opt]
>     >>     frame #74: 0x0000000100056f80
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>, b=<unavailable>)
>     at apply_n.h:79:38 [opt]
>     >>     frame #75: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=<unavailable>) at eval.c:74:10 [opt]
>     >>     frame #76: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x0000000100305798) at eval.c:96:7 [opt]
>     >>     frame #77: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #78: 0x00000001000581fa raw_pre_gcl`eval [inlined]
>     funcall_no_event(fun=0x0000000102f1a2b0) at eval.c:414:5 [opt]
>     >>     frame #79: 0x00000001000581cb
>     raw_pre_gcl`eval(form=<unavailable>) at eval.c:762:4 [opt]
>     >>     frame #80: 0x00000001000577e4
>     raw_pre_gcl`funcall(fun=<unavailable>) at eval.c:386:2 [opt]
>     >>     frame #81: 0x000000010005958d
>     raw_pre_gcl`fSeval_src(first=<unavailable>) at eval.c:963:60 [opt]
>     >>     frame #82: 0x0000000100056f86
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n(f=<unavailable>, n=1, x=<unavailable>) at apply_n.h:6:19 [opt]
>     >>     frame #83: 0x0000000100056f80
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     c_apply_n_fun(fun=<unavailable>, n=<unavailable>, b=<unavailable>)
>     at apply_n.h:79:38 [opt]
>     >>     frame #84: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce [inlined]
>     quick_call_function_vec(fun=<unavailable>, n=<unavailable>,
>     b=<unavailable>) at eval.c:74:10 [opt]
>     >>     frame #85: 0x0000000100056f71
>     raw_pre_gcl`quick_call_function_vec_coerce(fun=<unavailable>,
>     n=<unavailable>, b=0x0000000100305770) at eval.c:96:7 [opt]
>     >>     frame #86: 0x00000001000570fb
>     raw_pre_gcl`quick_call_function(fun=<unavailable>) at eval.c:191:11
>     [opt]
>     >>     frame #87: 0x00000001000574d3
>     raw_pre_gcl`funcall(fun=0x0000000102f1a2e0) at eval.c:256:7 [opt]
>     >>     frame #88: 0x00000001000093b2
>     raw_pre_gcl`main(argc=<unavailable>, argv=<unavailable>,
>     envp=<unavailable>) at main.c:651:5 [opt]
>     >>     frame #89: 0x00007ff806d40386 dyld`start + 1942
>     >
>     > By searching on Internet [1], I think perhaps the clang compiler is
>     > given wrong architecture parameters, which caused it to generate CPU
>     > instructs not supported by my CPU. But the involved GCC command line
>     > seems clean:
>     >
>     > gcc -DINICOMP -DNO_DEFUN -g -fsigned-char -pipe -fcommon
>     > -fno-builtin-malloc -fno-builtin-free -fno-PIE -fno-pie -fno-PIC
>     > -fno-pic -Wall -Wno-builtin-requires-header -Wno-empty-body
>     > -Wno-self-assign -Wno-unused-but-set-variable
>     > -Wno-incomplete-setjmp-declaration -m64 ...
>     >
>     > If I used GCC 13, there's no such issues (but new issues occur later).
>     > It's a bit strange. What do I miss here?
>     >
>     > --Chun
>     >
>     > [1]
>     >
>     https://stackoverflow.com/questions/53396370/exc-bad-instruction-code-exc-i386-invop-subcode-0x0-underlying-causes
>     >
>     > On 09/02/24 03:32, Camm Maguire wrote:
>     >> Greetings!  I was always taught the canonical way to do this was
>     >>
>     >> export C_INCLUDE_PATH=/opt/local/include
>     >> export LIBRARY_PATH=/opt/local/lib
>     >>
>     >> ./configure && make
>     >>
>     >> This seems to work on my Catalina box with the aforementioned
>     commit.  I
>     >> will try a git pull shortly.
>     >>
>     >> Please let me know if this does not work for you.
>     >>
>     >> Take care,
>     >>
>     >> "Chun Tian (binghe)" <[email protected]
>     <mailto:[email protected]>> writes:
>     >>
>     >>> 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
>     <http://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 <http://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]
>     <mailto:[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,
>     >>>>
>     >>>
>     >>
>     >
> 
>     -- 
>     Camm Maguire                                       
>     [email protected] <mailto:[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-----

iQIzBAEBCAAdFiEES+aY+4laoC0TwmVKFUkg2jrYR8gFAmXFmVwACgkQFUkg2jrY
R8jBMxAApPGrSulzul7zQjB3byUsC1HZXtXb/SyyQEFKvdS3aE4buBBXSxTWDlQo
OsABb50b7DZzwsNltNQGfsDzRwD7KcmxDqxn/r1I7RlRIDd/xt1T2vp8xxgu8RLI
eetpNA8f7g2GwZhlJGzfDZ6jGc6+5E+iaRWWS+K2RawS2QIlvngws/udKUHeuGxB
eWWP5twQk6C9BZ+hz92USpp4Ucd9cpEkvTX/pOIpjdhMV5fTTxOIgvj29ZNsemXL
bEFSYB+xs+MCDKD+Pwn2U/hf6QVc3aDjb1chibHqqFnBvx2XJQAHa1ZffnA0nj88
T9wPA/LXWmRPPYlX45cuNK22wNW2+CnwcjIQ+NfbdsmWKgXtt8j8GqHYJP/RfY5C
mR9MBfyT3+cRfitKWBx152epkTorEcTmtSuw8d9URwu9XNQ7sAQOIh+GQUx+Qvhj
HJs6xPTNCapGYT94SZrGo/5wSnUWDbGBT3HOqPgSTIjs0CYmMRqW4gHFbZ6aYJ98
Ca+Gk+k9LYl+Eqvj/H5Epo62SB4DTOJ6gp4SAXSvVAFkJ6/Nj1NlbObS7BVqbL08
RX5tqfWE2l+Vw4b0WkE8sikYWxXlO9htmIjCg+eMn6XvLydD/SQHtgOC4Kd7jlPn
lV1ZRejd9sN6fwhzgLn02T52HUCKguHmaT72dUH4LOV3dnzT9rA=
=wU7X
-----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.