ModelSim-Intel FPGA Edition running in Ubuntu 20.04

The ModelSim version that comes with Intel Quartus Prime Lite Edition is a good alternative if you want to try out VHDL simulation on your home computer. The software is available for both Windows and Linux, but Intel only supports Red Hat-based distros like CentOS Linux.

Fortunately, you are just a few hacks away from ModelSim working nicely on your Ubuntu box.

The video below shows how I did it on a fresh Ubuntu 20.04 virtual machine. For reference, I followed the procedure from PrieureDeSion’s GitHub gist, with a few changes to make it work with Ubuntu 20.04.

Where to download the ModelSim-Intel FPGA Edition for Linux

Go to Intel’s Download Center for FPGAs to obtain the installer.

Choose the Lite Edition for Linux, and click the Individual Files tab on the same page. Select the ModelSim-Intel FPGA Edition (includes Starter Edition) option, as shown in the image below.

ModelSim-Intel FPGA Edition (includes Starter Edition)

These are the commands for making ModelSim work in Ubuntu 20.04

# Start with ModelSimSetup-*-linux in your home directory
  
# Open a terminal in your home directory
  
# Update your system
sudo apt update; sudo apt upgrade
  
# Run the installer
./ModelSimSetup-*-linux.run
  
# Make the vco script writable
chmod u+w ~/intelFPGA/*.*/modelsim_ase/vco
  
# Make a backup of the vco file
(cd ~/intelFPGA/*.*/modelsim_ase/ && cp vco vco_original)
  
# Edit the vco script manually, or with these commands:
sed -i 's/linux\_rh[[:digit:]]\+/linux/g' \
    ~/intelFPGA/*.*/modelsim_ase/vco
sed -i 's/MTI_VCO_MODE:-""/MTI_VCO_MODE:-"32"/g' \
    ~/intelFPGA/*.*/modelsim_ase/vco
sed -i '/dir=`dirname "$arg0"`/a export LD_LIBRARY_PATH=${dir}/lib32' \
    ~/intelFPGA/*.*/modelsim_ase/vco
  
# Check that the correct lines have changed
diff ~/intelFPGA/*.*/modelsim_ase/vco \
    ~/intelFPGA/*.*/modelsim_ase/vco_original
  
# Download the 32-bit libraries and build essentials
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install build-essential
    sudo apt install gcc-multilib g++-multilib lib32z1 \
    lib32stdc++6 lib32gcc1 libxt6:i386 libxtst6:i386 expat:i386 \
    fontconfig:i386 libfreetype6:i386 libexpat1:i386 libc6:i386 \
    libgtk-3-0:i386 libcanberra0:i386 libice6:i386 libsm6:i386 \
    libncurses5:i386 zlib1g:i386 libx11-6:i386 libxau6:i386 \
    libxdmcp6:i386 libxext6:i386 libxft2:i386 libxrender1:i386
  
# Download the old 32-bit version of libfreetype
wget https://ftp.osuosl.org/pub/blfs/conglomeration/freetype/freetype-2.4.12.tar.bz2
tar xjf freetype-2.4.12.tar.bz2
  
# Compile libfreetype
cd freetype-2.4.12/
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" \
    "CXXFLAGS=-m32" "LDFLAGS=-m32"
make clean
make
  
cd ~/intelFPGA/*.*/modelsim_ase/
mkdir lib32
cp ~/freetype-2.4.12/objs/.libs/libfreetype.so* lib32/
  
# Run the vsim script to start ModelSim
cd
~/intelFPGA/*.*/modelsim_ase/bin/vsim

Output from the diff between ‘vco’ and ‘vco_original’

13c13
< mode=${MTI_VCO_MODE:-"32"}
---
> mode=${MTI_VCO_MODE:-""}
51d50
< export LD_LIBRARY_PATH=${dir}/lib32
211c210
<           *)                vco="linux" ;;
---
>           *)                vco="linux_rh60" ;;

Where to get support

Ubuntu is officially unsupported by Intel, so there’s no point in asking them. But there are a few threads about the subject on the FPGA Design Tools forum on the Intel Community Forum (formerly Altera Forum).

Another option is to make a post in VHDLwhiz’ private Facebook group: VHDL for FPGA Engineers. In fact, you should join it even if you’re not experiencing problems. It’s a growing community for everyone interested in FPGA design using VHDL.

Install Lattice iCEcube2 on Ubuntu

To complete the VHDL and FPGA development environment on your Ubuntu box, you may want to check out this tutorial:

Make Lattice iCEcube2 work on Ubuntu 20.04 and program the iCEstick FPGA board

With iCEcube2, ModelSim, and Project IceStorm installed, you can do VHDLwhiz’ beginner Fast-Track course and the advanced Dot Matrix course on your Ubuntu box!

Similar Posts

36 Comments

  1. In my experience Intel’s download page can be very slow and unstable from time to time. So you could also add the direct download link: “http://download.altera.com/akdlm/software/acdsinst/19.1std/670/ib_tar/Quartus-lite-19.1.0.670-linux.tar”

      1. I see. Here, back in Norway, I’ve had much better success with the direct link than their website. Never tried using a VPN to the US though.

  2. Hello have you tried installing this on WSL? I tried this on Ubuntu-18.04 and it fails while installing fontconfig:i386. I tried on a fresh installation of Ubuntu-20.04 and it fails on libc6:i386 with the following error:
    dpkg: error processing package libc6:i386 (–configure):
    installed libc6:i386 package post-installation script subprocess returned error exit status 1
    dpkg: dependency problems prevent configuration of libgpg-error0:i386:
    libgpg-error0:i386 depends on libc6 (>= 2.28); however:No apport report written because the error message indicates its a followup error from a previous failure.
    No apport report written because the error message indicates its a followup error from a previous failure.
    No apport report written because MaxReports is reached already
    No apport report written because MaxReports is reached already

    Package libc6:i386 is not configured yet.

    dpkg: error processing package libgpg-error0:i386 (–configure):
    dependency problems – leaving unconfigured
    dpkg: dependency problems prevent configuration of libgcrypt20:i386:
    libgcrypt20:i386 depends on libc6 (>= 2.28); however:
    Package libc6:i386 is not configured yet.
    libgcrypt20:i386 depends on libgpg-error0 (>= 1.25); however:
    Package libgpg-error0:i386 is not configured yet.

    dpkg: error processing package libgcrypt20:i386 (–configure):
    dependency problems – leaving unconfigured
    dpkg: dependency problems prevent configuration of liblz4-1:i386:
    liblz4-1:i386 depends on libc6 (>= 2.4); however:
    Package libc6:i386 is not configured yet.

    dpkg: error processing package liblz4-1:i386 (–configure):
    dependency problems – leaving unconfigured
    dpkg: dependency problems prevent configuration of liblzma5:i386:
    liblzma5:i386 depends on libc6 (>= 2.17); however:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    have you seen anything similar?
    Thanks for any hint

    1. I suppose you have good reasons for trying to run ModelSim in WSL because it would be simpler to download the ModelSim-Intel FPGA Edition for Windows.

      If you must have ModelSim working in WSL, it seems that the libc6:i386 package is missing or has the wrong version. Refer to the commands listed in the blog post above for how to install it.

      You can use the “apt list” command to check which version you currently have installed. This is the output from the Ubuntu VMWare box that I used in the tutorial:

      jonas@ubuntu:~$ apt list libc6
      Listing... Done
      libc6/focal,now 2.31-0ubuntu9 amd64 [installed,automatic]
      libc6/focal,now 2.31-0ubuntu9 i386 [installed]
      

      Note that the 32-bit (i386) version in the listing above is newer than the 2.28 that your error message is complaining about. Perhaps you haven’t done the steps from “sudo dpkg –add-architecture i386” and onward?

      Or maybe you have a too old version installed and need to do a “sudo apt update; sudo apt upgrade”.

      Please reply if you find the solution to help other googlers who arrive at this blog post with a similar problem. ?

  3. Hi Jonas,
    Thanks for your answer. I was able to successfully install Modelsim 19.4 on my WSL system (Ubuntu 18.04). I migrated my system to WSL2 in the meantime and I wonder if that could have helped. Before migration, installation of fontconfig:i386 was constantly failing.

    I do have modelsim running in Windows, however, since most of my development is done in WSL, I do not like switching back and forth. Moreover, for the sake of running regressions and creating a “decent” flow, I do prefer to be able to run it in WSL.

    Thanks once again for the detailed instructions. That was very helpful

  4. Thanks for the instructions, certainly saved me some headache! In order to launch ModelSim from Quartus (18.1) I also had to add the freetype lib path to quartus/adm/qenv.sh. I was lazy and just used the same path made following your instructions, so make quartus/adm/qenv.sh writeable and add “export LD_LIBRARY_PATH=/home/USER/intelFPGA/modelsim_ase/lib32:$LD_LIBRARY_PATH”. The font in ModelSim was also unreadably tiny but fixed by https://stackoverflow.com/a/41698839

    1. Hello, Dennis. Thanks for the heads-up. I was able to make the fonts larger by going to Tools->Edit Preferences->Fonts. That was one of the suggestions from the StackOverflow article.

  5. Thank you for this. For Ubuntu 20.1, lib32gcc-s1 is replaced with lib32gcc-s1 (according to apt). That was the only change I made and it seems to work well!

  6. (base) harish@harish:~$ sed -i ‘s/linux\_rh[[:digit:]]\+/linux/g’ \
    >     ~/intelFPGA/20.1/modelsim_ase/vco
    sed: can’t read     ~/intelFPGA/20.1/modelsim_ase/vco: No such file or directory
    (base) harish@harish:~$ sed -i ‘s/MTI_VCO_MODE:-“”/MTI_VCO_MODE:-“32″/g’ \
    >     ~/intelFPGA/20.1/modelsim_ase/vco
    sed: can’t read     ~/intelFPGA/20.1/modelsim_ase/vco: No such file or directory
    (base) harish@harish:~$ sed -i ‘/dir=`dirname “$arg0″`/a export LD_LIBRARY_PATH=${dir}/lib32’ \
    >     ~/intelFPGA/20.1/modelsim_ase/vco
    sed: can’t read     ~/intelFPGA/20.1/modelsim_ase/vco: No such file or directory

    1. It seems that your installation path is different from what my script expects. You have to find out what the path to the ‘vco’ file is and adjust the script.

      Try searching for it like this:

      find ~/intelFPGA/ -name 'vco'
  7. Hi, thank you for providing this helpful information!
    Do you have any experiences or update for more recent versions of Quartus/Modelsim, e.g. for 20.1?
    Here the described file entries differ.
    Thanks!

      1. Hi Jonas,
        I run Ubuntu 20.04.2 LTS and Quartus 20.1.
        I got Modelsim GUI running just adding the 32b stuff, no other changes yet (as the file contend of VCO etc. changed): # Download the 32-bit libraries and build essentials
        I had to add the path too: export PATH=$PATH:~/intelFPGA_pro/20.1/modelsim_ase/bin.
        Remarkable, the previous reported font issues are not there, GUI looks nice.

        As I’m not an in-deep VHDL developer but doing work with HLS I use Modelsim indirectly via HLS workflow. Here a HDL testbench is generated and run automatically from the tool (co-simulation). All the steps until calling vsim go without errors but here the trouble starts:
        ** Fatal: (vsim-3827) Could not compile ‘export_tramp.so’: cmd = ‘/data1/intelFPGA_pro/20.1/gcc/bin/gcc -shared -fPIC -m32 -B/usr/lib32
        ../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible ../lib/gcc/x86_64-pc-linux-gnu/9.1.>
        ../x86_64-pc-linux-gnu/bin/ld: cannot find -lgcc
        I guess it’s still some incompatibility with the 64b/32b stuff but I’m a little bit lost here …
        If you are motivated to step in .. that would be great 😉

  8. Thank you for description but after this procedure Ubuntu 20.04.3 LTS Quartus 18.1

    Reading pref.tcl
    ./../linux/vish: symbol lookup error: /usr/lib/i386-linux-gnu/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
    ** Fatal: Read failure in vlm process (0,0)

    Do you have some idea how to solve this issue?

    1. Hello, Victor. I can’t recall seeing that error message before. I should create an updated version of this blog post for the current versions of Ubuntu and ModelSim, but I haven’t had the time yet.

      Please share if you figure out the answer!

      1. I also stumbled upon this problem, but got it running after some trial and error by following the steps here: https://j-marjanovic.io/new-ubuntu-old-problems-with-modelsim.html

        It involves using old versions of both freetype (2.4.7, not sure if that’s needed or if it will work with 2.4.12 too) and fontconfig. The instructions are a bit soft on some details, but at least you need to do a ‘make install’ of freetype with an appropriate prefix to freetype’s configure script in order to include it for the fontconfig configure script (the LDFLAGS=-L part).

        Good to be up and running with Modelsim again after upgrading from Ubuntu 18.04 to 20.04.

      1. I am new to Quartus Prime.
        After installation in ubuntu, when I run it. I keep getting below error.
        How should I install Quartus Prime Lite?
        kmsumu@kmsumu-virtual-machine:~/intelFPGA_lite/17.0/quartus/bin$ ./quartus &
        [1] 2196
        kmsumu@kmsumu-virtual-machine:~/intelFPGA_lite/17.0/quartus/bin$ quartus: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

  9. Thank you for the help – The Intel documenation didn’t even come close to helping. Thanks to your blog, I am now up and running on Ubuntu 20.04. Cheers.

  10. hi sir this purushothama
    your blog helped me much regards modelsim work on ubuntu 20.10 .but quartus prime is not working please help about this
    thank you

  11. Thank you very much, searched internet for this modelsim build problem issue on ubuntu 20.04 LTS, tried tons of methods but none has worked

    Your method handled the situation and now modelsim started without problem. One note, I had to go freetype website and download the tar file manually as your script’s ftp address did not work.

  12. sd

    kosty@Bee:~/freetype-2.4.12$ ./configure –build=i686-pc-linux-gnu “CFLAGS=-m32” \
    “CXXFLAGS=-m32” “LDFLAGS=-m32”

    FreeType build system — automatic system detection

    The following settings are used:

    platform unix
    compiler cc
    configuration directory ./builds/unix
    configuration rules ./builds/unix/unix.mk

    If this does not correspond to your system or settings please remove the file
    `config.mk’ from this directory then read the INSTALL file for help.

    Otherwise, simply type `make’ again to build the library,
    or `make refdoc’ to build the API reference (the latter needs python).

    Generating modules list in ./objs/ftmodule.h…
    * module: truetype (Windows/Mac font files with extension *.ttf or *.ttc)
    * module: type1 (Postscript font files with extension *.pfa or *.pfb)
    * module: cff (OpenType fonts with extension *.otf)
    * module: cid (Postscript CID-keyed fonts, no known extension)
    * module: pfr (PFR/TrueDoc font files with extension *.pfr)
    * module: type42 (Type 42 font files with no known extension)
    * module: winfnt (Windows bitmap fonts with extension *.fnt or *.fon)
    * module: pcf (pcf bitmap fonts)
    * module: bdf (bdf bitmap fonts)
    * module: sfnt (helper module for TrueType & OpenType formats)
    * module: autofit (automatic hinting module)
    * module: pshinter (Postscript hinter module)
    * module: raster (monochrome bitmap renderer)
    * module: smooth (anti-aliased bitmap renderer)
    * module: smooth (anti-aliased bitmap renderer for LCDs)
    * module: smooth (anti-aliased bitmap renderer for vertical LCDs)
    * module: psaux (Postscript Type 1 & Type 2 helper module)
    * module: psnames (Postscript & Unicode Glyph name handling)
    done.
    cd builds/unix; /bin/sh ./configure ‘–build=i686-pc-linux-gnu’ ‘CFLAGS=-m32’ ‘CXXFLAGS=-m32’ ‘LDFLAGS=-m32′
    checking build system type… i686-pc-linux-gnu
    checking host system type… i686-pc-linux-gnu
    checking for gcc… gcc
    checking whether the C compiler works… no
    configure: error: in `/home/kosty/freetype-2.4.12/builds/unix’:
    configure: error: C compiler cannot create executables
    See `config.log’ for more details
    make: *** [builds/unix/detect.mk:86: setup] Error 77
    kosty@Bee:~/freetype-2.4.12$

    1. Hello, Konstantin. Sorry for the late reply, and I hope you have figured it out already because I won’t have time to dig into this right now.

      I will probably make an updated article next year.

  13. hello, sir, I am facing a problem instal Quartus, as you said to run this query ./ModelSimSetup-20.1.1.720-Linux. Run after this terminal shows permission denied

Leave a Reply

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