Lattice devices look appealing compared to other vendor offerings for some of the applications I am looking at right now, so I recently tried to install the Lattice Diamond development tools on my Ubuntu 14.04 machine. The vendor offers only an rpm targeting redhat like distro’s, so a little work was required to get it working.
I started off trying to install this natively, and in the end gave up. As noted in “Chapter 1” below. The solution that worked was to setup a fedora chroot, which in the end was not that hard. If you want almost working solution, skip down to “Chapter 2”.
EDIT^2: After trying and failing with chroot fedora core 6, chroot fedora core 14, fedora VM and Windows XP, I finally have a working solution. It runs correctly under an OpenSUSE 11 chroot. I am revising Chapter 2 to reflect this. After failing with the Fedora VM I gave up and installed it under Windows XP… and it still didn’t work!
Chapter 1: What didn’t work
There doesn’t seem to be much info online. I found this tutorial but it is quite old (ubuntu 11) so there were some differences.
First I downloaded the .rpm from Lattice, installed alien, converted the rpm to a deb and installed it:
sudo apt-get install alien
sudo alien diamond_3_2-base_x64-134-x86_64-linux.rpm
sudo dpkg --install diamond-3-2-base-x64_3.2-135_amd64.deb
Alien takes a LONG time to convert the rpm. Note that I was working with diamond 3.2 64 bit. After the deb is installed diamond is now in /usr/local/diamond/. You will note it won’t run, now the fun begins.
First I had to manually untar the copy of tcl/tk that it includes, and link libpng to my local version:
sudo tar -xf tcltk.tar.gz
sudo mv libpng12.so.0 libpng12.so.0.old
sudo ln /usr/lib/x86_64-linux-gnu/libpng12.so.0 -s libpng12.so.0
At this point, I could run diamond from the bin directory but the license file was not working properly. Despite a match between my hostid and the license file, it was reporting that it was incorrect. After poking around I realized that diamond looks only at “eth0” for the hostid, even though the other flex tools like their licensedebug app will iterate through and look at other interfaces. After fixing this so that my ethernet was on eth0 (getting rid of persistent net rules) it fired up.
Now the issue is that it seems diamond does not support any devices. When starting a new project there are no devices listed in the dialog. If a project is loaded it says that the project is for an unsupported device every time. This is where it sits now. I can’t get it to work beyond here sadly. There is no debug output from diamond at all, and stracing didn’t give me any clues. I’m sure it is a trivial detail, but at this point I have no leads.
Chapter 2: The working solution, schroot
With no luck at a native install, I decided to go with a chroot based installation. I didn’t want to do a virtual machine since fpga software tends to utilize lots of RAM and processing, which is not ideal to run in a virtual environment. This solution ended up to work quite well, with minimal disk overhead as well.
I loosely followed this guide, although I modified several steps.
First, I installed the necessary packages schroot and rinse:
sudo apt-get install schroot rinse
Then created the chroot environment using rinse:
sudo rinse --arch amd64 --directory /srv/chroots/opensuse11 --distribution opensuse-11.1
Your arch could vary (i386) if you are installing to 32 bit. After this I edited the schroot config file:
sudo joe /etc/schroot/schroot.conf
This file, schroot.conf, needs to have a single entry added to it:
description=Open SUSE 11
users=[your username here]
Now we need to disable the X security to allow the schroot to open a remote X session, and then we will launch schroot:
sudo schroot -c opensuse11
At this point you should be inside your chroot environment and be looking at a prompt.
You now have to install a few extra packages as well as the diamond rpm file itself (you’ll need to download the diamond rpm and place it somewhere in your home directory):
zypper install tar xorg-x11-fonts*
zypper install diamond_3_3-base_x64-109-x86_64-linux.rpm
Substitute the correct name and path for the diamond rpm. Almost there! Now you need to setup a few things in the environment which will need to be done each time you run diamond, or you can put it into your bashrc inside the chroot:
export LM_LICENSE_FILE=[path to your diamond license file]
That should be it! You can now navigate to ‘/usr/local/diamond/3.3_x64/bin/lin64’ and run the diamond executable. Like magic, it should launch and run.
I can report that this process did not work with any Fedora chroot I tried. The “ipexpress” application failed. I had a similar failure mode with Windows XP, but the OpenSUSE solution prevailed!