Shinmera / qtools

Qtools is a collection of utilities to aid development with CommonQt
https://shinmera.github.io/qtools
zlib License
209 stars 17 forks source link

qtools: error in foreign library on Windows 10 #20

Open mobius-eng opened 7 years ago

mobius-eng commented 7 years ago

After updating and clearing SBCL & quicklisp, I don't have the previously reported issue with SLIME (#16), now I have an error of loading foreign library

To reproduce

Load Qt:

CL-USER> (ql:quickload '(:qtools :qtcore :qtgui))
To load "qtools":
  Load 1 ASDF system:
    qtools
; Loading "qtools"
....To load "qt":
  Load 1 ASDF system:
    qt
; Loading "qt"
..
> Swapping out QT::LOAD-LIBCOMMONQT for QT-LIBS:LOAD-LIBCOMMONQT.
> Swapping out QT:MAKE-QAPPLICATION for QT-LIBS::MAKE-QAPPLICATION.
> Swapping out QT:ENSURE-SMOKE for QT-LIBS::ENSURE-SMOKE.

To load "qtcore":
  Load 1 ASDF system:
    qtcore
; Loading "qtcore"

To load "qtgui":
  Load 1 ASDF system:
    qtgui
; Loading "qtgui"

(:QTOOLS :QTCORE :QTGUI)

Minimal code from qtools web-site:

(in-package cl-user)

(defpackage :qtexample
  (:use #:cl+qt))

(in-package qtexample)

(in-readtable :qtools)

;; Example from qtools web-site
(define-widget main-window (QWidget)
  ())

(define-subwidget (main-window name) (q+:make-qlineedit main-window)
  (setf (q+:placeholder-text name) "Your name"))

(define-subwidget (main-window go) (q+:make-qpushbutton "Go!" main-window))

(define-subwidget (main-window layout) (q+:make-qhboxlayout main-window)
  (q+:add-widget layout name)
  (q+:add-widget layout go))

(define-signal (main-window name-set) (string))

(define-slot (main-window go) ()
  (declare (connected go (pressed)))
  (declare (connected name (return-pressed)))
  (signal! main-window (name-set string) (q+:text name)))

(define-slot (main-window name-set) ((new-name string))
  (declare (connected main-window (name-set string)))
  (q+:qmessagebox-information main-window "Greetings" new-name))

(with-main-window (window 'main-window))

Error occurs on the last line (BTW, the window does appear, but is non-responsive and no widgets are shown):

An exception occurred in context #.(SB-SYS:INT-SAP #X0D7050E0): #.(SB-SYS:INT-SAP #X0D7061D0). (Exception code: 1073807370)
   [Condition of type SIMPLE-ERROR]

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

Backtrace:
  0: (SB-KERNEL:HANDLE-WIN32-EXCEPTION #.(SB-SYS:INT-SAP #X0D7050E0) #.(SB-SYS:INT-SAP #X0D7061D0))
  1: ("foreign function: #x4338BC")
  2: ("foreign function: #x403891")
  3: ((LABELS QT::ARGLIST-MARSHALLER :IN QT::ARGLIST-MARSHALLER) NIL #<CLOSURE (LAMBDA (QT::STACK) :IN QT::%%CALL) {10070AF90B}>)
  4: (QTOOLS::FIX-SLIME)
  5: ((LABELS QTOOLS::MAIN :IN QTOOLS::MAIN-WINDOW-EXEC))
  6: (QTOOLS::MAIN-WINDOW-EXEC #<FUNCTION (LAMBDA NIL) {1006CD110B}> :NAME NIL :QAPPLICATION-ARGS NIL :BLOCKING T :MAIN-THREAD NIL :ON-ERROR #<FUNCTION INVOKE-DEBUGGER> :SHOW T :FINALIZE T :BEFORE-EXEC #<F..
  7: (SB-INT:SIMPLE-EVAL-IN-LEXENV (WITH-MAIN-WINDOW (WINDOW (QUOTE MAIN-WINDOW))) #<NULL-LEXENV>)
  8: (EVAL (WITH-MAIN-WINDOW (WINDOW (QUOTE MAIN-WINDOW))))
  9: ((LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL))
 10: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME interactive evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL) {1006CC0A1B}>)
 11: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK:INTERACTIVE-EVAL) {1006CC09FB}>)
 12: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:INTERACTIVE-EVAL "(with-main-window (window 'main-window)) ..)
 13: (EVAL (SWANK:INTERACTIVE-EVAL "(with-main-window (window 'main-window)) ..)
 14: (SWANK:EVAL-FOR-EMACS (SWANK:INTERACTIVE-EVAL "(with-main-window (window 'main-window)) ..)
 15: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
 16: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {1008EF0D5B}>)
 17: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "c:/Users/alexe_000/quicklisp/dists/quicklisp/software/slime-v2.19/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL :IN S..
 18: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {100363D533}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {100370F213}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 19: ((LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD))
 20: ((FLET #:WITHOUT-INTERRUPTS-BODY-1138 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 21: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 22: ((FLET #:WITHOUT-INTERRUPTS-BODY-358 :IN SB-THREAD::CALL-WITH-MUTEX))
 23: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {D70FB4B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
 24: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "worker" RUNNING {1006CB57F3}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK::SPAWN-WORKER-THREAD) {1006CB577B}> (#<SB-THREAD:THREAD "worker" RU..
 25: ("foreign function: #x4338BC")
 26: ("foreign function: #x403751")
 27: ("foreign function: #x4501E0")

The same error occurs even if I run the code directly from the command line.

To ensure right Qt libraries are loaded, I put the directory qt-libs\standalone into PATH variable, right at the top. I don't have any other Qt libs installed system-wide, however, there are multiple tools that use local installations (like, Python's matplotlib). So, I'm not sure if qtools picks up the right ones. Is there any way to check that?

System info: Windows 10 64 bit, SBCL 1.3.18 64 bit.

phoe commented 7 years ago

Can confirm that I was getting the same exception on Windows 10 while using qtools, and I don't remember the exact code that triggered it. I'll debug it someday.

The exception in question (1073807370 == 0x4001000A) is detailed at https://ntquery.wordpress.com/2015/09/07/windows-10-new-anti-debug-outputdebugstringw/

mobius-eng commented 7 years ago

Just an update: it seems to be a broader issue, as I have the same problem with cl-cffi-gtk package on Windows 10.

ryukinix commented 7 years ago
Unable to load any of the alternatives:
   ("libssl32.dll" "ssleay32.dll")
   [Condition of type CFFI:LOAD-FOREIGN-LIBRARY-ERROR]

On qtools quicklisp build. Any thougths? System info: Windows 10 64 bit, SBCL 1.3.18 64 bit.

Shinmera commented 7 years ago

@ryukinix This is unrelated to the rest of the ticket. You should install OpenSSL as instructed on the qt-libs page.

ryukinix commented 7 years ago

Thanks. I already fixed installed the Qt Open Source package and a refresh install of quicklisp. Great package, thanks for this. Sorry about the unrelated problem. But I can confirm that problem too after fixed the earlier missing dependency,

phoe commented 4 years ago

https://bugs.launchpad.net/sbcl/+bug/1706516