using macros in a static binary added by noel on Fri Aug 21 03:42:33 2020

;;; crunk.scm                                                                                   
(import miscmacros)
(let/cc cont
        (display "hello\n")
        (cont #t))
(display "goodbye\n")

;;; using csc's '-static' option                                                                
$ csc -static crunk.scm -o crunk-sorta-static
$ ldd crunk-sorta-static
        linux-vdso.so.1 (0x00007ffe42734000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1f9db4e000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1f9db49000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1f9d988000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1f9df2e000)
$ ./crunk-sorta-static
hello
goodbye

;;; using gcc to produce a static binary                                                        
;;; (chicken 5.2.0 install directory snipped in this output as [...])                           
$ csc -O0 -d2 -c crunk.scm -link miscmacros
$ gcc -g -static crunk.o -o crunk-static [...]/lib/chicken/11/miscmacros.o -L[...]/lib -lchicke\
n -lm
$ ldd crunk-static
        not a dynamic executable
$ ./crunk-static

Error: (load) during expansion of (import-syntax ...) - unable to load compiled module - cannot load compiled code dynamically - this is a statically linked executable: "[...]/lib/chicken/11/chicken.condition.import.so"

        Call history:

        <syntax>          (import scheme chicken.base chicken.syntax)
        <syntax>          (##core#begin (##core#require library scheme#) (##core#require librar\
y chicken.base#) (##core#requir...
        <syntax>          (##core#require library scheme#)
        <syntax>          (##sys#load-library (##core#quote library))
        <syntax>          (##core#quote library)
        <syntax>          (##core#require library chicken.base#)
        <syntax>          (##sys#load-library (##core#quote library))
        <syntax>          (##core#quote library)
        <syntax>          (##core#begin (##core#require expand chicken.syntax#))
        <syntax>          (##core#require expand chicken.syntax#)
        <syntax>          (##sys#load-library (##core#quote expand))
        <syntax>          (##core#quote expand)
        <eval>    (##sys#load-library (##core#quote library))
        <eval>    (##sys#load-library (##core#quote library))
        <eval>    (##sys#load-library (##core#quote expand))
        <syntax>          (import-syntax scheme (only chicken.base when unless let-optionals make-parameter add1 sub1) (only c...       <--

;;; looking for advice on where to go next with this                                            
;;;                                                                                             
;;; should miscmacros be rebuilt with '-compile-syntax'?                                        
;;;                                                                                             
;;; should the static libchicken.a be rebuilt with '-compile-syntax'?                           
;;;                                                                                             
;;; TIA!