Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#963 closed defect (fixed)

The value NIL is not of the expected type ARRAY in function called from RESTORE-LISP-POINTERS

Reported by: pjb@… Owned by: gb
Priority: normal Milestone:
Component: IDE Version: trunk
Keywords: Cc:

Description

I'm compiling a program using cffi 0.10.6 and iolib 0.7.3 (from quicklisp current). It works nicely on linux x86_64, but fails to launch on darwin x86 32bit.

Same problem in 1.8 and in 1.9-dev-r15354M-trunk. b

[pjb@galatea kuiper:0.0 src]$ make cli && ./lse
/data/languages/ccl/bin/ccl --no-init --load  generate-cli.lisp | tee /tmp/lse-build.log

/Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/home/pjb/src/git/pjb/nasium-lse/src/
To load "com.informatimago.lse.cli":
  Load 1 ASDF system:
    com.informatimago.lse.cli
; Loading "com.informatimago.lse.cli"
..................................................
[package com.informatimago.rdp]...................
..................................................
[package com.informatimago.logger]................
[package com.informatimago.signal]................
[package com.informatimago.environment]...........
[package com.informatimago.lse.os]................
[package com.informatimago.lse.byte-code].........
[package com.informatimago.lse.identifiers].......
[package com.informatimago.lse]...................
..................................................
..................................................
..................................................
[package trivial-garbage].
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/pkgdcl.lisp"...........................
[package iolib.syscalls]
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/unix-syscall-path-strings.lisp".........
; cc -m32 -I/Users/pjb/quicklisp/dists/quicklisp/software/cffi_0.10.6/ -fPIC -o /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-types-unix.c
; /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-types-unix.grovel-tmp.lisp
..
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/conditions.lisp".........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/os-conditions-unix.lisp"...............
..........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/designators.lisp"...........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/early.lisp".......
; cc -m32 -I/Users/pjb/quicklisp/dists/quicklisp/software/cffi_0.10.6/ -bundle -fPIC -o /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/libiolib-syscalls.dylib /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-wrappers-unix.c
.
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/ffi-functions-unix.lisp"..............................
.........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/pkgdcl.lisp"............................................
[package iolib.multiplex]
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/utils.lisp"...
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/timers.lisp".....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/queue.lisp".....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/scheduler.lisp"....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/fd-entry.lisp".....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/multiplexer.lisp".....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/event-loop.lisp"..........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/fd-wait.lisp"......
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/backend-select.lisp"........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/backend-kqueue.lisp"....
....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/multiplex/detect.lisp"...
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/pkgdcl.lisp".................................................
[package iolib.streams]
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/classes.lisp".....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/conditions.lisp"...
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/buffer.lisp"......
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/fd-mixin.lisp"....
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/io-helpers.lisp"..........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/streams/gray/gray-stream-methods.lisp".............
....
[package iolib.serial]; cc -m32 -I/Users/pjb/quicklisp/dists/quicklisp/software/cffi_0.10.6/ -fPIC -o /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-types-unix.c
; /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-types-unix.grovel-tmp.lisp
; cc -m32 -I/Users/pjb/quicklisp/dists/quicklisp/software/cffi_0.10.6/ -fPIC -o /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-constants-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-constants-unix.c
; /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-constants-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/local-projects/iolib.termios/ffi-termios-constants-unix.grovel-tmp.lisp
..........
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/pathnames/pkgdcl.lisp".....................
[package iolib.pathnames]
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/pathnames/file-path.lisp"......
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/pathnames/file-path-unix.lisp".......
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/pkgdcl.lisp".....................
[package iolib.os]
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/os-unix.lisp".....................
; cc -m32 -I/Users/pjb/quicklisp/dists/quicklisp/software/cffi_0.10.6/ -fPIC -o /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/ffi-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/ffi-types-unix.c
; /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/ffi-types-unix /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/ffi-types-unix.grovel-tmp.lisp
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/ffi-functions-unix.lisp".......
;Compiling "/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/os/create-process-unix.lisp".............
...
...............................................
[package trivial-gray-streams]....................
..................................................
[package com.informatimago.clext.gnu-ld-script]...
[package com.informatimago.lse.unix-terminal].....
[package com.informatimago.lse.cli].............
To load "com.informatimago.manifest":
  Load 1 ASDF system:
    com.informatimago.manifest
; Loading "com.informatimago.manifest"
[package com.informatimago.manifest].


Running a few tests.

Generating lse-ccl-darwin-apple-11.3.0-i386
ccl:save-application will exit.
awk '/Generating/{print $2}' < /tmp/lse-build.log | ( read executable ; rm -f lse ; ln -sf $executable lse )
Error during early application initialization:

The value NIL is not of the expected type ARRAY.
? for help
[74255] Clozure CL kernel debugger: B
current thread: tcr = 0x135820, native thread ID = 0x707, interrupts disabled


(#x0034BF80) #x0407096D : #<Function ARRAY-DATA-AND-OFFSET #x04070926> + 71
(#x0034BF90) #x04070665 : #<Function DEREFERENCE-BASE-STRING #x0407062E> + 55
(#x0034BFA0) #x04070275 : #<Function %CSTR-SEGMENT-POINTER #x040701BE> + 183
(#x0034BFC8) #x04085C35 : #<Function REOPEN-USER-LIBRARIES #x04085B56> + 223
(#x0034BFE0) #x04088155 : #<Function REFRESH-EXTERNAL-ENTRYPOINTS #x040880CE> + 135
(#x0034BFE8) #x04A38765 : #<Function RESTORE-LISP-POINTERS #x04A386D6> + 143
[74255] Clozure CL kernel debugger: :q
[74255] Clozure CL kernel debugger: [74255] Clozure CL kernel debugger: K
Killed: 9
[pjb@galatea kuiper:0.0 src]$ grep ccl Makefile
CCL            = /data/languages/ccl/bin/ccl --no-init
[pjb@galatea kuiper:0.0 src]$ /data/languages/ccl/bin/ccl --version
Version 1.9-dev-r15354M-trunk  (DarwinX8632)

Change History (5)

comment:1 Changed 8 years ago by pjb@…

The shared-libraries before and after saving the image:


Generating lse-ccl-darwin-apple-11.3.0-i386

#<shlib /Users/pjb/.cache/common-lisp/ccl-1.9-f95-macosx-x86/Users/pjb/quicklisp/dists/quicklisp/software/iolib-0.7.3/src/syscalls/libiolib-syscalls.dylib #xE9331DE> 
#<shlib /usr/lib/system/libxpc.dylib #xC00672E> 
#<shlib /usr/lib/system/libunwind.dylib #xC006756> 
#<shlib /usr/lib/system/libunc.dylib #xC00677E> 
#<shlib /usr/lib/system/libsystem_sandbox.dylib #xC0067A6> 
#<shlib /usr/lib/system/libsystem_notify.dylib #xC0067CE> 
#<shlib /usr/lib/system/libsystem_network.dylib #xC0067F6> 
#<shlib /usr/lib/system/libsystem_kernel.dylib #xC00681E> 
#<shlib /usr/lib/system/libsystem_info.dylib #xC006846> 
#<shlib /usr/lib/system/libsystem_dnssd.dylib #xC00686E> 
#<shlib /usr/lib/system/libsystem_c.dylib #xC006896> 
#<shlib /usr/lib/system/libsystem_blocks.dylib #xC0068BE> 
#<shlib /usr/lib/system/libremovefile.dylib #xC0068E6> 
#<shlib /usr/lib/system/libquarantine.dylib #xC00690E> 
#<shlib /usr/lib/system/libmathCommon.A.dylib #xC006936> 
#<shlib /usr/lib/system/libmacho.dylib #xC00695E> 
#<shlib /usr/lib/system/liblaunch.dylib #xC006986> 
#<shlib /usr/lib/system/libkeymgr.dylib #xC0069AE> 
#<shlib /usr/lib/system/libdyld.dylib #xC0069D6> 
#<shlib /usr/lib/system/libdnsinfo.dylib #xC0069FE> 
#<shlib /usr/lib/system/libdispatch.dylib #xC006A26> 
#<shlib /usr/lib/system/libcopyfile.dylib #xC006A4E> 
#<shlib /usr/lib/system/libcompiler_rt.dylib #xC006A76> 
#<shlib /usr/lib/system/libcommonCrypto.dylib #xC006A9E> 
#<shlib /usr/lib/system/libcache.dylib #xC006AC6> 
#<shlib /usr/lib/libSystem.B.dylib #xC006AEE> 
ccl:save-application will exit.
awk '/Generating/{print $2}' < /tmp/lse-build.log | ( read executable ; rm -f lse ; ln -sf $executable lse )
Error during early application initialization:

The value NIL is not of the expected type ARRAY.
? for help

[74717] Clozure CL kernel debugger: S

 symbol name : ccl::*shared-libraries*
Can't find symbol.
[74717] Clozure CL kernel debugger: S

 symbol name :ccl::*shared-libraries*
Can't find symbol.
[74717] Clozure CL kernel debugger: S

 symbol name :"*SHARED-LIBRARIES*"
Can't find symbol.
[74717] Clozure CL kernel debugger: S

 symbol name :*SHARED-LIBRARIES*
Symbol *SHARED-LIBRARIES* at #x801264E
  value    : (#<(SHLIB . #<(# . #) @#x0801375E>) @#x0E8BCAFE> #<(SHLIB . #<(# . #) @#x0801375E>) @#x0C00672E> #<(SHLIB . #<(# . #) @#x0801375E>) @#x0C006756> #<(SHLIB . #<(# . #) @#x0801375E>) @#x0C00677E> #<(SHLIB . #<(# . #) @#x0801375E>) @#x0C0067A6> #<(SHLIB . ...
[74717] Clozure CL kernel debugger: 

comment:2 Changed 8 years ago by pjb@…

By patching reopen-user-libraries like this it seems to work better:

(defun reopen-user-libraries ()
  (dolist (lib *shared-libraries*)
    (setf (shlib.handle lib) nil
	  (shlib.base lib) nil))
  (dolist (lib *shared-libraries*)
    (when  (shlib.soname lib)
      (with-cstrs ((cname (shlib.soname lib)))
        (let* ((handle (ff-call *dlopen-entry*
                                :address cname
                                :int (logior #$RTLD_GLOBAL #$RTLD_NOW)
                                :address)))
          (unless (%null-ptr-p handle)
            (setf (shlib.handle lib) handle)))))))

comment:3 Changed 8 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

If you got a runtime type error while trying to add 1 to NIL, you could either:

  1. fix whatever code was trying to add 1 to NIL
  2. "fix" the function + to silently ignore NIL.

(a) makes sense; (b) is pretty ridiculous, but it's analogous to what you're suggesting above.

An object used to represent a shared library in CCL (a "SHLIB") should have a string in its SHLIB.SONAME slot (There's no way to create a SHLIB in CCL where this is not true, and there's no code in CCL that intentionally modifies a SHLIB's SONAME.) If you make REOPEN-USER-LIBRARIES ignore this anomalous case, the image won't error on startup but the library won't be opened, either.

The real bug here is that something somewhere is setting that SHLIB's SONAME slot to NIL, presumably between the time that the shared library is opened and the time that the image is saved. It's possible that this is a CCL bug, it's also possible that it isn't. I don't know. If I had a reproducible test case, I'd try to find out.

comment:4 Changed 8 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [15355]) If a Darwin shared library is linked without the -install_name option, ccl::soname-from-mach-header will return NIL; don't blindly clobber shlib.soname in that case. (Non-toy libraries probably want to have an "install_name", but we should handle the case where they don't.)

Fixes ticket:963 in the trunk.

comment:5 Changed 8 years ago by gb

(In [15357]) Propagate r15355 to 1.8. Fixes ticket:963 in 1.8.

Note: See TracTickets for help on using tickets.