Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method and generic function differ in whether they accept &REST or &KEY arguments for NYXT:FFI-WINDOW-SET-BUFFER #1441

Closed
svetlyak40wt opened this issue May 21, 2021 · 5 comments
Labels

Comments

@svetlyak40wt
Copy link

svetlyak40wt commented May 21, 2021

Trying to compile Nyxt for OSX under SBCL

Unhandled SB-INT:SIMPLE-PROGRAM-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING
                                                   {1001540943}>:
  attempt to add the method
    #<STANDARD-METHOD (#<STANDARD-CLASS NYXT:QT-WINDOW>
                       #<STANDARD-CLASS NYXT:QT-BUFFER>) {1007E4CD33}>
  to the generic function
    #<STANDARD-GENERIC-FUNCTION NYXT:FFI-WINDOW-SET-BUFFER (1)>;
   but the method and generic function differ in whether they accept
  &REST or &KEY arguments.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001540943}>
0: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SB-INT:SIMPLE-PROGRAM-ERROR "~@<attempt to add the method~2I~_~S~I~_to the generic function~2I~_~S;~I~_ but ~?~:>" {1007E4D143}> #<unused argument> :QUIT T)
1: (SB-DEBUG::RUN-HOOK SB-EXT:*INVOKE-DEBUGGER-HOOK* #<SB-INT:SIMPLE-PROGRAM-ERROR "~@<attempt to add the method~2I~_~S~I~_to the generic function~2I~_~S;~I~_ but ~?~:>" {1007E4D143}>)
2: (INVOKE-DEBUGGER #<SB-INT:SIMPLE-PROGRAM-ERROR "~@<attempt to add the method~2I~_~S~I~_to the generic function~2I~_~S;~I~_ but ~?~:>" {1007E4D143}>)
3: (ERROR #<SB-INT:SIMPLE-PROGRAM-ERROR "~@<attempt to add the method~2I~_~S~I~_to the generic function~2I~_~S;~I~_ but ~?~:>" {1007E4D143}>)
4: (SB-PCL::REAL-ADD-METHOD #<STANDARD-GENERIC-FUNCTION NYXT:FFI-WINDOW-SET-BUFFER (1)> #<STANDARD-METHOD (#<STANDARD-CLASS NYXT:QT-WINDOW> #<STANDARD-CLASS NYXT:QT-BUFFER>) {1007E4CD33}> NIL)
5: (SB-PCL::REAL-ADD-NAMED-METHOD FFI-WINDOW-SET-BUFFER NIL (#<STANDARD-CLASS NYXT:QT-WINDOW> #<STANDARD-CLASS NYXT:QT-BUFFER>) (WINDOW BUFFER) SB-PCL::SOURCE #S(SB-C:DEFINITION-SOURCE-LOCATION :NAMESTRING "/Users/art/projects/lisp/nyxt/source/renderer-qt.lisp" :INDICES 622593) :FUNCTION #<%METHOD-FUNCTION (LAMBDA (SB-PCL::METHOD-ARGS SB-PCL::NEXT-METHODS) :IN SB-PCL::METHOD-FUNCTION-FROM-FAST-FUNCTION) {1007E4C2BB}> SB-PCL::PLIST (:NAME (SB-PCL::SLOW-METHOD FFI-WINDOW-SET-BUFFER (QT-WINDOW QT-BUFFER)) :ARG-INFO (2)) SB-PCL::SIMPLE-NEXT-METHOD-CALL T :DOCUMENTATION "Set BROWSER's WINDOW buffer to BUFFER.")
6: (SB-PCL::LOAD-DEFMETHOD-INTERNAL STANDARD-METHOD FFI-WINDOW-SET-BUFFER NIL (#<STANDARD-CLASS NYXT:QT-WINDOW> #<STANDARD-CLASS NYXT:QT-BUFFER>) (WINDOW BUFFER) (:FUNCTION #<%METHOD-FUNCTION (LAMBDA (SB-PCL::METHOD-ARGS SB-PCL::NEXT-METHODS) :IN SB-PCL::METHOD-FUNCTION-FROM-FAST-FUNCTION) {1007E4C2BB}> SB-PCL::PLIST (:ARG-INFO (2)) SB-PCL::SIMPLE-NEXT-METHOD-CALL T :DOCUMENTATION "Set BROWSER's WINDOW buffer to BUFFER.") #S(SB-C:DEFINITION-SOURCE-LOCATION :NAMESTRING "/Users/art/projects/lisp/nyxt/source/renderer-qt.lisp" :INDICES 622593))
7: ((SB-C::TOP-LEVEL-FORM (SB-PCL::LOAD-DEFMETHOD (QUOTE STANDARD-METHOD) (QUOTE FFI-WINDOW-SET-BUFFER) (QUOTE NIL) (LIST (FIND-CLASS (QUOTE QT-WINDOW)) (FIND-CLASS (QUOTE QT-BUFFER))) (QUOTE (WINDOW BUFFER)) (LIST* :FUNCTION (LET* (#1=# #1#) (SETF #1# #1#) SB-PCL::MF) (QUOTE (SB-PCL::PLIST #1# SB-PCL::SIMPLE-NEXT-METHOD-CALL T :DOCUMENTATION "Set BROWSER's WINDOW buffer to BUFFER."))) (SB-C:SOURCE-LOCATION)))) [toplevel]
8: (SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for "file /Users/art/.cache/common-lisp/sbcl-2.1.4-macosx-x64/Users/art/projects/lisp/nyxt/source/renderer-qt.fasl" {1007DF0303}> :TABLE #(1010 SET *PACKAGE* "NYXT" #<PACKAGE "SB-PCL"> SB-PCL::LOAD-DEFCLASS #<PACKAGE "NYXT"> QT-BROWSER STANDARD-CLASS LIST LIST* :INITFUNCTION ...) :STACK #(0 #<FUNCTION (SB-C::TOP-LEVEL-FORM (SB-PCL::LOAD-DEFMETHOD (QUOTE STANDARD-METHOD) (QUOTE FFI-WINDOW-SET-BUFFER) (QUOTE NIL) (LIST # #) (QUOTE #) (LIST* :FUNCTION # #) (SB-C:SOURCE-LOCATION))) {1007E38D7B}> 74248 SB-VM::CONS->RNN 72200 SB-PCL::FIND-CLASS-FROM-CELL 69320 SB-PCL::FIND-CLASS-FROM-CELL 62536 SB-PCL::LOAD-DEFMETHOD 55368 STANDARD-METHOD ...) :NAME-BUFFER #("USER-WINDOWVIEW" "NULL-POINTERET-BUFFEROWDFIERTTEIGHT") :DEPRECATED-STUFF NIL :SKIP-UNTIL NIL) NIL)
9: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /Users/art/.cache/common-lisp/sbcl-2.1.4-macosx-x64/Users/art/projects/lisp/nyxt/source/renderer-qt.fasl" {1007DF0303}> NIL NIL)

Information

  • OSX Catalina 10.15.6:
  • Build from source):
  • Information from command copy-system-information:
    • Nyxt version 2.0.0 (git hash decfe51)
    • Lisp: SBCL 2.1.4

I'm building with NYXT_RENDERER=qt.

@jmercouris
Copy link
Member

Qt will not build under current master. Latest supported version is ~1.5. We would need to bring it up to date! In the meantime, there is hope at least for WebKitGTK+, they are making progress for it on NixOS. Sorry about the problem!

@shakatoday
Copy link
Contributor

Tried to skip the argument problem
the method and generic function differ in whether they accept &REST or &KEY arguments.
by

--- a/source/renderer-qt.lisp
+++ b/source/renderer-qt.lisp
@@ -124,7 +124,7 @@
         (or (find-if #'qt:widget-is-active-window (window-list) :key #'qt-object)
             (slot-value browser 'last-active-window))))

-(defmethod ffi-window-set-buffer ((window qt-window) (buffer qt-buffer))
+(defmethod ffi-window-set-buffer ((window qt-window) (buffer qt-buffer) &key focus)
   "Set BROWSER's WINDOW buffer to BUFFER."
   (qt:widget-set-parent (qt-object (active-buffer window)) (cffi:null-pointer))
   (qt:layout-insert-widget (box-layout window) 0 (qt-object buffer))

Still got

arithmetic error DIVISION-BY-ZERO signalled
   [Condition of type DIVISION-BY-ZERO]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1001550143}>)

Backtrace:
  0: ("bogus stack frame")
  1: ("foreign function: _ZNK20CUICoreThemeRenderer19CopyCustomColorCoreEPK10__CFStringPK14__CFDictionary")
  2: ("foreign function: _ZNK11CUIRenderer26CopyCustomColorWithOptionsEPK10__CFStringPK14__CFDictionary")
  3: ("foreign function: CUICopyCustomColorWithOptions")
  4: ("foreign function: __44-[NSAppearance _copyCustomCGColor:withTint:]_block_invoke")
  5: ("foreign function: -[NSCompositeAppearance _callCoreUIWithBlock:options:requireBezelTintColor:]")
  6: ("foreign function: -[NSAppearance _copyCustomCGColor:withTint:]")
  7: ("foreign function: -[NSAppearance _customColor:withTint:]")
  8: ("foreign function: -[NSDynamicModifiedColor resolvedColor]")
  9: ("foreign function: -[NSDynamicNamedColor colorUsingColorSpaceName:device:]")
 10: ("foreign function: -[NSDynamicNamedColor colorUsingColorSpaceName:device:]")
 11: ("foreign function: _Z15qt_mac_toQBrushPK7NSColorN8QPalette10ColorGroupE")
 12: ("foreign function: qt_plugin_instance")
 13: ("foreign function: qt_plugin_instance")
 14: ("foreign function: _ZNK19QApplicationPrivate11basePaletteEv")
 15: ("foreign function: _ZN22QGuiApplicationPrivate10setPaletteERK8QPalette")
 16: ("foreign function: _ZN22QGuiApplicationPrivate4initEv")
 17: ("foreign function: _ZN19QApplicationPrivate4initEv")
 18: ("foreign function: newQApplication")
 19: (CL-WEBENGINE:NEW-Q-APPLICATION :INVALID-VALUE-FOR-UNESCAPED-REGISTER-STORAGE :INVALID-VALUE-FOR-UNESCAPED-REGISTER-STORAGE)
 20: ((:METHOD NYXT:FFI-INITIALIZE (NYXT:QT-BROWSER T T)) #<NYXT:USER-BROWSER {1006AB0CD3}> NIL @2021-06-08T14:14:10.125536+08:00) [fast-method]
 21: (NYXT:START)

On WebKitGTK+ side, MacPorts doesn't provide WebKitGTK+ >= 2.32.0. Older versions are insecure.
I failed to build WebKitGTK+ 2.32.1 from source on my Mac. (omitted what happened....)

Anyway, it seems that Nyxt is not safe with WebKitGTK+ on Mac for now, while qt version doesn't work either.
Which is the next step to do? Shall we move qt version up to date first? Or shall we solve the WebKit compatibility on Mac?

Shall we use Clozure CL and apply its interface to Webkit for Mac version rather than GTK+ port version of Webkit?

@Ambrevar
Copy link
Member

Shall we use Clozure CL and apply its interface to Webkit for Mac version rather than GTK+ port version of Webkit?

If I'm not mistaken, this is how early Nyxt versions (Next back then) used to work.
macOS' WebKit API is very limited though, it didn't cut it for Nyxt, which is why we had to move to WebKitGTK.

Shall we move qt version up to date first?

This is very high on my priority list. It takes time and effort, so a helping hand is always welcome :)

About WebKitGTK: It's unclear whether Brew or MacPorts will fix the package, but things are moving on the Nix front: NixOS/nixpkgs#126082.
This is probably our best shot.

@Ambrevar Ambrevar added the macos label Jun 10, 2021
@kchanqvq
Copy link
Contributor

kchanqvq commented Dec 23, 2021

I'm having the same DIVISION-BY-ZERO problem, when calling newQApplication. Calling it directly from C (by building interface.cpp as a executable) however works, weird.

Update: this problem is exclusive to SBCL. Clozure CL does not have this specific problem.

@aadcg
Copy link
Member

aadcg commented May 28, 2023

See #577 for a discussion on how to pursue macOS support.

Nyxt plans to support macOS in version 4.0.0.

Stay tuned @svetlyak40wt, your feedback will be very welcomed. Thank you for your work in the CL community.

@aadcg aadcg closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

6 participants