armedbear / abcl

Armed Bear Common Lisp <git+https://github.com/armedbear/abcl/> <--> <svn+https://abcl.org/svn> Bridge
https://abcl.org#rdfs:seeAlso<https://gitlab.common-lisp.net/abcl/abcl>
Other
289 stars 29 forks source link

Cannot `(require :jss)` on OpenJDK 17 (breaks cffi) #484

Closed Uthar closed 2 years ago

Uthar commented 2 years ago

Discovered while trying to load cffi.

Versions used:

CL-USER(3): (lisp-implementation-version)
"1.8.0"
"OpenJDK_64-Bit_Server_VM-Oracle_Corporation-17.0.1+12-nixos"
"amd64-Linux-5.10.81"

Commands to reproduce the problem:

CL-USER(3): (require :asdf)
("uiop" "UIOP" "asdf" "ASDF")
CL-USER(7): (require :abcl-contrib)
("JAVA" "ABCL-CONTRIB")
CL-USER(8): (require :jss)
ASDF could not load  because Java exception 'java.lang.reflect.InaccessibleObjectException: Unable to make public java.lang.String java.util.jar.JarFile$JarFileEntry.getName() accessible: module java.base does not "opens java.util.jar" to unnamed module @da368df'..
Error loading /home/kpg/.cache/common-lisp/abcl-1.8.0-fasl43-linux-x64/nix/store/p5v6ixq6k75bkx3w6rbah64qlw0yxrfy-abcl-1.8.0/lib/abcl/abcl-contrib.jar/jss/invoke.abcl at line 173 (offset 15542)
#<THREAD "interpreter" {3B85B4FB}>: Debugger invoked on condition of type JAVA-EXCEPTION
  Java exception 'java.lang.reflect.InaccessibleObjectException: Unable to make public java.lang.String java.util.jar.JarFile$JarFileEntry.getName() accessible: module java.base does not "opens java.util.jar" to unnamed module @da368df'.
Restarts:
  0: TRY-RECOMPILING               Recompile invoke and try loading it again
  1: RETRY                         Retry loading FASL for #<ASDF/LISP-ACTION:CL-SOURCE-FILE "jss" "base" "invoke">.
  2: ACCEPT                        Continue, treating loading FASL for #<ASDF/LISP-ACTION:CL-SOURCE-FILE "jss" "base" "invoke"> as having been successful.
  3: RETRY                         Retry ASDF operation.
  4: CLEAR-CONFIGURATION-AND-RETRY Retry ASDF operation after resetting the configuration.
  5: RETRY                         Retry ASDF operation.
  6: CLEAR-CONFIGURATION-AND-RETRY Retry ASDF operation after resetting the configuration.
  7: TOP-LEVEL                     Return to top level.
[1] JSS(9): 
alanruttenberg commented 2 years ago

How did you start Java? I think that mine breaks without

--add-opens" "java.base/java.util=ALL-UNNAMED
Uthar commented 2 years ago

I was running java -cp "abcl.jar:abcl-contrib.jar" org.armedbear.lisp.Main.

But you're right, after adding --add-opens=java.base/java.util.jar=ALL-UNNAMED I can load CFFI with JDK 17. Thanks :-)

alanruttenberg commented 2 years ago

BTW, you mention CFFI. Do you use it? I had submitted https://github.com/armedbear/abcl/issues/431 - let me know if you run into anything similar.

Uthar commented 2 years ago

With ABCL I use CFFI for SQLite bindings, but had no problems at all.

alanruttenberg commented 2 years ago

Thanks, @Uthar I'll try again. Which toois do you use for CFFI, or do you hand write the functions you need? Thanks, Alan

Uthar commented 2 years ago

Usually I am lucky and a library already exists, for sqlite i use this.

Some time ago I was also using FFmpeg from Lisp, there was no library so I wrote it by hand. But only the parts I needed: link

I haven't used any of the grovellers yet, but maybe some day. It sounds better than rewriting header files manually.