Installing Lattice Diamond on Mint 20.3

I’ve been exploring Yosys / NextPnR / Project Trellis on some Lattice ECP5-based boards recently, and I’ve been very impressed and enthused by what I’ve seen. I do have to admit, though, that it’s not “there” yet, especially when it comes to SystemVerilog and VHDL support through the ghdl-yosys-plugin. Yes, you can develop and compile “real” projects with Yosys and friends, but you do have to keep the toolchain’s limitations in mind and design around them.

For this reason I wanted to install and try the “official” software for ECP5 development, namely Lattice Diamond. This left me with a slight problem in that it’s only available on Windows and Redhat Enterprise Linux 6 or 7, with the software distributed in RPM format.

Windows is not an option – I only have one Windows-equipped machine here, currently mothballed – and it only has XP anyway. I run Mint 20.3 as a daily driver, which is a derivative of Ubuntu 20.04. I did once attempt to install the RPM on an older Ubuntu-derivative using the “alien” tool, with no success, but I discovered more recently that RPMs can be converted easily to cpio archives. There are two tools we need here, both of which are in the Ubuntu repositories, so we’ll install those with

sudo apt install cpio rpm2cpio

Having downloaded the RPM (version 3.12 at the time of writing), create a temporary directory somewhere, cd into it, and run the following commands to extract the files from the RPM package:

rpm2cpio /path/to/diamond_3_12-base-240-2-x86_64-linux.rpm | cpio -idmv

We see a list of files being extracted within a usr/local/diamond/3.12 directory tree beneath our temporary directory – and the last of them reads: ./usr/local/diamond/3.12/tcltk/tcltk.tar.gz

So that will need extracting. As it happens, so will a number of other .tar.gz files. We can find them like so:

find . -iname \*.tar.gz

We could manually cd into each of those directories in turn, and extract the archives by hand… but where’s the fun in that? Here’s a bash monstrosity to perform that task automatically: [Edit: updated to replace the backticks which WordPress swallowed.]

for a in `find . -iname \*.tar.gz`; do bash -c "cd $(dirname $a); tar -xzvf $(basename $a)"; done

(We spawn a subshell with bash -c just to prevent the effect of the cd command persisting between files.)

Job done?

Well, actually yes! The answer used to be no, because there were a number of shell scripts which had a /bin/sh “shebang” but actually used bash syntax. With Diamond version 3.11 it was necessary to fix this using a handy script or two…

But with 3.12 this seems to be fixed out-of-the-box, and Diamond should now be runnable from within the temporary directory, with the command


It will ask for the license file on first run – a free node-locked license can be generated from the website, using the MAC address of your network card, but only after creating a user account, which will need to be activated. I attempted to create such an account many months ago using my regular gmail address, and it was never activated, so I was never able to create a license file. I tried again more recently, creating an account using an address on a private domain, and that actually worked. It wasn’t instant, however – so I think a human is involved in the process of reviewing and activating new user accounts.

Anyhow, once Diamond is up and running, you can move it to a more convenient location – I simply moved the ./usr/local/diamond directory to /opt

You might also want to reclaim some disk space by deleting the .tar.gz files, since they’re no longer needed. Either remove them manually or if you’re feeling brave enough to use rm within a for loop, use a variation of the command above!

As a parting shot – I note that as well as the diamond GUI software, there’s also a diamondc Tcl shell. My initial dislike of Tcl has in recent years given way, first to a grudging respect, and now some degree of admiration for such a minimalist language – it’s certainly possible to do some really neat things in Tcl, and as a way of remotely scripting events on an FPGA over JTAG it’s hard to beat for simplicity. My first instinct on finding myself in the diamondc Tcl shell was to see if I could load my tcljtag extension…

load /home/amr/FPGA/tools/xc3sprog/

Oh sweet summer child, did you forget so quickly the appalling state of binary software distribution under Linux?

couldn't load file "/home/amr/FPGA/tools/xc3sprog/": /home/amr/Desktop/diamond/usr/local/diamond/3.12/bin/lin64/ version `CXXABI_1.3.9' not found (required by /home/amr/FPGA/tools/xc3sprog/


So it turns out Diamond ships a libstdc++ that’s incompatible with the systemwide version. This doesn’t matter as long as nothing using one version attempts to link dynamically with something using the other version. Unfortunately that’s exactly what I just attempted to do.

Removing the version of the library shipped with Diamond fixes that particular problem but I haven’t yet tested widely enough to be sure it won’t have provoked any others!

One thought on “Installing Lattice Diamond on Mint 20.3

  1. Thanks, that also worked for Linux Mint 21.2 and Diamond 3.13.0 .

    I wonder whether I also could have just used the Mint Archive Manager which seems to be able to open rpm files.

Leave a Reply

Your email address will not be published. Required fields are marked *