From eb2ac880a42f95b239e9fb5805b8f4f047c8cb3e Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Thu, 11 Jan 2024 13:23:28 -0600 Subject: [PATCH 1/7] Replace "dynamic-space-size" argument by "space-size". This change was required to fix the problem of the SBCL executable that is running buildapp gobbling up the dynamic-space-size command line argument instead of letting it be a setting for the image that is being created. --- buildapp.lisp | 81 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/buildapp.lisp b/buildapp.lisp index a53d12c..3c8d89a 100644 --- a/buildapp.lisp +++ b/buildapp.lisp @@ -118,11 +118,25 @@ Other flags:" --core-only Make a core file only, not an executable" #+sbcl " - --dynamic-space-size MB Pass a --dynamic-space-size option to SBCL - when building; value is megabytes" + --space-size MB Pass a --dynamic-space-size option to SBCL + when building and into the built app; value + is megabytes. + Note that the argument has a *different* + name from the SBCL command line argument. + This is necessary to keep SBCL from + swallowing the argument." +#+sbcl +" + --turn-off-ldb Pass --disable-ldb to SBCL when building (and into the + built application). + Note that the argument has a *different* + name from the SBCL command line argument. + This is necessary to keep SBCL from + swallowing the argument." " --help Show this usage message - --logfile FILE Log compilation and load output to FILE" + --logfile FILE Log compilation and load output to FILE + --dumpfile-copy FILE Write a copy of the dumpfile to FILE." #+sbcl " --sbcl PATH-TO-SBCL Use PATH-TO-SBCL instead of the sbcl program @@ -382,7 +396,6 @@ it. If an exact filename is not found, file.lisp is also tried." (let ((*print-case* :downcase)) (write-dumpfile dumper stream)))) - (defun main (argv) "Create an executable from the command-line arguments provided in ARGV. See *USAGE* for details." @@ -397,23 +410,49 @@ ARGV. See *USAGE* for details." (force-output stream) (when (dumpfile-copy dumper) (copy-file file (dumpfile-copy dumper))) - (let ((process (run-program #+sbcl (sbcl dumper) - #+ccl (ccl dumper) - (flatten - (list - #+sbcl - (when dynamic-space-size - (list "--dynamic-space-size" - (princ-to-string - dynamic-space-size))) - #+sbcl "--noinform" - #+ccl "--quiet" - #+sbcl "--disable-debugger" - #+sbcl "--no-userinit" - #+sbcl "--no-sysinit" - #+ccl "--no-init" - "--load" (native-namestring - (probe-file file))))))) + (format t "~&About to recursively start SBCL, dynamic-space-size is ~a~%" dynamic-space-size) + (let ((process + (let ((cmd `(run-program #+sbcl ,(sbcl dumper) + #+ccl ,(ccl dumper) + ',(flatten + (list + #+sbcl + (when dynamic-space-size + (list "--dynamic-space-size" + (princ-to-string + dynamic-space-size))) + #+sbcl + (when (disable-ldb dumper) + "--disable-ldb") + #+sbcl "--noinform" + #+ccl "--quiet" + #+sbcl "--disable-debugger" + #+sbcl "--no-userinit" + #+sbcl "--no-sysinit" + #+ccl "--no-init" + "--load" (native-namestring + (probe-file file))))))) + (format t "~&running this command to try to build the application:~%") + (pprint cmd) (terpri) + (eval cmd)) + ;; (run-program #+sbcl (sbcl dumper) + ;; #+ccl (ccl dumper) + ;; (flatten + ;; (list + ;; #+sbcl + ;; (when dynamic-space-size + ;; (list "--dynamic-space-size" + ;; (princ-to-string + ;; dynamic-space-size))) + ;; #+sbcl "--noinform" + ;; #+ccl "--quiet" + ;; #+sbcl "--disable-debugger" + ;; #+sbcl "--no-userinit" + ;; #+sbcl "--no-sysinit" + ;; #+ccl "--no-init" + ;; "--load" (native-namestring + ;; (probe-file file))))) + )) (if (zerop #+sbcl (sb-ext:process-exit-code process) #+ccl (ccl::external-process-%exit-code process)) (probe-file (output dumper)) From 0ee509242b3c4e71bbf38642183a7c3bba19d371 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Thu, 11 Jan 2024 13:55:04 -0600 Subject: [PATCH 2/7] Handle --disable-ldb and --space-size arguments. The latter is needed to fix the issue of SBCL swallowing the `--dynamic-space-size` argument. The former is necessary because the version in the GitHub repository was missing the `--disable-ldb` initialization and handling code causing failure to compile. --- command-line.lisp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/command-line.lisp b/command-line.lisp index 41cb9c8..98b45d5 100644 --- a/command-line.lisp +++ b/command-line.lisp @@ -102,6 +102,9 @@ (setf (compress-core plan) t)) (when (popflag "--core-only" args) (setf (core-only plan) t)) + #+sbcl + (when (popflag "--turn-off-ldb" args) + (setf (slot-value plan 'disable-ldb) t)) (when (oddp (length args)) (error 'odd-number-of-arguments)) (loop @@ -142,7 +145,7 @@ (:ccl (when (ccl plan) (setf (ccl plan) value))) - (:entry + (:entry (when (dispatched-entries plan) (error 'entry-and-dispatched-entry)) (when (entry plan) @@ -158,7 +161,10 @@ :flag (format nil "~A ~A" argument value)) (setf default-dispatched-entry entry))) (push entry (dispatched-entries plan)))) - (:dynamic-space-size + #+sbcl + (:space-size ;; :dynamic-space-size + (format t "Trying to parse dynamic-space-size from \"~a\" giving ~d~%" + value (parse-integer value)) (setf (dynamic-space-size plan) (parse-integer value))) (t (error 'unknown-argument :flag argument))))))) From fa1e3ee14364c1131ad226b0bd0815ac5c403d84 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Sun, 21 Jan 2024 11:15:45 -0600 Subject: [PATCH 3/7] Fix SBCL initargs. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc74d5a..8239d16 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ DESTDIR = /usr/local LISP := sbcl ifeq ($(LISP),sbcl) -FLAGS=--noinform --no-userinit --no-sysinit --disable-debugger +FLAGS=--no-userinit --no-sysinit --disable-debugger else FLAGS=--quiet --no-init endif From 3c7536b24fe114d1d364a7918a284a9d4b198b70 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Sun, 21 Jan 2024 11:16:11 -0600 Subject: [PATCH 4/7] Add DISABLE-LDB option. --- dumper.lisp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dumper.lisp b/dumper.lisp index 6a3cdf6..0649358 100644 --- a/dumper.lisp +++ b/dumper.lisp @@ -86,6 +86,10 @@ (dynamic-space-size :initarg :dynamic-space-size :accessor dynamic-space-size + :initform nil) + (disable-ldb + :initarg :disable-ldb + :reader disable-ldb :initform nil))) (defgeneric needs-asdf-p (dumper) From 53b4c59a26c75a0b499cd11ee20d6c32e96a7e5e Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Sun, 21 Jan 2024 13:10:58 -0600 Subject: [PATCH 5/7] Possible solution to GitHub #40. Maybe the argument to `macroexpand-1` needed a quote? --- dumper.lisp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dumper.lisp b/dumper.lisp index 0649358..a49e001 100644 --- a/dumper.lisp +++ b/dumper.lisp @@ -130,7 +130,7 @@ (list `(format *error-output* "Unknown dispatch name '~A', quitting~%" binary-name) - (macroexpand-1 (quit 1))))))))))) + (macroexpand-1 '(quit 1))))))))))) (defgeneric entry-function-form (dumper) (:method (dumper) @@ -165,4 +165,3 @@ (defun dump-form (name) (gethash name *dumpable-forms*)) - From 5ed1296b223a5e61cd9d21d7bc397646cf04908c Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Sun, 21 Jan 2024 13:12:00 -0600 Subject: [PATCH 6/7] Replace BACKTRACE-AS-LIST by LIST-BACKTRACE as needed. SB-DEBUG:LIST-BACKTRACE is deprecated. --- utils.lisp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils.lisp b/utils.lisp index 345e845..105f000 100644 --- a/utils.lisp +++ b/utils.lisp @@ -35,8 +35,15 @@ #+sbcl 'sb-ext:*posix-argv* #+ccl '(ccl::command-line-arguments)) +#+sbcl +(eval-when (:compile-toplevel :load-toplevel :execute) + (let ((version (uiop:lisp-version-string))) + (unless (uiop:version<= version "1.12.5") + (push :sb-list-backtrace *features*)))) + (defmacro backtrace-as-list () - #+sbcl '(sb-debug:backtrace-as-list) + #+(and sbcl sb-list-backtrace) '(sb-debug:list-backtrace) + #+(and sbcl (not sb-list-backtrace)) '(sb-debug:backtrace-as-list) #+ccl '(ccl::backtrace-as-list)) (defmacro quit (&optional (errno 0)) From cace59bee316424516ba83c67591f84a6a1ac1f7 Mon Sep 17 00:00:00 2001 From: "Robert P. Goldman" Date: Sun, 21 Jan 2024 13:27:46 -0600 Subject: [PATCH 7/7] Remove debugging print. --- buildapp.lisp | 5 ++--- command-line.lisp | 6 ------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/buildapp.lisp b/buildapp.lisp index 3c8d89a..c9109a6 100644 --- a/buildapp.lisp +++ b/buildapp.lisp @@ -432,8 +432,8 @@ ARGV. See *USAGE* for details." #+ccl "--no-init" "--load" (native-namestring (probe-file file))))))) - (format t "~&running this command to try to build the application:~%") - (pprint cmd) (terpri) + ;;(format t "~&running this command to try to build the application:~%") + ;;(pprint cmd) (terpri) (eval cmd)) ;; (run-program #+sbcl (sbcl dumper) ;; #+ccl (ccl dumper) @@ -477,4 +477,3 @@ ARGV. See *USAGE* for details." 'command-line-debugger)) #+sbcl (pushnew 'buildapp-init sb-ext:*init-hooks*) - diff --git a/command-line.lisp b/command-line.lisp index 98b45d5..387cb74 100644 --- a/command-line.lisp +++ b/command-line.lisp @@ -163,12 +163,6 @@ (push entry (dispatched-entries plan)))) #+sbcl (:space-size ;; :dynamic-space-size - (format t "Trying to parse dynamic-space-size from \"~a\" giving ~d~%" - value (parse-integer value)) (setf (dynamic-space-size plan) (parse-integer value))) (t (error 'unknown-argument :flag argument))))))) - - - -