clasp
clasp copied to clipboard
cmp:bundle-fasl cannot combine object files from different-sessions
Consider the following two files
;;; foo.lisp
(in-package :cl-user)
(defun foo ()
'bar)
;;; end of foo.lisp
;;; bar.lisp
(in-package :cl-user)
(defun bar ()
'foo)
;;; end of bar.lisp
and these 3 clasp sessions:
karsten-poecks-macbook-pro:clasp karstenpoeck$ ~/lisp/compiler/clasp-karsten/build/clasp
*** clasp (../../src/main/main.cc:402): WARNING: Could not set stack size as requested (error code -1 - rlim_max = 16777216) !
*** clasp (../../src/main/main.cc:409): WARNING: Could not set stack size as requested (error code 1 - rlim_max = 67104768) !
Starting cclasp-boehm-0.4.2-1533-gb704da1c9-cst ... loading image...
Top level in: #<PROCESS TOP-LEVEL @0x10a50f719>.
COMMON-LISP-USER> (compile-file "foo.lisp")
; Compiling file: /Users/karstenpoeck/lisp/compiler/clasp/foo.lisp
; (IN-PACKAGE :CL-USER)
; (DEFUN FOO ...)
Writing temporary bitcode file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/foo.bc"
Writing fasl file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/foo.fasl"
#P"/Users/karstenpoeck/lisp/compiler/clasp/foo.fasl"
NIL
NIL
COMMON-LISP-USER> (core:quit)
karsten-poecks-macbook-pro:clasp karstenpoeck$ ~/lisp/compiler/clasp-karsten/build/clasp
*** clasp (../../src/main/main.cc:402): WARNING: Could not set stack size as requested (error code -1 - rlim_max = 16777216) !
*** clasp (../../src/main/main.cc:409): WARNING: Could not set stack size as requested (error code 1 - rlim_max = 67104768) !
Starting cclasp-boehm-0.4.2-1533-gb704da1c9-cst ... loading image...
Top level in: #<PROCESS TOP-LEVEL @0x10a54b719>.
COMMON-LISP-USER> (compile-file "bar.lisp")
; Compiling file: /Users/karstenpoeck/lisp/compiler/clasp/bar.lisp
; (IN-PACKAGE :CL-USER)
; (DEFUN BAR ...)
Writing temporary bitcode file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/bar.bc"
Writing fasl file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/bar.fasl"
#P"/Users/karstenpoeck/lisp/compiler/clasp/bar.fasl"
NIL
NIL
COMMON-LISP-USER> (core:quit)
karsten-poecks-macbook-pro:clasp karstenpoeck$ ~/lisp/compiler/clasp-karsten/build/clasp
*** clasp (../../src/main/main.cc:402): WARNING: Could not set stack size as requested (error code -1 - rlim_max = 16777216) !
*** clasp (../../src/main/main.cc:409): WARNING: Could not set stack size as requested (error code 1 - rlim_max = 67104768) !
Starting cclasp-boehm-0.4.2-1533-gb704da1c9-cst ... loading image...
Top level in: #<PROCESS TOP-LEVEL @0x10e048719>.
COMMON-LISP-USER> (cmp:build-fasl "foo-and-bar.fasb" :lisp-files (list "foo.bc" "bar.bc"))
#P"/Users/karstenpoeck/lisp/compiler/clasp/foo-and-bar.fasb"
COMMON-LISP-USER> (load "/Users/karstenpoeck/lisp/compiler/clasp/foo-and-bar.fasb")
../../src/core/compiler.cc:299 At startup there were two adjacent startup functions with the same position value 0 - this could mean a startup order catastrophe
T
but works fine if done in the same session.
karsten-poecks-macbook-pro:clasp karstenpoeck$ ~/lisp/compiler/clasp-karsten/build/clasp
*** clasp (../../src/main/main.cc:402): WARNING: Could not set stack size as requested (error code -1 - rlim_max = 16777216) !
*** clasp (../../src/main/main.cc:409): WARNING: Could not set stack size as requested (error code 1 - rlim_max = 67104768) !
Starting cclasp-boehm-0.4.2-1533-gb704da1c9-cst ... loading image...
Top level in: #<PROCESS TOP-LEVEL @0x110576819>.
COMMON-LISP-USER> (compile-file "foo.lisp")
; Compiling file: /Users/karstenpoeck/lisp/compiler/clasp/foo.lisp
; (IN-PACKAGE :CL-USER)
; (DEFUN FOO ...)
Writing temporary bitcode file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/foo.bc"
Writing fasl file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/foo.fasl"
#P"/Users/karstenpoeck/lisp/compiler/clasp/foo.fasl"
NIL
NIL
COMMON-LISP-USER> (compile-file "bar.lisp")
; Compiling file: /Users/karstenpoeck/lisp/compiler/clasp/bar.lisp
; (IN-PACKAGE :CL-USER)
; (DEFUN BAR ...)
Writing temporary bitcode file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/bar.bc"
Writing fasl file to: #P"/Users/karstenpoeck/lisp/compiler/clasp/bar.fasl"
#P"/Users/karstenpoeck/lisp/compiler/clasp/bar.fasl"
NIL
NIL
COMMON-LISP-USER> (cmp:build-fasl "foo-and-bar.fasb" :lisp-files (list "foo.bc" "bar.bc"))
#P"/Users/karstenpoeck/lisp/compiler/clasp/foo-and-bar.fasb"
COMMON-LISP-USER> (load #P"/Users/karstenpoeck/lisp/compiler/clasp/foo-and-bar.fasb")
T
COMMON-LISP-USER> (foo)
BAR
COMMON-LISP-USER> (bar)
FOO
the not so nice thing is, that the error happens at load time, not at compile-time
As far as I understand this is a design limitation and will not be changed. Lets revisit when drmeister has the next go a compile-file-parallel