multitrainer icon indicating copy to clipboard operation
multitrainer copied to clipboard

Building with LispWorks on Windows

Open lispstudent opened this issue 3 years ago • 28 comments

Thank you for lw-multiplication, I am learning much, including building CAPI interfaces.

I would like to try to build a Windows executable (I have Hobby DV license).

If this is possible, could you guide me to the necessary steps to do that?

lispstudent avatar Jan 01 '21 06:01 lispstudent

Oh, great! It would be cool to have Windows build too.

  • First, try to clone the repository and add the path to it into ASDF:*central-registry*.
  • Then do (ql:quickload :multiplication)
  • And try to run the application (multiplicationn/core:start).

If these steps are working, then try to build an app.

Open Window/Tools/Application builder and select the build.lisp script, like this:

Screenshot 2021-01-01 at 14 22 56

Then hit the "Build" button on the panel.

svetlyak40wt avatar Jan 01 '21 11:01 svetlyak40wt

Thank you for the detailed instructions.

I have cloned the repo in C:\home\lisp\quicklisp\local-projects\lw-multiplication

(push #P"C:/home/lisp/quicklisp/local-projects/lw-multiplication/" ASDF:*central-registry*)
(#P"C:/home/lisp/quicklisp/local-projects/lw-multiplication/" #P"c:/home/lisp/quicklisp/quicklisp/")

But it seems it can't compile LEXICAL:

CL-USER 1 > (ql:quickload :multiplication)
To load "multiplication":
  Load 1 ASDF system:
    multiplication
; Loading "multiplication"
To load "cl-locale":
  Load 6 ASDF systems:
    alexandria anaphora closer-mop iterate named-readtables
    trivial-types
  Install 6 Quicklisp releases:
    arnesi cl-annot cl-locale cl-syntax collectors
    symbol-munger
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/cl-syntax/2015-04-07/cl-syntax-20150407-git.tgz">
; 3.03KB
==================================================
3,102 bytes in 0.00 seconds (0.00KB/sec)
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/cl-annot/2015-06-08/cl-annot-20150608-git.tgz">
; 9.80KB
==================================================
10,039 bytes in 0.00 seconds (4901.86KB/sec)
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/symbol-munger/2015-04-07/symbol-munger-20150407-git.tgz">
; 5.17KB
==================================================
5,298 bytes in 0.00 seconds (2586.91KB/sec)
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/collectors/2016-12-04/collectors-20161204-git.tgz">
; 10.28KB
==================================================
10,522 bytes in 0.00 seconds (10275.39KB/sec)
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/arnesi/2017-04-03/arnesi-20170403-git.tgz">
; 82.57KB
==================================================
84,553 bytes in 0.18 seconds (456.19KB/sec)
; Fetching #<QL-HTTP:URL "http://beta.quicklisp.org/archive/cl-locale/2015-10-31/cl-locale-20151031-git.tgz">
; 3.82KB
==================================================
3,916 bytes in 0.00 seconds (3824.22KB/sec)
; Loading "cl-locale"
[package symbol-munger]...........................
[package collectors-signals]......................
[package collectors]..............................
[package it.bese.arnesi].....
.....................
[package it.bese.arnesi.mopp].....................
[package it.bese.arnesi.mopp%internals].

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.
; *** 13 errors detected, no fasl file produced.
.
Error: COMPILE-FILE-ERROR while compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv">
  1 (continue) Retry compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv">.
  2 Continue, treating compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv"> as having been successful.
  3 Retry ASDF operation.
  4 Retry ASDF operation after resetting the configuration.
  5 Retry ASDF operation.
  6 Retry ASDF operation after resetting the configuration.
  7 (abort) Give up on "cl-locale"
  8 Give up on "multiplication"
  9 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 2 : 1 > To load "multiplication":
  Load 1 ASDF system:
    multiplication
; Loading "multiplication"
[package multiplication/sound]....................
[package log4cl.package-setup]....................
[package log4cl-impl].....
.....
.........
.
....
..
...
[package log].....................................
[package multiplication/helping-grid].............
[package multiplication/font].....................
[package multiplication/results]..

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.
.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.

**++++ Error between functions:
  Reader cannot find package LEXICAL.
; *** 13 errors detected, no fasl file produced.

Error: COMPILE-FILE-ERROR while compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv">
  1 (continue) Retry compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv">.
  2 Continue, treating compiling #<ASDF/LISP-ACTION:CL-SOURCE-FILE "arnesi" "src" "lexenv"> as having been successful.
  3 Retry ASDF operation.
  4 Retry ASDF operation after resetting the configuration.
  5 Retry ASDF operation.
  6 Retry ASDF operation after resetting the configuration.
  7 (abort) Give up on "multiplication"
  8 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 3 : 1 > 
(:MULTIPLICATION)

lispstudent avatar Jan 01 '21 13:01 lispstudent

Seems arnesi library does not work on windows version LispWorks.

Could you see which version do you have. Here is an example:

CL-USER > (ql:where-is-system :arnesi)
#P"/Users/art/quicklisp/dists/quicklisp/software/arnesi-20170403-git/"

CL-USER > (ql-dist:all-dists)
(#<QL-DIST:DIST ultralisp 20201209122007> #<QL-DIST:DIST quicklisp 2020-10-16>)

svetlyak40wt avatar Jan 01 '21 13:01 svetlyak40wt

CL-USER 11 >  (ql:where-is-system :arnesi)
#P"c:/home/lisp/quicklisp/dists/quicklisp/software/arnesi-20170403-git/"

CL-USER 12 >  (ql-dist:all-dists)
(#<QL-DIST:DIST quicklisp 2020-09-25> #<QL-DIST:DIST org.borodust.bodge 20200824150336>)

Should I try using ultralisp?

lispstudent avatar Jan 01 '21 13:01 lispstudent

PS: I did (ql:update-dist "quicklisp") and have now latest quicklisp, but still same issue.

(ql-dist:all-dists)
(#<QL-DIST:DIST quicklisp 2020-12-20> #<QL-DIST:DIST org.borodust.bodge 20200824150336>)

lispstudent avatar Jan 01 '21 13:01 lispstudent

Most probably, the problem is in arnesi on Windows. You can try to get rid of this dependency. Edit i18n.lisp file and comment everything, related to cl-locale. And make i18n function return just a key.

svetlyak40wt avatar Jan 01 '21 17:01 svetlyak40wt

Sorry for delay, I was trying to hunt down the mysterious missing Reader cannot find package LEXICAL from ARNESI. It loads fine with SBCL on Windows, so it must be some picky side of LispWorks on Windows.

Anyway, I did as instructed and now have this,

CL-USER 16 > (ql:quickload :multiplication)
To load "multiplication":
  Load 1 ASDF system:
    multiplication
; Loading "multiplication"
[package multiplication/i18n]
.....................
[package multiplication/tips].....................
[package multiplication/core].
(:MULTIPLICATION)

Then,

CL-USER 17 > (multiplication/core:start)

Error: The symbol "START" is not external in the MULTIPLICATION/CORE package.
  1 (continue) Use symbol #<EDITOR::EDITOR-REGION-STREAM #<EDITOR:BUFFER CAPI interactive-pane 2> 402005D15B> anyway.
  2 (abort) Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

lispstudent avatar Jan 03 '21 16:01 lispstudent

This is ok. Just two : insead f one.

svetlyak40wt avatar Jan 03 '21 16:01 svetlyak40wt

Wonderful, it works now, see screenshot lispworks-7-1-0-x64-windows_IIrUsQCvJY

I will try to build app now.

lispstudent avatar Jan 03 '21 17:01 lispstudent

Build fails with very long message, see gist (it would be too long here).

Could it be the macos related part in build.lisp?

(let* ((app-path (merge-pathnames #P"Multitrainer.app" (lispworks:current-pathname)))
       (bundle (create-macos-application-bundle

lispstudent avatar Jan 03 '21 17:01 lispstudent

The code you showing definitely is for OSX only.

Add:


#+OS-MACOSX
(let* …

to prevent this let execution on Windows.

But this error:

Quitting because of error:
   Component :MULTIPLICATION/CORE not found

caused by another reason. ASDF can't find the system.

At the beginning of the build script, I'm adding ./ (current directory) to the ASDF:*central-registry*. Most probably, on windows you need something else, maybe.\ Or try to replace it with (probe-file ".") if it will work, this will be portable and work for both OSX and Windows.

Also, see what outputs this function:

CL-USER 78 > (lw:current-pathname)
#P"/Users/art/projects/lisp/multiplication/"

You should run build from the root repository's directory. If you don't, you also will get Component :MULTIPLICATION/CORE not found error.

svetlyak40wt avatar Jan 03 '21 18:01 svetlyak40wt

And read the documentation on using deliver on Windows. You need to write a separate toplevel form which will call deliver with appropriate options.

Prepend it with:

#-OS-MACOSX

or figure out which feature matches Windows. Look at the *features* list. Probably it has :OS-WINDOWS in it.

svetlyak40wt avatar Jan 03 '21 18:01 svetlyak40wt

Thank you for the detailed instructions (and your patience).

I patched the build file and I was finally able to build the corresponding windows app. See release in my temp fork.

I had to load the required libraries,

(ql:quickload :log4cl)
(ql:quickload :str)
(ql:quickload :global-vars)
(ql:quickload :local-time)

At some point I need to check why fonts look grainy on Windows.

I am sorry it is all too hacky to submit any sensible PR for now!

If you wish, you could close this for now, I will need to study more.

PS: I copied necessary bits from fourier's mediaimport

lispstudent avatar Jan 04 '21 17:01 lispstudent

It is strange that you required to load some libs manually. They should be loaded when you did (ql:quickload :multiplication/core).

svetlyak40wt avatar Jan 04 '21 17:01 svetlyak40wt

I was able to start your release in the virtual machine. But seems besides a grainy fonts, there are two other problems:

  • a black terminal screen is starting along with application.
  • there is no correct icon for the app, I see LW's logo instead.
  • image is flickering when the answer is given:

2021-01-05 01 02 17

svetlyak40wt avatar Jan 04 '21 22:01 svetlyak40wt

I'll try to install LispWorks Personal Edition into the virtual machine and to solve the problem with arnesi.

svetlyak40wt avatar Jan 04 '21 22:01 svetlyak40wt

It is strange that you required to load some libs manually. They should be loaded when you did (ql:quickload :multiplication/core).

My fault, I was under the impression LispWorks would have access to the current world while building the app, thus inheriting quicklisp environment, but of course it does spun a completely new world.

lispstudent avatar Jan 05 '21 06:01 lispstudent

I was able to start your release in the virtual machine. But seems besides a grainy fonts, there are two other problems:

* a black terminal screen is starting along with application.

Could that be related to missing Arnesi?

* there is no correct icon for the app, I see LW's logo instead.

I know how to fix that, I will add proper setting later during the day.

* image is flickering when the answer is given:

I though that was an artifact also present on MacOS? I would not know how to fix that, though.

lispstudent avatar Jan 05 '21 06:01 lispstudent

I'll try to install LispWorks Personal Edition into the virtual machine and to solve the problem with arnesi.

Wow, that would be very nice, Arnesi looks like a very good toolset, worth to have on LispWorks/Windows too.

I was going to submit a ticket to the current maintainer, but perhaps coming from somebody with deep understanding of it would be more acceptable?

lispstudent avatar Jan 05 '21 06:01 lispstudent

I have converted .icns icon to .ico format, fixed build script, and rebuilt Windows exe binary.

I am unable to fix the flickering though.

lispstudent avatar Jan 05 '21 15:01 lispstudent

  • image is flickering when the answer is given:

Regarding the flickering, I saw a mention of this issue in file examples/capi/applications/balloons.lisp

;; -*- rcs-header: "$Header: /hope/lwhope1-cam/hope.0/compound/33/LISPcapi-examples/RCS/applications:balloons.lisp,v 1.16.3.1 2017/01/19 11:50:03 martin Exp $" -*-

;;;----------------------------------------------------------------------------
;;;
;;; examples/capi/applications/balloons.lisp
;;;
;;; Example of using :DRAW-WITH-BUFFER. 

;;; To try it, compile and load this file and then execute any
;;; of the following.
;;;
;;;      (CL-USER::BALLOONS nil) 
;;;      (CL-USER::BALLOONS t)
;;;
;;; On Cocoa and GTK there shouldn't be any difference. On 
;;; Windows and Motif when passed T it should not flicker (note that
;;; the balloons intentionally wobble). 
;;;
;;; The example also shows usage of timers (search for "timer"). Note
;;; using capi:execute-with-interface-if-alive in the timer function,
;;; so if the interface dies (e.g. the user closes it) we don't get an
;;; error. 
;;;
;;;----------------------------------------------------------------------------
;;; Copyright (c) 1987--2017 LispWorks Ltd. All rights reserved.
;;;----------------------------------------------------------------------------

lispstudent avatar Jan 20 '21 13:01 lispstudent

Try to add :draw-with-buffer t into the :default-initargs of results class in the results.lisp.

svetlyak40wt avatar Jan 20 '21 14:01 svetlyak40wt

On OSX I didn't see difference between :draw-with-buffer t and :draw-with-buffer nil.

svetlyak40wt avatar Jan 20 '21 14:01 svetlyak40wt

Please, fetch the latest changes from the master. I've added this option and also fixed an issue of app hanging on OSX (probably Windows version also had this problem).

svetlyak40wt avatar Jan 20 '21 15:01 svetlyak40wt

Please, fetch the latest changes from the master. I've added this option and also fixed an issue of app hanging on OSX (probably Windows version also had this problem).

Thanks, I will. Probably also better to make a clean fork, and do changes on a branch for potential PRs.

lispstudent avatar Jan 20 '21 16:01 lispstudent

Thanks, flickering has been fixed, very nice, so smooth! My little cousins will love it.

But this change (the final :resize-callback 'resize-results)) in same form as :draw-with-buffer t), creates this error in the DOS console:

ERROR -
Error: Undefined function MULTIPLICATION/RESULTS::RESIZE-RESULTS called with arguments (#<MULTIPLICATION/RESULTS::RESULTS MULTIPLICATION/CORE::RESULTS  401009EC33> 0 0 700 700).
  1 (continue) Try invoking MULTIPLICATION/RESULTS::RESIZE-RESULTS again.
  2 Return some values from the call to MULTIPLICATION/RESULTS::RESIZE-RESULTS.
  3 Try invoking something other than MULTIPLICATION/RESULTS::RESIZE-RESULTS with the same arguments.
  4 Set the symbol-function of MULTIPLICATION/RESULTS::RESIZE-RESULTS to another function.
  5 (abort) Return to event loop.
  6 Destroy interface "Multiplication Trainer" (of type MULTIPLICATION/CORE::MULTIPLICATION)

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

If I comment that line, application runs fine though.

Shall I open a new ticket?

lispstudent avatar Jan 20 '21 16:01 lispstudent

There is a function resize-results in the results.lisp.

Most probably, you've updated the sources but not reloaded the system.

Do (asdf:load-system :multiplication) in the REPL.

svetlyak40wt avatar Jan 20 '21 17:01 svetlyak40wt

Just to be sure I re-built the exe file with latest version of results.lisp, now I get a different error:

Error: An error of type CONDITIONS:WRONG-NUM-ARGS-ERROR occured, arguments : (:CALLED-FUNCTION #<Function "MAKE-SMALL-FONT" 411059B514> :ARGS-GIVEN (5/7) :LAMBDA-LIST NIL)
  1 (continue) Return a value from the call to #<Function "MAKE-SMALL-FONT" 411059B514>.
  2 Try calling another function instead of #<Function "MAKE-SMALL-FONT" 411059B514> with the same arguments.
  3 Try calling #<Function "MAKE-SMALL-FONT" 411059B514> with a new argument list.
  4 (abort) Return to event loop.
  5 Destroy interface "Multiplication Trainer" (of type MULTIPLICATION/CORE::MULTIPLICATION)

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

lispstudent avatar Jan 20 '21 17:01 lispstudent