Fork me on GitHub
#emacs
<
2022-05-16
>
Drew Verlee07:05:51

I'm following the helpful guide here for installing emacs28.1. I get this error at the end

./configure --with-native-compilation --with-harfbuzz

...

checking for libXaw... configure: error: No X toolkit could be found.
If you are sure you want Emacs compiled without an X toolkit, pass
  --with-x-toolkit=no
to configure.  Otherwise, install the development libraries for the toolkit
that you want to use (e.g. Gtk+) and re-run configure.
Which appears when i run make to, and i persume is what's blocking the install. I assume i want the toolkits, menus, popups, etc.... I think i have gtk installed so i'm confused why it's not being used, or why no it's not mentioned in the install script(s) i have seen if it needs to be specified. That or i don't have a proper "toolkit" installed and i would love some help figuring out how to do that.

practicalli-john07:05:23

If on Ubuntu/Debian, the packages required for building Emacs can be installed using

sudo apt build-deps Emacs
Or search for the library names mentioned by ./configure using apt-cache
apt-cache search --names-only libraryname

Drew Verlee07:05:52

thanks. Looks like i have to resolve this issue with my source list

[email protected]  ~/Downloads/emacs-28.1  sudo apt build-dep emacs
Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list

Drew Verlee07:05:19

i was able to do that by doing exactly what it said. Though i likely just opened some doors that typically i want shut im guessing.

practicalli-john07:05:24

This is my guide that seems to have worked on a couple of different versions of Ubuntu https://github.com/practicalli/blog/issues/129

Drew Verlee07:05:15

thanks john. That is what i'm using! I forgot to put the link in. (it's been quite a day for me

practicalli-john07:05:09

If you launch Software & Updates on ubuntu desktop, then just check the Source Code entry in Ubuntu Software

Drew Verlee07:05:21

yep thats what i did.

practicalli-john07:05:10

Hmm, perhaps check /etc/apt/sources.list to see if the deb-src entries have been commented out (or possibly deleted)

practicalli-john07:05:49

sources.list should have

Drew Verlee07:05:16

i was able to run sudo apt build-dep emacs without the errors. I just ran make and it completed, but emacs isn't on the path...

Drew Verlee07:05:40

./src/emacs -Q loads works...

practicalli-john07:05:23

make install will install emacs globally the -Q is just a quick way of testing without using the config

Drew Verlee07:05:53

i thought the rest of the instructions were a different way of installing

practicalli-john07:05:12

There is a lot of stuff at the end for tweaking installs, but it seems its not really necessary unless there are certain features you know you want to exclude. Once you have got to make install then you should be done

Drew Verlee07:05:43

emacs is loading but it doesn't look great (the font is all off) and i'm getting a lot of errors. Here is a sampling:

Error (use-package): clojure-essential-ref-nov/:catch: Symbol's value as variable is void: cider-mode-map Disable showing Disable logging
Warning (comp): smartparens.el:1460:1: Warning: custom-declare-variable `sp-highlight-wrap-tag-overlay' docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:2726:42: Warning: value returned from (< (sp--get-overlay-length nil) (sp--get-overlay-length nil)) is unused Disable showing Disable logging
Warning (comp): smartparens.el:2726:42: Warning: value returned from (< (sp--get-overlay-length nil) (sp--get-overlay-length nil)) is unused Disable showing Disable logging
Warning (comp): smartparens.el:2726:42: Warning: value returned from (< (sp--get-overlay-length nil) (sp--get-overlay-length nil)) is unused Disable showing Disable logging
Warning (comp): smartparens.el:2907:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:2913:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:5534:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:7200:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:8229:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): smartparens.el:8728:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): evil-cleverparens-util.el:271:21: Warning: looking-back called with 1 argument, but requires 2-3 Disable showing Disable logging
Warning (comp): smartparens.el:9411:8: Warning: docstring wider than 80 characters Disable showing Disable logging
Warning (comp): evil-cleverparens-util.el:291:15: Warning: 'in-string-p' is an obsolete function (as of 25.1); use (nth 3 (syntax-ppss)) instead. Disable showing Disable logging
W

practicalli-john07:05:56

There will be lots of warnings when you first run emacs. Its downloading all new packages and also natively compiling them. Once all the emacs packages have downloaded, then restart emacs. If there are still pages of warnings, then its something to look at.

practicalli-john07:05:16

So long as you are not getting messages about certificates, then I suspect everything is okay

Drew Verlee07:05:21

i'm trying to figure out if it's ok right now. it looks like fonts and pictures are loading propery

practicalli-john08:05:36

In Emacs, run

SPC SPC all-the-icons-install-fonts
to fix the modeline fonts

practicalli-john08:05:56

If that is all the warnings you have left, then I think thats fine.

practicalli-john08:05:22

If you havent updated spacemacs in a while, i.e. pulled a new version of .emacs.d , then that may be useful, especially if there are lingering warnings

Drew Verlee08:05:35

other things seem ok...

SPC SPC all-the-icons-install-fonts
ran correctly but nothing changed.

practicalli-john08:05:51

I assume a restart of emacs is required

Drew Verlee08:05:26

> (Spacemacs) Warning: Cannot find any of the specified fonts (Fira Code)! Font settings may not be correct.

Drew Verlee08:05:55

i did restart

practicalli-john08:05:15

sudo apt install fonts-firacode

practicalli-john08:05:39

or edit .spacemacs/init.el and change to your preferred (and installed 🙂 ) font

Drew Verlee08:05:33

i'm really happy with firacode i'm just confused because it is installed

Drew Verlee08:05:43

fonts-firacode is already the newest version (2+dfsg1-1).

Drew Verlee08:05:05

i didnt move emacs from local/bin ... i'm not sure why that would matter

practicalli-john08:05:41

maybe there is more than one emacs binary on the execution path...

which emacs

Drew Verlee08:05:35

[email protected]  ~  which emacs /usr/local/bin/emacs

Drew Verlee08:05:48

[email protected]  ~  emacs --version GNU Emacs 28.1

Drew Verlee08:05:04

so that seems right

practicalli-john08:05:10

I would recommend keeping emacs in the install location. If you need to install it somewhere else, then go back to the emacs source directory and uninstall it. Then use the --prefix to install to a different location. As the instructions state, its not just a single binary install...

practicalli-john08:05:32

Ah, sorry, I read that wrong...

practicalli-john08:05:38

I though you said you did move it...

Drew Verlee08:05:47

i recall the instructions talking about moving it, like maybe it was a good idea. I didn't. i was just fishing for something that could be off. trying to figure out why it can't fira code atm.

Drew Verlee08:05:55

maybe i didnt' include harfbuzz?

Drew Verlee08:05:24

i did 11780* ./configure --with-native-compilation --with-harfbuzz

practicalli-john08:05:25

harfbuzz should be on by default, if the libraries are installed on the operating system

practicalli-john08:05:07

The fira code fonts should be in

/usr/share/fonts-firacode

Drew Verlee08:05:41

[email protected]  ~  ls /usr/share/fonts-firacode/ woff woff2

Drew Verlee08:05:40

im going to restart my computer. didn't help lol.

practicalli-john08:05:25

Hmm, perhaps libotf0 and libotf-dev are not installed, but that seems unlikely.

Drew Verlee08:05:30

it says they were already at the newest version

practicalli-john08:05:06

Is emacs actually using the firacode font and just giving a warning, or is it using a different font? Did you still have the unicode layer uncommented in .spacemacs / .spacemacs/init.el ? Suggest trying with a different font and see if it also gives a similar warning for that font.

Drew Verlee08:05:16

it's not using the font. Commenting out the spacemacs-default-font var and it falls back to ubunut font (or something) which gives the same error.

Drew Verlee08:05:36

unicode lyaer uncommented?

Drew Verlee08:05:23

this?

;; Support font ligatures (fancy symbols) in all modes
     ;; 'prog-mode for only programming languages
     ;; including text-mode may cause issues with org-mode and magit
     (unicode-fonts :variables
                   unicode-fonts-enable-ligatures t
                   unicode-fonts-ligature-modes '(prog-mode))

practicalli-john08:05:43

I recall that you uncommented the unicode layer in the spacemacs config as it was building the fonts each time when using emacs29 However, It seems that there is something missing with the emacs build... I think

practicalli-john08:05:03

you could try sudo fc-cache to rebuild the font cache, but I think the computer reboot should have taken care of that

practicalli-john08:05:32

In the emacs source code directory, could you run

./configure --with-native-compilation > confiuration-output.txt
and paste the contents of http://configuration-output.it in a gist or some other text sharing thing

Drew Verlee08:05:32

sure. the warnings don't look encouraging. I don't recall that when i ran it before

[email protected]  ~/emacs  ➦ 5a223c7f2e  ./configure --with-native-compilation > confiuration-output.txt
configure: WARNING: cairo requested but not found.
configure: error: ELisp native compiler was requested, but libgccjit was not found.
Please try installing libgccjit or a similar package.
If you are sure you want Emacs be compiled without ELisp native compiler,
pass the --without-native-compilation option to configure.

Drew Verlee08:05:14

hmm i though that would be easy to download.

practicalli-john08:05:03

I assume you need to set these environment variables before running configure

export CC=/usr/bin/gcc-10
export CXX=/usr/bin/gcc-10

Drew Verlee08:05:27

i believe i did. but maybe then i switched terminals or something lame.

practicalli-john08:05:42

Yes, I did that a few times 🙂

Drew Verlee08:05:00

should i make uninstall? then do it again?

Drew Verlee08:05:23

oh your saying for this command

Drew Verlee08:05:23

you were saying i needed to run that export before doing ./configure --with-native-compilation > confiuration-output.txt right?

Drew Verlee08:05:34

or do you think thats the issue with the install.

practicalli-john08:05:04

the config drives the build. looking at config output is quicker than building 🙂

practicalli-john08:05:32

This is the output from my config with the CC and CXX env vars set before running config

practicalli-john08:05:25

mainly want to check line 537 to line 584

Drew Verlee09:05:40

What toolkit should Emacs use? LUCID Is that right? I guess i might expect this to read gtk-3

Drew Verlee09:05:16

yea. your using GTK3

Drew Verlee09:05:17

i mean, i have no idea what the difference is, but i googled how to install gtk3 for like 20 minutes and i thought i had finally done it.

practicalli-john09:05:30

I think we have the root cause identified. There are some interesting libraries installed :)

Drew Verlee09:05:55

are you seeing something beyond lucid?

practicalli-john09:05:51

Did you share the updated configuration file?

Drew Verlee09:05:05

it's the gist above

👍 1
practicalli-john09:05:51

Line 2 is not a good start configure: WARNING: cairo requested but not found.

practicalli-john09:05:51

Are you using Ubuntu or an ubuntu based distribution? Or something else. It doesnt seem GTK is installed, which is quite unusual, unless you are using KDE perhaps... or something other than the Gnome desktop

Drew Verlee09:05:06

To my knowledge i'm just using Ubuntu. I installed it from a thumb drive like 4 years ago or so [email protected]  ~/emacs  ➦ 5a223c7f2e  lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

practicalli-john09:05:40

Do you have any emacs packages installed? I seem to recall an emacs-lucid package that may have install some libraries that its picking up...

practicalli-john09:05:18

It may be that we just need to specify GTK as the toolkit to use, so it doesnt default to other interesing things

practicalli-john09:05:09

Try running config again. Set the env vars and include the configure option (updated as a 1-line command)

export CC=/usr/bin/gcc-10  && export CXX=/usr/bin/gcc-10 && ./autogen.sh && ./configure --with-native-compilation --with-x-toolkit=gtk3

Drew Verlee09:05:03

at the end checking for gtk+-3.0 >= 3.10 glib-2.0 >= 2.37.5... no configure: error: No package 'gtk+-3.0' found

practicalli-john09:05:23

I dont think the Ubuntu desktop (gnome desktop) is installed? Or its not being used

practicalli-john09:05:53

apt-cache show ubuntu-desktop and check to see if it has an Installed-Size entry

practicalli-john09:05:33

Or logout of the desktop and click the settings cog next to the account login name and see what desktops you can login to... and what the currently selected one is

Drew Verlee09:05:03

i should just do a fresh install of ubuntu

practicalli-john09:05:33

Ah, sorry, this is a better check

apt -qq list ubuntu-desktop

Drew Verlee09:05:49

[email protected]  ~/emacs  ➦ 5a223c7f2e  apt -qq list ubuntu-desktop
ubuntu-desktop/focal-updates,now 1.450.2 amd64 [installed]

practicalli-john09:05:29

Thats weird. If you dont have anything you need on the computer, then a fresh install may be simpler that trying to find out where things have gone astray

Drew Verlee09:05:53

what's weird? for educational purposes.

practicalli-john09:05:32

weird that ubuntu desktop is installed, but the emacs build script cant find gtk3 or cairo libraries..

practicalli-john09:05:25

If libgtk3 is installed but the emacs build script cannot find it, I dont know what the cause of that would be...

apt -qq list libgtk-3-0

Drew Verlee09:05:14

with

sudo ./autogen.sh

sudo ./configure --with-native-compilation --with-x-toolkit=gtk
I seem to get them included: https://gist.github.com/drewverlee/cc71de172b3751a1dd9788eb87bdc484

practicalli-john09:05:06

Did you run the export statements as separate commands ? Maybe that is why its not finding native compiliation

export CC=/usr/bin/gcc-10    
...
export CXX=/usr/bin/gcc-10

practicalli-john09:05:48

I assume that libgccjit was installed

sudo apt install libgccjit0 libgccjit-10-dev

Drew Verlee09:05:08

i just pasted it in as a code block. i'm guessing that was the issue. I just wanted that to work and they need a separator in that case.

Drew Verlee09:05:04

thanks a ton. ill pick this up tomorrow 🙂

👍 1
practicalli-john09:05:32

This seems to work 🙂

export CC=/usr/bin/gcc-10  && export CXX=/usr/bin/gcc-10 && ./autogen.sh && ./configure --with-native-compilation --with-x-toolkit=gtk3

practicalli-john09:05:14

Nice debugging session, I've learned a lot more about building emacs. Thanks.

Drew Verlee09:05:23

yea 😢 . same error No package 'gtk+-3.0' found. I have no idea. it doesn't seem to be a common issue.

practicalli-john10:05:50

Try installing the build-essentials meta package, this should bring in a load of libraries to help build Emacs

sudo apt install build-essential

Drew Verlee04:05:19

I ended up just going with a ubuntu software package install, which is working out just fine for now. I smattering of things about building from source which wasn't on my todo list but i feel somewhat better for having tried. I know it shouldn't have been a hassle, but with great power...

Benjamin13:05:31

Is any of you using cider with completion-in-region ? I tried to figure out why I couldn't complete keywords. Now I have a temp hack:

;; FIXME: why..
;; completion in region somehow ends up calling cider with blank prefix (a second time, the first time is good) 
;; still in the dark why
(defun cider-complete-at-point ()
  "Complete the symbol at point."
  (when-let* ((bounds (bounds-of-thing-at-point 'symbol)))
    (when (and (cider-connected-p)
               (not (or (cider-in-string-p) (cider-in-comment-p))))
      (list (car bounds) (cdr bounds)
            (completion-table-dynamic
             (let ((res))
               (lambda (prefix)
                 (or res
                     (setf res
                           (cider-complete prefix))))))
            :annotation-function #'cider-annotate-symbol
            :company-kind #'cider-company-symbol-kind
            :company-doc-buffer #'cider-create-doc-buffer
            :company-location #'cider-company-location
            :company-docsig #'cider-company-docsig))))
I don't need to recompute the cider completions after the first