Search code examples
lispqt4common-lispquicklisp

Can't set up qtools in common-lisp SBCL


I'm a beginner in lisp and I'm unable to find out how to correctly use defpackage to load qtools (on arch linux). For simplicity if I run this example project in sbcl with loaded quicklisp https://github.com/Shinmera/qtools/tree/master/examples/helloworld this error appears

While evaluating the form starting at line 8, column 0
  of #P"/home/william/code/upol/lisp/helloworld/helloworld.lisp":

debugger invoked on a PACKAGE-DOES-NOT-EXIST in thread
#<THREAD "main thread" RUNNING {1000508083}>:
  The name "CL+QT" does not designate any package.

Why "cl+qt" is not provided by any of installed packages with quickload? Here is a list of installed packages $ ls ~/.quicklisp/dists/quicklisp/software

Thanks for help

My resources:

https://github.com/Shinmera/qtools

https://lispcookbook.github.io/cl-cookbook/getting-started.html


Solution

  • Let's look at the example. The order of actions is:

    • compile the .asd file (for example, with C-c C-k). This creates the qtools-helloworld system.
    • load "qtools-helloworld" and its dependencies with Quicklisp: (ql:quickload :qtools-helloworld).
    • compile helloworld.lisp (again, with C-c C-k), and call its functions.

    Also, look at Qtools readme: https://github.com/Shinmera/qtools#qtools-1 It says to install these 3 libraries:

    (ql:quickload '(qtools qtcore qtgui))
    

    The cl+qt package is provided by one of these systems.

    update: the steps required to run the helloworld from the command line are:

    • load the asd definition: rlwrap sbcl --load qtools-helloworld.asd. (rlwrap is just a readline utility)
    • you are dropped into the Lisp REPL. Now we install the dependencies with Quicklisp, that you must have installed first. You type this into the Lisp REPL: (ql:quickload :qtools-helloworld). That is the name defined in the asd.
    • now you can compile the .lisp file: (load "helloworld.lisp):
    * (ql:quickload :qtools-helloworld)
    To load "qtools-helloworld":
      Load 1 ASDF system:
        qtools-helloworld
    ; Loading "qtools-helloworld"
    [package qtools-helloworld]....
    (:QTOOLS-HELLOWORLD)
    
    • it didn't show a GUI. We'll call the main function:

      • (qtools-helloworld::main)

    and you should see the example. If you make changes to the lisp file you can load it again. This use of the REPL in the terminal works but is not as interactive as Lisp can be (far from it). You want your editor to be connected to the REPL and send changes automatically, with a keystroke.

    Check out the Cookbook, editors section, Atom support is very good with SLIMA.

    ps: I find Qtools a little bit difficult, passed running the provided examples. It is not as easily discoverable as other GUIs (like Ltk or IUP). Hope you'll prove me wrong though.

    pps: also https://lispcookbook.github.io/cl-cookbook/gui.html#qt4