Re: Segfault loading draw.lisp (GCL b ackend) — draw2d/draw3d/gr2d unusable on Debia n/Ubuntu-packaged Maxima 5.49.0

Jean-Michel Sarlat <[email protected]>
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CAJTxn8h5k6z6=uq_0hT6xV9ohv8MWC3KcS7OemU3hbvZM+UWAA@mail.gmail.com>
Hi Robert, and everyone else who chimed in,

 Thanks for the help — and to everyone who reported hitting the same
 load(draw) segfault, that made the diagnosis much easier to trust.

 These issues showed up while updating pmaxima (old script from the
Syracuse site)
 — a client/server setup, Maxima run persistently
 via -s PORT rather than one-shot batch calls, which is where both of the
 following surfaced.

Tested on Maxima 5.49.0+dsfg-2 (Debian), GCL 2.7.1:

 1. (mk:oos "draw" :compile) -> (mk:oos "draw" :load) in draw.lisp does
     fix the segfault, but not durably: mk:defsystem recompiles whenever
     the source is newer than the cached .o (package upgrade, or any local
     edit), so the crash comes back. More robust: skip mk:defsystem/oos
     entirely and load the four files directly:

       (let ((dir (maxima-load-pathname-directory)))
         (load (merge-pathnames (make-pathname :name "grcommon" :type
"lisp") dir))
         (load (merge-pathnames (make-pathname :name "gnuplot"  :type
"lisp") dir))
         (load (merge-pathnames (make-pathname :name "vtk"      :type
"lisp") dir))
         (load (merge-pathnames (make-pathname :name "picture"  :type
"lisp") dir)))

  Thanks, Robert !

  2. With that fixed, draw2d(terminal=svg, ...) still failed:
     "Cannot load input from '"/tmp/maxoutNNNNN.gnuplot"'" — even though
     the file existed. Isolated independently of draw:

       system("touch \"/tmp/foo.txt\"")

     creates a file literally named "/tmp/foo.txt" (quotes included).
     Maxima's system() under this GCL build doesn't strip escaped double
     quotes before exec'ing. It hits draw because gnuplot.lisp's
     file-output branch quotes the filename
     (format nil "~a \"~a\"" $gnuplot_command gfn, two spots) — removing
     the quotes there fixed it for my (space-free) filenames. Not sure if
     this is already known or where it'd best be reported (Debian? GCL? the
     Maxima tracker?) — happy to open something if that's useful, just
     didn't want to duplicate an existing report.

   Diagnosed with the help of Claude Code !

With both in place, draw2d/draw3d/multi-scene draw() all work reliably
here. pmaxima is being reborn. Happy to share more detail if useful.

Thanks again,
Jean-Michel Sarlat




Le mer. 19 août 2026 à 19:32, Robert Dodier <[email protected]> a
écrit :

> Hi Jean-Michel, thanks for the bug report.
>
> The way it is supposed to work is that the draw package (and others
> like it) is compiled once for each Maxima version and cached in
> ~/.maxima/binary, and then those binary files are loaded for the
> second and any later times.
>
> The draw package is compiled and loaded by a program, similar to
> `make`, called defsystem. The makefile analogue is draw.system and it
> is found in the folder share/draw somewhere in the Maxima
> installation.
>
> As a workaround, I find that I can change (mk:oos "draw" :compile) to
> (mk:oos "draw" :load) and then defsystem does not try to compile the
> code and instead just loads the .lisp files instead, so that the code
> is interpreted instead of compiled and executed. (Barring bugs in the
> Lisp interpreter and/or compiler, which are rare but not impossible,
> the observable behavior should be identical from the user's point of
> view.)
>
> I find that after I make that change, then load("draw") provokes some
> questions from defsystem, which I answered to tell defsystem not to
> compile the Lisp files, as follows:
>
> $ sh maxima-local
> Maxima branch_5_49_base_881_ga887ed816 https://maxima.sourceforge.io
> using Lisp SBCL 2.1.0
> [...]
> (%i1) load ("draw");
> ;    - Binary file
>
> /Users/dodier/sourceforge/maxima-code/binary/branch_5_49_base_881_ga887ed816/sbcl/2_1_0/share/draw/grcommon.fasl
> is old or does not exist.
> ;      Compile (and load) source file
> /Users/dodier/sourceforge/maxima-code/share/draw/grcommon.lisp
> instead? n
>
> ;    - Should I bother you if this happens again? n
>
> ;    - Should I compile while loading the system? n
>
> ;    - Binary file
>
> /Users/dodier/sourceforge/maxima-code/binary/branch_5_49_base_881_ga887ed816/sbcl/2_1_0/share/draw/grcommon.fasl
> does not exist.
> ;      Load source file
> /Users/dodier/sourceforge/maxima-code/share/draw/grcommon.lisp
> instead? y
>
> ;    - Should I bother you if this happens again? n
> (%o1)
> /Users/dodier/sourceforge/maxima-code/share/draw/draw.lisp
>
> After that it looks like draw2d works as expected.
>
> I find the questions annoying but not really a problem.
>
> To avoid defsystem altogether, you can just load the Lisp files one by
> one; draw.system shows there are just a few:
>
> load ("grcommon.lisp");
> load ("gnuplot.lisp");
> load ("vtk.lisp");
> load ("picture.lisp");
>
> Although you were saying you don't want to switch Lisp
> implementations, I would recommend that you reconsider -- my advice is
> to work with SBCL + Maxima instead. There has just been a Maxima 5.50
> release -- my advice is to compile it from source code. Maxima is
> compiled with a conventional configure / make / make install cycle. I
> can say more if you are interested.
>
> Hope this helps, and thanks for your interest in Maxima.
>
> Robert
>

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.