## ModelSim Linux installation

Here you will find an step by step tutorial on how to install ModelSim and fix the most common errors.

• First of all you need to download the .run file from here or from the official website.

• Go to the download location of the .run file and type:

xxxxxxxxxx11chmod +x ModelSimSetup-16.1.0.196.run

If you have downloaded the file from the official website, you may need to replace ModelSimSetup-16.1.0.196.run with your file name.

• Install ModelSim by running the command:

xxxxxxxxxx11./ModelSimSetup-13.1.0.162.run install Modelsim

Again, you may need to replace ModelSimSetup-16.1.0.196.run with your file name.

Once the program is installed, in order to execute it, you just need to move to you installation directory, and find the bin folder. In my case it was ~/intelFPGA/16.1/modelsim_ase/bin. Once you are in the bin folder, by executing the command ./vsim ModelSim should start running. In case you find any errors, scroll to the next section.

## Common problems

As ModelSim seems to be 32 bits, you may need to install 386-32 bit libraries using:

xxxxxxxxxx41sudo dpkg --add-architecture i386 2sudo apt-get update 3sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 4sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

### Main problem

Unless you have not updated your Linux kernel in the last 3 years, you are most certain to encounter an error saying could not find ./../linux_rh60/vsim. To understand this (optional) you can open the file vsim and notice that in the if...elseif conditions, the default description points towards a folder for the Red Hat distro. In order to fix it, basically, you need to replace this as (opening the file as superuser):

xxxxxxxxxx11*)                vco="linux" ;; # This is most likely to be line 212 (initially vco="linux_rh60")

Also, change the very first non-commented line to:

xxxxxxxxxx11mode=${MTI_VCO_MODE:-"32"} This little change should fix most of the errors. ### Second main problem In case running vsimleads to: ** Fatal: Read failure in vlm process (0,0), read here: You probably need to build a new version of freetype, a font setting library and modify ModelSim to use it. You can download the source code for freetype here. xxxxxxxxxx61sudo apt-get build-dep -a i386 libfreetype62# The above forced me to uninstall my ROS packages, and well.. I had no choice. Temporarily, let's remove them and proceed3cd ~/Downloads/4cd freetype-2.4.125./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"6make -j8 Most certainly, the above would give you an error looking like: xxxxxxxxxx31checking whether the C++ compiler works... no2...3configure: error: C++ compiler cannot create executables This is because you could be on a 64-bit system but you will also need the 32-bit versions of the libraries that it depends on: ​x1sudo apt-get install build-essential2​3sudo apt-get install gcc-multilib g++-multilib lib32stdc++6 lib32gcc1 \4expat:i386 fontconfig:i386 libfreetype6:i386 libexpat1:i386 libgtk-3-0:i386 \5libcanberra0:i386 libpng12-0:i386 libice6:i386 libsm6:i386 zlib1g:i386 \6libx11-6:i386 libxau6:i386 libxdmcp6:i386 libxext6:i386 libxft2:i386 libxrender1:i386 \7libxt6:i386 libxtst6:i386 This just about solves the dependency issues and compiler errors. Run the following inside freetype... folder. xxxxxxxxxx21./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"2make -j8 Now, this should nicely compile and give you the libraries in the directory objs/.libs/. Now, move to the modelsim_ase folder (inside the model sim installation dir) and define the linkings. xxxxxxxxxx51mkdir lib322​3sudo cp ~/Downloads/freetype-2.4.12/objs/.libs/libfreetype.so* ./lib324​5sudo vim ./bin/vsim Find, in the main sequence of execution, and not in the if statement, the line xxxxxxxxxx11dir=dirname$arg0

and add the following line bellow:

xxxxxxxxxx11export LD_LIBRARY_PATH=\${dir}/lib32

Save the file, and try to execute the vsim script again.

### Others problems

• libXft.so.2: cannot open shared object file*

xxxxxxxxxx11sudo  apt-get install libxft2 libxft2:i386 lib32ncurses5
• libXext.so.6: cannot open shared object file. libXext.so.6 not found

21   sudo apt install libxext62   sudo apt install libxext6:i386