Compiling the surf browser on Debian

As an aside, a reasonably modern browser that can run nicely on fairly crappy hardware is surf, but the version that comes with Debian is not great. For example, it seemed to load websites, but did not render anything. Here is how to compile it yourself:

At least, this worked for me…

Note:

$ cat /etc/apt/sources.list
deb http://mirror.aarnet.edu.au/debian/ bookworm main non-free-firmware non-free contrib
deb-src http://mirror.aarnet.edu.au/debian/ bookworm main non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

deb http://mirror.aarnet.edu.au/debian/ bookworm-updates main non-free-firmware
deb-src http://mirror.aarnet.edu.au/debian/ bookworm-updates main non-free-firmware

Installed the version from the repo:

$ sudo apt install surf dwm stterm

Tried it:

$ surf ecosia.com

Seemed to load, but nothing rendered. And threw lots of ‘file not found’ errors in the X terminal I ran it from.

Used links2 to find out how to install it!

It complained the default.css was missing, so I created an empty one:

$ touch .surf/styles/default.css

Removed the official package, but left dmenu and the other little tools:

$ sudo apt remove surf

Created an installation folder:

$ mkdir installs
$ cd installs/

Had to install git

$ sudo apt install git

Cloned the source code:

$ git clone https://git.suckless.org/surf
$ cd surf/

Install the build dependencies — I find this a bit magical, because I did not get the source from Debian, but I guess the files a really well packaged.

$ sudo apt build-dep surf

Try to make it, but find out some more stuff is missing:

$ make

Install the extra stuff — I don’t even have the Linux headers installed!

$ sudo apt install linux-headers-$(uname -r)

Version 4.1 of this is installed, but it seems to need 4.0:

$ sudo apt install libwebkit2gtk-4.0-dev
$ make -j$(nproc)

Yay! Can just run it from where it is:

$ ./surf google.com

Now, can make a soft link to my personal bin folder:

$ ln -s /home/goossens/installs/surf/surf /home/goossens/bin/surf

$ cd
$ which surf
/home/goossens/bin/surf

OK, good. But for some reason when I ran it it tried to load /usr/bin/surf and then barfed. I had removed the official package already, but for some reason it went looking for it. Maybe after a reboot? Anyway.

Well, copied ~/bin/surf to ~/bin/mysurf and all is well.

Looks nice.

 

Slackware on my netbook: it’s like a new computer

Maybe reinstalling Debian on a clean partition would have worked just as well, but I can honestly say I am stoked by the responsiveness of the old machine with Slackware. Recently running Debian I could get a cup of tea while waiting for Firefox to open, and more than one tab at a time made the machine unusable. With Slackware Firefox is responsive and I can use a bunch of tabs, even when using KDE as a desktop. Other programs are similarly snappier It’s like a new machine! (See also this post.)

But there were bumps along the way! At least some may have been caused by corrupt install media — eg the issues with motif, pixman and mtdev. kcm_touchpad should really be in the default install, because without it you cannot control the touchpad using the KDE settings menus.

Netbook (Acer Aspire 1 D255E) is getting old and slow. Debian seems crufty. Going for Slackware 14.2.

  1. From https://syd.mirror.rackspace.com/slackware/slackware-14.2/usb-and-pxe-installers/, download usbboot.img
  2. Stick a USB into the computer
  3. sudo dmesg tells me it is sdb
  4. sudo dd if=usbboot.img of=/dev/sdb bs=1M
  5. OK, reboot
  6. F2 for boot options
  7. Options are USB HDD, USB CDROM, USB FDD and HDD — no USB. OK, Put all 3 USB options ahead of HDD and go.
  8. Boots to boot prompt but will not go any further. Sits there waiting for me to hit Enter but does not respond to the keyboard!
  9. Reboot again using hard reset, and touch nothing! … Nope.
  10. Stymied.
  11. Maybe we need the big install image and the USB DVD drive.
  12. Well, default will boot in 2 minutes. Let’s see if it is a keyboard problem and wait it out. After all,t he cursor is flashing.
  13. But no!
  14. OK, burned the i386 iso to DVD and booted from a USB CD/DVD drive and that worked.
  15. Stepped through the installation. Installed the lot. Got NetworkManager to mange the network — works better with wireless, I find, than the other options. The installer said something was wrong with motif. I just kept going. All good, then used slackpkg to install motif.
  16. X would not work. Used slackpkg to reinstall pixman, then X worked.
  17. Default desktop (KDE) woefully slow on this hardware — but it is old hardware. Improved a lot when I turned off as many animations and shadings and suchlike as possible. (https://forum.manjaro.org/t/how-do-i-speed-up-or-slim-kde/90877/8). May or may not use KDE as desktop anyway.
  18. Now I find X is not reading my keyboard! OK, logout from X and have to fix. Try the obvious first:
  19. slackpkg update
  20. slackpkg upgrade-all
  21. The update is important because the install images are getting old; 14.2 is updated regularly and a lot has changed. I should have done it right away, possibly after slimming down the install by removing packages I don’t want. Reboot!
  22. Still no keyboard.
  23. If I run X -configure, I get a seg fault in linux-gate.so.1 — a file that does not exist…
  24. Reboot with a USB keyboard plugged in.
  25. Nope. Checkout /var/log/Xorg.0.log — problem with something called libmtdev.so.1
  26. slackpkg remove mtdev
  27. slackpkg install mtdev
  28. Fixed!
  29. OK, now slackbuilds …
  30. Went to slackbuilds.org and installed sbotools as per the instructions.
  31. Installed kcm_touchpad from slackbuilds to allow me to turn off tapping the touchpad (I hate gestures and I accidentally touch the pad and my cursor moves unexpectedly and … it’s a real usability issue).
  32. OK, we are essentially all set up. Wireless works, wired network works, all good.

Next steps will be removing software I don’t want (just to reduce the download size on updating) and using the thing productively.

Slacking off

EMF files on Linux

EMF files are Windows enhanced metafiles. They are not all that common, but they do crop up. They are useful if you want to put xFig drawings into Word documents as vector graphics rather than bitmaps, for example. You can open them in LibreOffice Draw and in Inkscape. What if you want a lighter solution? For example, you just want to browse through them and see which ones you want.

Have played with libqemf: https://sourceforge.net/projects/libqemf/; it is useful though not perfect — does not handle text well, unless the text has been saved as drawn lines rather than actual text. It can save files as BMP, PDF, EPS, PIC and SVG, but they also have corrupted text. It can open files from the command line. 

Get the source and run qmake (not as superuser) and see what it says:

$ qmake
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory

$ which qmake
/usr/bin/qmake

OK…

$ ls -l $(which qmake)
lrwxrwxrwx 1 root root 9 May 4 2019 /usr/bin/qmake -> qtchooser

$ which qtchooser
/usr/bin/qtchooser

$ find /usr/lib/x86_64-linux-gnu/ -name qmake

And it finds nothing. OK, so it’s linked to nothing.

Check Debian packages for qmake turns up qt4-qmake and qt5-qmake

The error was looking for qt4, so that will do.

$ sudo apt install qt4-qmake
$ qmake

And now we have a Makefile

$ make

OK, I don’t have some development libraries installed. After some experiments and hunting around, I eventually figure out I need:

$ sudo apt install qt4-default
$ qmake
$ make
$ sudo make install
OK!

Does not seem to install the viewer, but does compile it, so made a little script to use EmfViewer (in the build directories) called ~/bin/viewemf. Here is the content of emfviewer:

$ cat ~/bin/viewemf
/home/username/installs/libqemf-gpl-0.6/EmfViewer/EmfViewer $1 $2 $3 $4 $5 &

Seems to work ~OK, but does not render text correctly. Good for a very fast check of the contents of the file, but not for more than that. Still, useful because Inkscape and LibreOffice are slow to load, so this is good for quick checks. I could try to figure it out. Maybe there’s a build dependency not installed. I dunno.

Missing the text, but loads very fast

How about Cygwin? Does not make sense, because EMF is native to Windows and Cygwin is a way to run POSIX stuff on Windows, but … My Cygwin install seems to have a binary called qmake-qt4, so let’s see what happens…

Download and unzip the emfviewer code and:

$ qmake-qt4
$ make

Some build dependencies missing (QImage). Maybe this one?

$ apt-cyg install libQtGui4-devel

Yep! That’s the magic. Lots of Qt libs were already installed, including some devel ones, but that one was the key. But then we also need QSvgGenerator. OK, search for that on the Cygwin package search website.

$ apt-cyg install libQtSvg4-devel

OK, and make again, and … success! 

$ make install

OK, an again the viewer can be installed manually.

It works very nicely for everything except text. Here is a screenshot of the Cygwin version:

A Gaussian curve, but the text is gibberish
Shows the Save dialog — some useful formats! But the text is corrupt.

 

Allllllll-righty then!