Lovesan / bike

Common Lisp .Net Core Interop
MIT License
144 stars 5 forks source link

Quickload error #10

Open PersonalityEngineer opened 2 years ago

PersonalityEngineer commented 2 years ago

Not sure if its something I did or not, pardon! SBCL built from source using CCL, I get the same issue with the older ubuntu apt SBCL too.

` This is SBCL 2.2.3, an implementation of ANSI Common Lisp. More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information.

`

rn7s2 commented 2 years ago

My SBCL was installed from sbcl-2.2.3-x86-64-windows-binary.msi.

And I got an error while loading:

PS C:\Users\rn7s2> sbcl
This is SBCL 2.2.3, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload :bike)
To load "bike":
  Load 6 ASDF systems:
    alexandria asdf bordeaux-threads cffi trivial-features
    uiop
  Install 7 Quicklisp releases:
    bike cl-ppcre flexi-streams named-readtables
    split-sequence trivial-garbage trivial-gray-streams
; Fetching #<URL "http://beta.quicklisp.org/archive/named-readtables/2022-03-31/named-readtables-20220331-git.tgz">
; 25.99KB
==================================================
26,611 bytes in 0.26 seconds (100.30KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-garbage/2021-12-30/trivial-garbage-20211230-git.tgz">
; 10.74KB
==================================================
10,996 bytes in 0.00 seconds (2637.75KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/split-sequence/2021-05-31/split-sequence-v2.0.1.tgz">
; 11.43KB
==================================================
11,705 bytes in 0.02 seconds (753.11KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-gray-streams/2021-01-24/trivial-gray-streams-20210124-git.tgz">
; 7.86KB
==================================================
8,046 bytes in 0.00 seconds (6414.22KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/flexi-streams/2022-02-20/flexi-streams-20220220-git.tgz">
; 435.47KB
==================================================
445,922 bytes in 1.34 seconds (324.02KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-ppcre/2022-02-20/cl-ppcre-20220220-git.tgz">
; 153.70KB
==================================================
157,392 bytes in 0.93 seconds (164.62KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/bike/2021-10-20/bike-20211020-git.tgz">
; 72.44KB
==================================================
74,178 bytes in 0.64 seconds (112.62KB/sec)
; Loading "bike"
..................................................
[package cl-ppcre]................................
..................................................
[package split-sequence]..........................
[package impl-specific-gray]......................
[package trivial-gray-streams]....................
[package flexi-streams]...........................
..................................................
..................................................
..................................................
[package trivial-garbage].........................
[package editor-hints.named-readtables]...........
[package editor-hints.named-readtables]...........
..................................................
..................................................
.......................
debugger invoked on a DOTNET-ERROR in thread
#<THREAD "main thread" RUNNING {1002338003}>:
  .Net exception System.BadImageFormatException
Could not load file or assembly 'System.IO.Compression.Native, Culture=neutral, PublicKeyToken=null'. The module was expected to contain an assembly manifest.
   at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(String assemblyString)
   at lambda_method10(Closure , IntPtr , IntPtr& , Int32& , IntPtr& )

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [TRY-RECOMPILING              ] Recompile assemblies and try loading it again
  1: [RETRY                        ] Retry
                                     loading FASL for #<CL-SOURCE-FILE "bike" "src" "assemblies">.
  2: [ACCEPT                       ] Continue, treating
                                     loading FASL for #<CL-SOURCE-FILE "bike" "src" "assemblies">
                                     as having been successful.
  3:                                 Retry ASDF operation.
  4: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
                                     configuration.
  5:                                 Retry ASDF operation.
  6:                                 Retry ASDF operation after resetting the
                                     configuration.
  7: [ABORT                        ] Give up on "bike"
  8: [REGISTER-LOCAL-PROJECTS      ] Register local projects and try again.
  9:                                 Exit debugger, returning to top level.

(%LOAD-ASSEMBLY "System.IO.Compression.Native")
   source: (%TRANSFORM-EXCEPTION (MEM-REF #:EX651 :POINTER))
0]

.Net exception System.BadImageFormatException

So I think I should try to rebuild named-readtables and see what's happening.

Lovesan commented 2 years ago

Maybe this has something to do with .NET 6. I'll take a look at this.

Lovesan commented 2 years ago

@rn7s2 Your issue has been fixed in the latest commit

rn7s2 commented 2 years ago

Great Thank you for your quick fix

jolby commented 1 year ago

Hello! I want to thank you for creating this project. I'm interested in trying to see if sbcl + Avalonia GUI can work together. I ran into this floating point error while loading this on both linux/.NET-7.0 and win11/.NET-7. I was able to get the project to load as well as run the tests if I eval'd this form prior to (ql:quickload :bike): (sb-vm::set-floating-point-modes :traps nil)

This is probably not optimal, but at least it allows forward progress to run this system.

Lovesan commented 1 year ago

@jolby Thanks! The solution is indeed suboptimal, but at least it works

Lovesan commented 1 year ago

Apparently, there's something going on with NaN on one of the .Net background threads. Maybe inside the GC thread?

The following disables NaN-related exceptions on SBCL:

(sb-vm::set-floating-point-modes :traps (remove :invalid (getf (sb-vm::get-floating-point-modes) :traps)))

On CCL:

(ccl:set-fpu-mode :invalid nil)

Also, there's https://shinmera.github.io/float-features/ library for handling such kind of things.

Lovesan commented 8 months ago

ECL workaround: (ext:trap-fpe 'floating-point-invalid-operation nil)