Content tagged archlinux

Installing HLA on Archlinux

Published on:

I recently started reading The Art of Assembly Language, 2nd Edition. It uses High-Level Assembly language in its code examples and this requires a special compiler, or assembler, to turn your code into machine code.

Fixing the PKGBUILD

The compiler, hla, is available on the Archlinux User Repository here. At the time of writing, though, that PKGBUILD doesn't work entirely. By default pacman removes all static libraries from the created packages, which took me a while to find out. Adding the following line to the PKGBUILD fixes it:

options=(staticlibs)

I also placed a comment on the AUR page, but there has been no sign of acknowledgment so far.

Running on x86_64

After having installed the compiler I got a lot of errors compiling my very simple hello world application, as typed over from the book. The gist of them was that it couldn't create 64-bit executables, which isn't very surprising as HLA seems to be only for x86 (32-bit) architecture. Another comment on the AUR page helped that though. One should add the -lmelf_i386 switch to the hla command-line. So I put in my ~/.zshrc:

alias hla="hla -lmelf_i386"

This discovery only came after a few other attempts to install HLA.

Alternative: Using Vagrant

Before I'd read about the -lmelf_i386 command-line switch I was looking at ways to run a 32-bit operating system inside my Archlinux installation. There are a few options I'm familiar with: lxc, Docker and Vagrant.

At first I tried to create a 32-bit Archlinux container, but the installation script failed, so I couldn't get that started. Then I went on to Vagrant, which worked pretty quickly.

I used the ubuntu/trusty32 box, which can be downloaded by calling:

vagrant box add ubuntu/trusty32

A very short Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty32"
  config.vm.provision :shell, path: "vagrant.sh"
end

and then the provision in vagrant.sh:

wget http://www.plantation-productions.com/Webster/HighLevelAsm/HLAv2.16/linux.hla.tar.gz
tar --directory / --extract --file linux.hla.tar.gz

cat > /etc/profile.d/hla.sh <<EOF
#!/usr/bin/bash

export hlalib=/usr/hla/hlalib
export hlainc=/usr/hla/include
export hlatemp=/tmp
export PATH="${PATH}:/usr/hla"
EOF

After that you can just call vagrant up, wait a while and then have fun playing around with HLA in an Ubuntu 14.04 environment.


Notstumpwm

Published on:

I have just returned from an excursion into the land of exherbo, which is an awesome source-based distro, and I found that while I was gone, something changed that made stumpwm cause a segmentation fault in X11 a few seconds after starting up.

I have tried everything I can think of to get it running again, but alas, to no avail. So I started looking at alternatives again. Feeling a little crazy I decided to give notion another try. And it fits strangely well.

It's configured/extended in lua, which I'm not particularly fond of, and it has a (in my opinion) crazy default configuration. But it also allows Emacs-like key combinations out-of-the-box, which is a very big plus in my book. So the quest to bring it closer to my stumpwm setup has begun.

Window layout

One of the nicest additions to my stumpwm configuration I made in the last few weeks was a loaded window configuration which put my Emacs frames in a big chunk of my left monitor, my terminals on my left monitor with just enough space for 80 columns and my web browser filling my right screen. I had also set-up some rules to always place them in the correct spots.

I have not yet tried to automatically place the windows in the right spots, but I do have the proportions right. I just had to delete the right frames and resize the one for terminals and, by default, notion remembers this set-up and automatically restores it when I log in.

I will look at creating a special layout for this so I don't have to worry about (accidentally) changing things.

run-or-raise

I found this interesting page about run-or-raise-like functionality for Ion3, which notion is a fork of. This is a little outdated, though, since notion has changed (apparently) the workings of some functions and lua 5.2 introduced the goto keyword, so I had to change it to this:

function oni_match_class(class)
   local result = {}
   ioncore.clientwin_i(
      function (win)
         if class `` win:get_ident().class then
            table.insert(result, win)
            return false
         end
         return true
      end
   )
   return result
end

function xsteve_run_byclass(prog, class)
   local win = oni_match_class(class)[1]
   if win then
      win:goto_()
   else
      ioncore.exec(prog)
   end
end

There is no function to get a list of all the client windows, only a function to iterate over them. For the moment I am only interested in finding the first window with class CLASS, so I return false when a match is found, this stops the iteration process. I also had to use the WRegion.goto_ function, instead of WRegion.goto because of the mentioned change in lua 5.2, but they are the same.

I then only have to bind it:

defbindings("WScreen", {
    -- ...
    submap("Control+Z", {
        -- ...
        kpress("E", "xsteve_run_byclass('emacsclient -ca emacs', 'Emacs')"),
        kpress("W", "xsteve_run_byclass('conkeror', 'Conkeror')"),
        kpress("C", "xsteve_run_byclass('urxvt', 'URxvt')"),
    }),
})

Quoting C-z

One of the coolest things about using a prefix in stumpwm that I have been able to find in precious few other solutions is the ability to send the prefix key to the applications you use, so you don't entirely miss its functionality. In stumpwm this is easy, but in notion its a little more work:

defbindings("WClientWin", {
    -- ...
    submap("Control+Z", {
        -- ...
        kpress("Q", "WClientWin.quote_next(_)"),
    }),
})

This means that I have to type C-z q C-z to send the C-z key to, for instance, Emacs. That a few more keys than I was used to in stumpwm, but at least it's possible.


This blog covers archlinux, avandu, avandu-lua, cask, ci, clark, common-lisp, config, conkeror, diff, dispass, dispass.el, editors, elisp, emacs, eshell, evil, exherbo, experiments, file-synchronization, games, git, github, gnus, hla, html, javascript, lisp, lua, markam, meta, mpd, notion, org-mode, ox-coleslaw, projects, rc, sbcl, small-recent-posts, software, stumpwm, systemd, tasks, tekuti, testing, tips, todo, ttrss, utility, vagrant, vc, vim, visual, wdocker docker docker-compose, wm, wordpress, yoshi-theme

View content from 2016-02, 2015-09, 2015-08, 2014-12, 2014-10, 2014-08, 2014-07, 2014-06, 2014-04, 2014-01, 2013-11, 2013-10, 2013-08, 2013-05, 2013-04, 2013-02, 2013-01