Ubuntu 8.04 LTS
Experience, Information Technology

The CUTE Journey

Every now and then you will find yourself needing to install a really old Ubuntu version. I stumbled into this with CUTE and Scintilla. You see, the RedDiamond project really needs to jump ship from QPlainTextEdit. The syntax highlighting available in that module is horribly inefficient. If you never have more than a couple thousand lines in your source file and you don’t have multiple source files of that size, you can probably continue on fat, dumb, and happy with it. Life sucks if you routinely have source files tipping the scales at 5K lines or more. This makes for a long load time. Even the creator of Featherpad is starting to have updates tweaking the syntax highlighting because he too is using that class and the class is more of a student project than a robust editing widget.

Thankfully Scintilla is out there. Sadly, nobody had yet ported it to CopperSpice. I have a port but I haven’t had time to work on the new editor version so I cannot say for certain my port works. The Qt port that is part of Scintilla relies on a somewhat dangerous thing. It is relying on every character either being one byte or starting with some multi-byte indicator value making it a two byte character. I’m sure it works in America, just look at all of the editors using Scintilla and Qt.

QString in Qt is very different from what CopperSpice has implemented. I got pulled away from my coding helping out on the family farm and by life in general. I coded what I thought was going to work quite a while back. CopperSpice string changes made it sound like the existing QByteArray logic used by the Qt version wasn’t going to work. Internally CopperSpice uses QChar32 while internally Qt uses QChar which stores UTF-16.

At any rate, when I return to coding I will find out if my modifications were correct or if I need to force a UTF-16 QByteArray and use the previous logic. If I understood the logic correctly, UTF-16 cannot store all Unicode values in two bytes. CopperSpice chose QChar32 (wasting a bit of RAM) to embrace a wider Unicode set. This means the unofficial packages found in this post will be the last ones using QPlainTextEdit.

Research and Background

Make no mistake, there are hundreds of editors out there using Scintilla. The FOX Toolkit even includes one using a port of Scintilla for that GUI library. (The FOX Toolkit is worth kicking the tires on if you don’t need all of the bloat of Qt. It also doesn’t really push the C++ compiler which is why the toolkit works on so many systems.) I’ve known about Juffed for quite a while. Scintilla itself comes with Scite. Most everybody who does any serious programming on the x86 platform has heard of Notepadqq as well. A very robust free (as in beer) editor that doesn’t have the Microsoft tracking code.

The Internet is evil.

Burn that though into your brain. The Internet is evil. I got sucked into a all-of-my-free-time-and-then-some black hole because of one link. Once an editor was created using Scintilla it got added to that list and never removed. I glanced at several. One looked particularly interesting, and that one was CUTE.

CUTE text editor screenshot

I scraped that screenshot from this site. The screenshots had a Windows 95 era look to them but I wasn’t letting that bother me. There wasn’t a lot of code in the repo so it would be a good tire kicker getting started with Scintilla. (Yes, I was going to look at Scite code as well!)

There is a lesson for those who read on

There were things I added to RedDiamond I wanted to keep. There were things that started in Diamond and I was going to throw out. There were more features I wanted to add.

Above all, since I was going to use Scintilla as the editing core, I wanted to look at a lot of OpenSource editors for how-to ideas and features that might be worth adding to RedDiamond. I wanted to finally create the editor I had wanted my entire PC working career. I didn’t want a “general” text editor that got tabs wrong. I wanted a programmer’s text editor that got tabs correct, had EDT keypad navigation and a host of other features.

In short people, I wanted to make RedDiamond a kick-ass editor that would remain stable because it would not allow plug-ins. Admit it. You’ve all installed a plug-in for an editor and had it bust other things. Sometimes it busts the entire editor. Script-kiddies cutting their first programming teeth tend to write those things and they don’t know how to test. Worse yet, they suffer from “Oh, I’ll write my own” way more than us old people. That’s why between ELPA and MELPA Emacs has sooo many near-duplicate packages. Some might even be 100% duplicate, just written by someone else and placed in “the other” package library because someone didn’t bother to search both before writing.

One outright fantasy, would be if the final editor could not only get tabs correct, but could handle all/most legal COBOL source formats. Click the link for editors that got tabs wrong and read. Some time around COBOL-85 the source format dropped the line number/card format requirement. The drug induced hallucination would then be to extend that functionality to support BASIC line-number-era formatting and the no line required later. Same with FORTRAN and a few other languages. Before you go thinking that to be rather kooky, keep in mind PowerBasic created PBEdit with Scintilla. Sadly it isn’t OpenSource to look at.

I don’t care if you think those languages are old and obsolete. I want this to be the editor I’ve always wanted on the PC. There are thousands (possibly millions) of text editors out there and they all have things that suck about them. I want this editor to not have a sucky part.

Once it is close to perfect I can use it to create an IDE for CopperSpice. I’m old and want to retire so that IDE won’t be free, just the editor.

What’s the Lesson?

Never fixate on a “make it work today” project just because you have some time on your hands.

If you haven’t done that to yourself, you haven’t worked in IT long enough. I knew my brother wanted help with planting season and it was coming up fast. I knew there were other family obligations coming up. But “today,” whenever today was, I had the time. This seemed like a fun and interesting little challenge.

Pay somebody to slap you really hard when you start thinking like that.

The other lesson I’m saving until the very end.

Last Update 2013 and That was to Package Binaries

I saw that on SourceForge and didn’t care. Today I had time. Today I could play with trying to get this to build/run under Ubuntu 20.04 LTS. If that didn’t work, I was certain I could find a Ubuntu 12.04 LTS ISO to install in a VM.

Gotta say, I’ve been warned about thinking before. Doesn’t lead to good outcomes for me. This was no different. The little Gnome was cackling in the back of my mind. It really enjoys my enduring pointless frustration. That Gnome even helps me ignore obvious things like the fact this was written using Python 2 and the name of the missing library methods reminds me of something I can’t quite put my finger on.

qextscintilla.h – Why Does That Sound Familiar?

The Gnome kept stepping on this thought every time it popped up. I got most of the build to “work” using modern stuff once I installed Python and Qt development in a Ubuntu 20.04 LTS VM. I searched and I searched. There was something familiar about that file name. It had to be in one of the development package libraries.

Keep in mind I’m currently ignoring all of the other Scintilla based text editors that would actually compile because they are currently maintained. I want to get this one to work. The little Gnome is whispering “You can’t throw in the towel now. What will you do with the rest of your day? Are you really going to let a little program like this defeat you?”

It knows (gnows?) how to push my buttons.

Fine! I’ll set up a 12.04 LTS VM! Note, the setting up sections to follow are for

Setting up a Ubuntu 12.04 LTS VM in 2021

This part is only useful for those who want to set up 12.04 LTS in a VM today. I will be installing things that “should” have built CUTE.

Download Ubuntu 12.04 LTS release from here. Install into a VM.

sudo apt-get install build-essential
sudo apt-get install synaptic

Install all updates and if you are using Virtualbox, install the Guest Additions. This may require several reboots.

Reboot before proceeding.

sudo apt-get install subversion
sudo apt-get install python-dev   # this installs 2.7
sudo apt-get install jed jed-extra
sudo apt-get install qtcreator
sudo apt-get install libshiboken-dev
sudo apt-get install shiboken
sudo apt-get install pyqt-tools python-qt-dev
sudo apt-get install pyside-tools python-pyside.qtgui python-pyside.qtuitools python-pyside.qtxml
sudo apt-get install libpyside-dev
sudo apt-get install qt3-dev-tools libqt3-headers qt3-apps-dev python-qt3 libqt3-mt-dev
sudo apt-get install gnutls-bin libqt3-i18n python-qt3-gl
sudo apt-get install qt3-dev-tools-compat libfxscintilla-dev

Download and install version 2.10.0 of qscintilla from Riverbank Computering.

mkdir Projects
cd Projects
svn checkout https://svn.code.sf.net/p/cute/svn/trunk cute-svn
cd cute-svn/CUTE
jed configure.sh

Copy python 2.4 logic to make 2.7 in both places where 2.4 appears. You should have two sections in configure.sh looking much like the following:

elif test -f $withval/include/python2.4/Python.h; then
      PYTHON_INCDIR=$withval/include/python2.4
      PYTHON_LIBS="-L$withval/lib/python2.4/config -lpython2.4 -lutil -ldl"
elif test -f $withval/include/python2.7/Python.h; then
      PYTHON_INCDIR=$withval/include/python2.7
      PYTHON_LIBS="-L$withval/lib/python2.7/config -lpython2.7 -lutil -ldl"
if test -f /usr/include/python2.4/Python.h; then
      PYTHON_INCDIR=/usr/include/python2.4
      PYTHON_LIBS="-L/usr/lib/python2.4/config -lpython2.4 -lutil -ldl"
elif test -f /usr/include/python2.7/Python.h; then
      PYTHON_INCDIR=/usr/include/python2.7
      PYTHON_LIBS="-L/usr/lib/python2.7/config -lpython2.7 -lutil -ldl"

Configure still doesn’t work.

sudo apt-get install python-qscintilla2 libqscintilla2-dev

No Love!

Download Scintilla 3.2.4 from SourceForge and extract into Projects directory.

cd ~/Projects/scintilla/qt/ScintillaEdit
python WidgetGen.py
cd ~/Projects/scintilla/qt/ScintillaEditPy
python sepbuild.py

Start QtCreator.

Open project ~/Projects/scintilla/qt/ScintillaEdit/ScintillaEdit.pro

Build All

Result of build
cd ~/Projects/scintilla/bin
Everything seems to be there

You see, the configure script was expecting to find this library built from scratch at the same directory tree level as the CUTE project. It’s okay for those of you who are laughing right now. I’m sharing this so you can all get a good yuck while learning how to install really old Ubuntu versions in a VM.

cd ~/Projects/cute-svn/CUTE
still no love

Now we actually edit configure.sh.

The Help text lied

Obviously the help text lied.

That logic is a wee bit ugly

Basically there is a hard coded directory tree and you get to change the base via a command line parameter. That would be okay if it weren’t for one teeny tiny thing.

qextscintilla.h doesn’t exist anywhere.

Adding insult to injury for someone that is an old timer with Qt, the prefix “qext sounds very familiar.

Setting up a Ubuntu 8.04 LTS VM in 2021

This part will provide useful information for anyone that has to maintain something very old. In particular, medical devices that were approved long ago will force you to use the old tool chain.

Yes, Ubuntu 8.04 LTS has long since been officially dropped. Thing of it is, that means it moved to older, possibly slower and not mirrored servers. Most likely these servers are much like the ones you end up on when you sign up for $8.95/year hosting services. They will handle the tiny number of people who actually visit your blog or whatever.

The only real downsize of this is you have tweaking to do. If you are really lucky someone else has already had to do the tweaking and posted the answer like this one. That saved me a lot of searching. As I stated, the repos got moved.

Download Ubuntu 8.04 LTS from here and install into a VM. (I used the 64-bit version) Once you have completed your install and rebooted, open a terminal.

cd /etc/apt
sudo mv sources.list sources.list_orig

Now copy/save/whatever the new sources.list you pulled down from the link above. If you are too lazy to scrape it yourself from the other link then download u18-sources-list.txt here and rename once you get it. I was going to put it into this post but the Code block of WordPress block editor is busted bad. It was using the # character for something and really mangling the file.

Reboot. Login and open another terminal.

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update
sudo apt-get upgrade

Note: Ubuntu 8.04 (and several other Ubuntu flavors) had issues with monitors running in VMs. If your GUI stops working you can <ALT><CTRL><F2> to open a terminal. Just login there and type

sudo reboot now

The above works if Windows 10 is your host. It does not work if Ubuntu 16.04 LTS is your host. Why would anyone use Ubuntu 16.04 LTS as a host? To get the version of VirtualBox that works with the libxrandr-dev version found in Ubuntu 8.04 LTS. Otherwise you have a tiny little screen no matter what you do.

Assuming you are still progressing:

sudo apt-get install build-essential
sudo apt-get install libxrandr-dev

You need the build-essential for the Guest Additions. (I assume you are using Oracle Virtualbox.) “Insert Guest Additions” next. Autorun will not work. After you’ve inserted the CD via the Devices menu you have to open a terminal and type the following:

cd /media/cdrom0
sudo ./VBoxLinuxAdditions.run

Reboot. (Yes, all of the rebooting rather sucks.) Most likely your screen will remain a tiny box in the center of your actual screen. At least it will if you are using a current Virtualbox on Windows 10. I tried every video card Oracle provides. Found no monitor love. Newer Virtualbox needs version 1.4 and 1.2 is what the repo has. Use GUI tool that should be telling you about updates with big red arrow pointing down up by your name at the top of the screen to apply “held back” updates.

Reboot.

The following were installed in my hopeless attempt at getting CUTE to work.

sudo apt-get install python-kde3-dev python-qt3 python-qt-dev python-qtext 
sudo apt-get install libssl-dev libwww-ssl-dev libwww-ssl0 python-openssl 
sudo apt-get install subversion python2.4-dev qt3-dev-tools libqt3-mt-dev 
sudo apt-get install python-kde4-dev pyqt4-dev-tools python-qt4-dev python-qt4-dbus 
sudo apt-get install python-qt3-gl libqscintilla-dev python-pyopenssl epiphany-browser 
sudo apt-get install galeon autoconf python-qscintilla2 libqscintilla2-dev scite
sudo apt-get autoremove

Now I had to svn checkout CUTE on host computer and copy to shared folder to get into Ubuntu 8 as SSL is far too old. One of the reason’s I installed so many browsers was the hope one could work around the issue. Bad thing hope. Causes us to suffer needlessly.

The elusive header file

I couldn’t believe it when I found the header file. I thought “Yes! Now I’ve won.” Been warned about thinking before. I edited configure.sh and took out the /qt/ in the paths where the code was looking for qextscintilla.h

if test "${with_qscintilla+set}" = set; then
 withval="$with_qscintilla"
 QSCINTILLA=
  if test -f $withval/qextscintilla.h; then
      QSCINTILLA=$withval
   elif test -f $withval/include/qextscintilla.h; then
      QSCINTILLA=$withval/include

Now configure should actually build.

cd ~/Projects/cute-svn/CUTE
./configure.sh --with-qscintilla=/usr/include/qscintilla/

There was a dim glimmer of hope.

roland@roland-u8-desktop:~/share/cute-svn/CUTE$ ./configure.sh --with-qscintilla=/usr/include/qscintilla/
 checking for true… /bin/true
 checking for false… /bin/false
 checking for g++… g++
 checking for C++ compiler default output file name… a.out
 checking whether the C++ compiler works… yes
 checking whether we are cross compiling… no
 checking for suffix of executables… 
 checking for suffix of object files… o
 checking whether we are using the GNU C++ compiler… yes
 checking whether g++ accepts -g… yes
 configuring for CUTE 0.3.0 (12 April 2005)
 checking for a BSD-compatible install… /usr/bin/install -c
 checking for mv… /bin/mv
 checking for rm… /bin/rm
 checking for cp… /bin/cp
 checking for echo… /bin/echo
 checking for ar… /usr/bin/ar
 checking for qmake… /usr/bin/qmake
 checking build system type… x86_64-unknown-linux-gnu
 checking host system type… x86_64-unknown-linux-gnu
 checking for Operating System Distribution… done
 checking for Python location… yes
 checking for Qscintilla location… yes
 configure.sh: creating ./config.status
 config.status: creating Makefile
 config.status: creating src/cute.pro
 config.status: creating src/config.h
 config.status: src/config.h is unchanged
 config.status: executing default commands
 Configuration on Tue Jun 15 11:41:22 CDT 2021:
 Host:               x86_64-unknown-linux-gnu -- debian lenny/sid
   CUTE version:           0.3.0 (12 April 2005)
   Source code location:       .
   Install binaries:          ${exec_prefix}/sbin
   Install config files:       ${prefix}/etc
   Scripts directory:          
   C++ Compiler:           g++ 4.2.4
   Compiler flags:           -O
   Linker flags:            -O
   Libraries:              
 Python libs:              -L/usr/lib/python2.4/config -lpython2.4 -lutil -ldl
   Python include:          /usr/include/python2.4
   Qscintilla dir:          /usr/include/qscintilla/

Running make rather dashed hope, until I looked at it closely. This will seem obvious to you, but I had to first get a scrollback buffer setting big enough to get back here. For some reason it didn’t redirect to a file properly.

/usr/share/qt3/bin/uic ../ui/projectdialog.ui -o ../ui/projectdialog.h
 /usr/share/qt3/bin/uic ../ui/statusbar.ui -o ../ui/statusbar.h
 g++ -c -pipe -Wall -W -g -D_REENTRANT  -DQT_THREAD_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I.. -I/usr/include/qscintilla//qt/ -I/usr/include/qscintilla//include -I/usr/include/python2.4 -I/usr/include/qt3 -I../moc/ -o ../obj/cute.o cute.cpp
 cute.cpp:46:34: error: qextscintillaprinter.h: No such file or directory
 cute.cpp:47:31: error: qextscintillabase.h: No such file or directory
 In file included from cute.h:55,
                  from cute.cpp:49:
 c

Yes, stupid me should not have used a slash at the end of the directory path, but that is not the interesting part. Some other place in the command file is hard coding “/qt/” and “/include” on the end of that.

Hard coding of directory paths is always bad people!

That was hidden in autoconf/configure.in

autoconf/configure.in

And in src/cute.pro.in

src/cute.pro.in

They also screwed us with a hard coded /lib.

After cleaning up the first hosing I tried another clean build.

Newest build error

This is where the Gnome cackled the loudest. This is where I remember why Qext sounded so familiar.

There was a most unfortunate time in Qt’s history where they had this Website called “Playground.” Things that were being worked on unofficially, perhaps as proof of concept, got put here. They were all prefixed with “Qext” to indicate they were “Extra” classes/modules and not part of actual Qt. When something was deemed worthy of being included in Qt it was then taken out of the playground. The Qext became just Q. Many of the method names, parameters, and parameter types would change.

I got fried on this with the serial port class on a project. Early development started with the playground. Before we finished a new release of Qt came out that included QSerialPort. That was not just a quick substitution with the editor.

CUTE is abandonware. From what I’ve seen just looking at the compiler output, anyone looking to bring it back would have to start over. That last compilation error means this was written using a very old C/C++ standard. I remember during the days of DOS when we could just assume most pointers were interchangeable, but that was long ago.

Gnome 1 Rollie 0