问题
I have installed scmutils
(for the book SICM) from the tar ball under /usr/local
.
I then put this in my .emacs
:
(defun mechanics ()
(interactive)
(run-scheme
"/usr/local/scmutils/mit-scheme/bin/scheme --library /usr/local/scmutils/mit-scheme/lib"
))
which is mostly instruction from http://redsymbol.net/articles/using-gnu-emacs-with-scmutils/.
But I get an error:
/usr/local/scmutils/mit-scheme/bin/scheme: 1: /usr/local/scmutils/mit-scheme/bin/scheme:
Syntax error: "(" unexpected
Process scheme exited abnormally with code 2
I also tried running /usr/local/bin/mechanics
, which is a shell script that run eventually run:
$ /usr/local/scmutils/mit-scheme/bin$ /usr/local/scmutils/mit-scheme/bin/scheme --library /usr/local/scmutils/mit-scheme/lib --heap 12000 --band edwin-mechanics.com --edit
$ bash: /usr/local/scmutils/mit-scheme/bin/scheme: cannot execute binary file
I think there's some incompatibility. Here is the "file mit-scheme-x86-64":
mit-scheme-x86-64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=0x88f52caf274bb8298a0f6b84fc34beb9d2094bc6, not stripped
and
$ uname -r
3.11.0-26-generic
Anyone can guide me how to debug this now? I am running Ubuntu in VMWare Fusion (Mac OS X).
回答1:
The direct answer to the body of the question is probably that VMWare can't recognize the binary.
For the more general problem of how to run scmutils from Emacs, here are the steps for Debian and macOS:
Debian:
First make sure you have MIT-scheme. If not, do sudo apt install mit-scheme
. Then, download the tarball from the official scmutils page. Extract it and sudo ./install.sh
. Also, sudo cp mechanics.sh /usr/local/bin/mechanics
, and now you can run scmutils from bash by doing either mechanics
(to run in terminal) or mechanics -edit
(to pop up an Edwin). You also need to sudo apt install texlive
if you haven't already. Then, confirm that show-expression
works by doing mechanics -edit
to open Edwin (if the font is too small, see my answer to another question), then (show-expression '(sqrt (+ x y)))
and then M-z
and it will pop up a window with the Latex.
Great, show-expression
works natively on Edwin! To get it working on emacs is easy. First, open up emacs, evaluate (require 'xscheme)
(This seems to change the meaning of the run-scheme
command), then do (run-scheme "/usr/local/bin/mechanics")
, and you will see a scmutils REPL in your emac. At this point, evaling (up 1 2 3)
should work, though note that unlike Edwin, you need C-x C-e
to eval' M-z
won't work here. Finally, eval (show-expression '(sqrt (+ x y)))
, and it will work.
macOS:
These instructions taken from the comments in this thread; I wrote them a year ago and no longer use macOS, so cannot confirm them now, but they should work.
Install Xquartz and "emacs for macOS" and also BasicTex. Then using brew, install mit-scheme and gv. Finally, install scmutils from the tarball like in the Debian part above. Confirm that show-expression
works in Edwin, then in emacs, repeat the steps above from the Debian section, and also make sure to use setenv
to add /Library/TeX/texbin
to PATH. Then, show-expression
should work from emacs.
(again, I don't have a macbook to confirm now, but I got it working about a year ago when I wrote the other comments in this page, using similar, if not identical instructions to the above).
回答2:
I think the problem may be VMWare Fusion. I ran this successfully on Mac OS X and native ubuntu.
来源:https://stackoverflow.com/questions/25956349/error-running-scmutils-by-m-x-mechanics-in-emacs