cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.99k stars 987 forks source link

Boot files with compiled libraries fail to load #69

Open burgerrg opened 8 years ago

burgerrg commented 8 years ago

A.ss:

(library (A)
  (export A)
  (import (scheme))
  (define A 12))
% scheme
Chez Scheme Version 9.4.1
Copyright 1984-2016 Cisco Systems, Inc.

> (compile-file "A")
compiling A.ss with output to A.so
> (make-boot-file "A.boot" '("scheme") "A.so")
> (exit)
% scheme -b ./A.boot
Exception in compiler-internal: install-library/rt-code: unable to install invoke code for non-existant library #{A eldnidvc3vkegxvd5huz435gj-0}

This worked in Chez Scheme 8.4.1. Also, non-existent is misspelled.

burgerrg commented 8 years ago

Perhaps the load procedure in c/scheme.c does not handle the library/rt-info and library/ct-info records that run-inner of do-load-binary in s/7.ss does?

dybvig commented 8 years ago

That's correct. The c-coded boot-file loader has no way to talk with the Scheme-coded library manager. One way to fix this would be to switch from the C-coded loader to the Scheme-coded loader once the latter is in place. It might also be possible to have the C-coded loader invoke Scheme-coded library-manager procedures. I don't know whether there are other issues with compiled libraries in boot files.

owaddell commented 6 years ago

The first commit on this branch is a quick stab at this. I restricted it to the non-procedure case of non-base boot files to limit overhead in the common case.

burgerrg commented 6 years ago

Thanks, pull request https://github.com/cisco/ChezScheme/pull/288 fixed this.

owaddell commented 6 years ago

The load and handle_visit_revisit code in scheme.c silently ignore unexpected values, but my change has us now going through run-inner, which is not so forgiving.

Should $make-load-binary take a for-boot? flag that makes run-inner tolerate unexpected values?

jltaylor-us commented 3 years ago

Is this issue resolved?