emacs-libvterm icon indicating copy to clipboard operation
emacs-libvterm copied to clipboard

Emacs freezes while running `vterm-module-compile`.

Open hongyi-zhao opened this issue 2 years ago • 7 comments

On Ubuntu 20.04.3 LTS, I use the following version of self-compiled GNU Emacs:

GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2021-11-14

At the same time, the following command was used to install emacs-libvterm with straight's use-package integration:

(use-package vterm)

But Emacs will freeze at the following step:

image

Any hints for fixing this problem?

Regards, HZ

hongyi-zhao avatar Nov 28 '21 03:11 hongyi-zhao

Based on the manual installation guidance, the following steps fixed the problem:

$ cd ~/.emacs.d/straight/repos/emacs-libvterm
$ mkdir -p build
$ cd build/
$ cmake ..
$ make

Then use the following use-package configuration:

(use-package vterm
  :load-path  "~/.emacs.d/straight/repos/emacs-libvterm"
  )

But I still can't figure out why the melpa-based method can't accomplish this job.

hongyi-zhao avatar Nov 28 '21 03:11 hongyi-zhao

Experiencing the same issue on Ubuntu 20.04 LTS and Emacs 29.0.5

noblekid96 avatar Nov 29 '21 04:11 noblekid96

See here for the solution with straight's use-package integration.

hongyi-zhao avatar Dec 04 '21 07:12 hongyi-zhao

I have the same problem with Emacs 29.0.50 and vterm installed from MELPA. I definitely have all the necessary build tools installed and this used to work just fine with Emacs 27.

bbatsov avatar Dec 20 '21 07:12 bbatsov

@bbatsov Have you tried the recipe I posted here? Anyway, I posted my currently used configuration of vterm, just for your reference:

;; https://github.com/raxod502/straight.el/issues/891#issuecomment-984438357
;; https://github.com/raxod502/straight.el/issues/800#issuecomment-985484197
(use-package vterm
  :straight `(:pre-build (("rm" "-fr" "build")
			  ("mkdir" "build")
			  ("bash" "-c" "cd \"$1\" && cmake .. && make" "--"  ,(concat (straight--repos-dir "emacs-libvterm") "build"))
			  ;;or
			  ;; (shell-command "rm -fr build && mkdir build && cd $_ && cmake .. && make")
			  )))

hongyi-zhao avatar Dec 20 '21 07:12 hongyi-zhao

So, basically the solution is to build the necessary module myself, right?

bbatsov avatar Dec 20 '21 08:12 bbatsov

Yes. At least, this is the workaround I finally figured out. The vterm-module-compile is defined here as follows:

(defun vterm-module-compile ()
  "Compile vterm-module."
  (interactive)
  (when (vterm-module--cmake-is-available)
    (let* ((vterm-directory
            (shell-quote-argument
             ;; NOTE: This is a workaround to fix an issue with how the Emacs
             ;; feature/native-comp branch changes the result of
             ;; `(locate-library "vterm")'. See emacs-devel thread
             ;; https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00306.html
             ;; for a discussion.
             (file-name-directory (locate-library "vterm.el" t))))
           (make-commands
            (concat
             "cd " vterm-directory "; \
             mkdir -p build; \
             cd build; \
             cmake -G 'Unix Makefiles' "
             vterm-module-cmake-args
             " ..; \
             make; \
             cd -"))
           (buffer (get-buffer-create vterm-install-buffer-name)))
      (pop-to-buffer buffer)
      (compilation-mode)
      (if (zerop (let ((inhibit-read-only t))
                   (call-process "sh" nil buffer t "-c" make-commands)))
          (message "Compilation of `emacs-libvterm' module succeeded")
        (error "Compilation of `emacs-libvterm' module failed!")))))

Basically, it does the same thing as the use-package recipe I posted above, but I can't figure out why it doesn't work with the latest git master version.

hongyi-zhao avatar Dec 20 '21 08:12 hongyi-zhao