Build of 1.0.55 fails on Darwin X86

Bug #957385 reported by Brett van de Sande on 2012-03-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Low
Unassigned

Bug Description

This is on OS X 1.4.11 (yes, I know its old).
When trying to build 1.0.55 from source, during the
"doing warm init - load and dump phase" I get the following error:

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "initial thread" RUNNING {11B31039}>:
  dlerror() returned an error while trying to close runtime: "invalid handle passed to dlclose()"

Any ideas?

The backtrace is:

0: (SB-IMPL::DEINIT)
1: (SAVE-LISP-AND-DIE
    "output/sbcl.core"
    :TOPLEVEL
    NIL
    :EXECUTABLE
    NIL
    :SAVE-RUNTIME-OPTIONS
    NIL
    :PURIFY
    #<unused argument>
    :ROOT-STRUCTURES
    #<unused argument>
    :ENVIRONMENT-NAME
    #<unused argument>
    :COMPRESSION
    NIL)
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV
    (SAVE-LISP-AND-DIE "output/sbcl.core")
    #<NULL-LEXENV>)
3: (EVAL (SAVE-LISP-AND-DIE "output/sbcl.core"))
4: (INTERACTIVE-EVAL (SAVE-LISP-AND-DIE "output/sbcl.core") :EVAL NIL)
5: (SB-IMPL::REPL-FUN NIL)
6: ((LAMBDA () :IN SB-IMPL::TOPLEVEL-REPL))
7: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX
    #<CLOSURE (LAMBDA # :IN SB-IMPL::TOPLEVEL-REPL) {11B34165}>)
8: (SB-IMPL::TOPLEVEL-REPL NIL)
9: (SB-IMPL::TOPLEVEL-INIT)
10: ((FLET #:WITHOUT-INTERRUPTS-BODY-269550 :IN #:!COLD-INIT))
11: (#:!COLD-INIT)

Nikodemus Siivola (nikodemus) wrote :

I'm fairly sure this is due to sad state of dlopen/close in earlier Darwin versions.

Try this (replacing the current definition in unix-foreign-load.lisp):

  (defun dlclose-or-lose (&optional (obj nil objp))
    (dlerror)
    (let (dlerror)
      (cond ((and (not objp) *runtime-dlhandle*)
             ;; CLH: if we're on sufficiently old darwin we can't close
             ;; *runtime-dlhandle* for some reason, so don't.
             #!-darwin
             (dlclose *runtime-dlhandle*)
             (setf dlerror (dlerror)
                   *runtime-dlhandle* nil))
            ((and objp (shared-object-handle obj))
             (dlclose (shared-object-handle obj))
             (setf dlerror (dlerror)
                   (shared-object-handle obj) nil)))
      (when dlerror
        (cerror "Ignore the error and continue as if closing succeeded."
                "dlerror() returned an error while trying to close ~
                 ~:[runtime~;shared object ~:*~S~]: ~S"
                (when obj (shared-object-namestring obj))
                dlerror))))

Nikodemus Siivola (nikodemus) wrote :

(Mind you, I'm mildly surprised if this is enough to get current SBCL running on 1.4.11... but maybe it is.)

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → Low
status: New → In Progress
Brett van de Sande (bvds) wrote :

Yes, it did the trick. Otherwise it starts up OK. I haven't done much testing yet, though.

Nikodemus Siivola (nikodemus) wrote :

commit c712f88b26cd7547ee984b90e18c134401335bc3
Author: Nikodemus Siivola <email address hidden>
Date: Sun Oct 7 15:20:21 2012 +0300

    don't close runtime dlhandle on Darwin

      On newish Darwin it works, but some people still run old enough
      version that it won't work. As long as we're not explicitly checking
      for "Darwin new enough?", let's try not to break...

      Fixes lp#957385

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Stas Boukarev (stassats) on 2012-12-08
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers