Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sorting ModelSim installation issues

ModelSim Installation issues

Ubuntu 14.xx and above

Ignore this if you have not encountered any issue with the installation and running of ModelSim and Quartus on your system. You are very lucky. (Just Kidding! You have surely had this issue, only sorted.)

Hence assuming you have been following the procedure given in this guide. Most certainly, Quartus will install jsut fine, and so will ModelSim. The issue is in launching due to inappropriate linking etc.

Stage 1

This is the simplest error you would encounter. Navigate to the modelsim_ase folder and run:

cd /opt/modelsim_ase/bin/
./vsim

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.
(This setup will only work for you without changes IF your Linux kernel is 3.x or below. Highly unlikely. Check using uname -r).

Okay, all of that aside, basically you need to replace this as (sudo is your friend!) :

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

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

mode=${MTI_VCO_MODE:-"32"}

This should be adequate for most of you, and running /opt/modelsim_ase/bin/vsim will open a plain boring GUI. For that lot, thanks a lot for sticking around! Hope it helped. The others, keep following.

Stage 2

Here is where things get nasty. Does running the vsim script lead to:

** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)

If yes, hang on. If not, I am sorry! Google is your friend!

I am guessing this issue came up for me because of the infinite existing packages on my system, including ROS. That seems to have ruined the setup for me, and hence more learning about the intricacies of compilation and linking. Totally worth it!

Okay, so here's what you would have to do. 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.

sudo apt-get build-dep -a i386 libfreetype6
# The above forced me to uninstall my ROS packages, and well.. I had no choice. Temporarily, let's remove them and proceed
cd ~/Downloads/
cd freetype-2.4.12
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make -j8

Most certainly, the above would give you an error looking like:

checking whether the C++ compiler works... no
...
configure: 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. After an hour of fretting, here's what you'll have to do.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential
# You already had build-essential and gcc, g++ etc. But you will also need to install the 32 bit versions.

sudo apt-get install gcc-multilib g++-multilib \
lib32z1 lib32stdc++6 lib32gcc1 \
expat:i386 fontconfig:i386 libfreetype6:i386 libexpat1:i386 libc6:i386 libgtk-3-0:i386 \
libcanberra0:i386 libpng12-0:i386 libice6:i386 libsm6:i386 libncurses5:i386 zlib1g:i386 \
libx11-6:i386 libxau6:i386 libxdmcp6:i386 libxext6:i386 libxft2:i386 libxrender1:i386 \
libxt6:i386 libxtst6:i386

This just about solves the dependency issues and compiler errors. Run the following inside freetype... folder.

./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make -j8

This should nicely compile and give you the libraries in the directory objs/.libs/. Move this to the modelsim_ase folder and define the linkings. Almost done here...

mkdir /opt/modelsim_ase/lib32

sudo cp ~/Downloads/freetype-2.4.12/objs/.libs/libfreetype.so* /opt/modelsim_ase/lib32

sudo vim /opt/modelsim_ase/bin/vsim

Find the line which says

dir=`dirname $arg0`

(Note that this occurs in multiple locations. In simple terms, look at the one in the main sequence of execution, and not in the if statement. You can ignore the one under CYGWIN. Cygwin is for Windows. Windows is for losers! :p Apologies.)

Below this add the line:

export LD_LIBRARY_PATH=${dir}/lib32

Save this file. This would only be possible if you have sudo permissions. And finally!

cd /opt/modelsim_ase/bin/
./vsim

Hopefully, a plain boring GUI will show up!

Hope this helped. Cheers!
Dhruv

@selassie-eye

This comment has been minimized.

Copy link

selassie-eye commented Sep 18, 2017

Thanks man, this saved my life (figuratively)!

@OppsMarcus

This comment has been minimized.

Copy link

OppsMarcus commented Nov 29, 2017

Thank you so much !

@aignacio

This comment has been minimized.

Copy link

aignacio commented Jan 9, 2018

# Thank you a lot man!

@AlhaythamElhassan

This comment has been minimized.

Copy link

AlhaythamElhassan commented Jan 30, 2018

Thank you so much! that really helped

@FelipeCRamos

This comment has been minimized.

Copy link

FelipeCRamos commented Apr 10, 2018

Many thanks, it helped me to run ModelSim 17.1 on mac OS high sierra using an ssh to a debian 9 system!

@Kazhuu

This comment has been minimized.

Copy link

Kazhuu commented Apr 21, 2018

Thank you!!!! This has saved my day! You have done a great job with this! I'm running quartus and modelsim under Linux Mint 18.1 Cinnamon edition and now works great.

@Lien182

This comment has been minimized.

Copy link

Lien182 commented May 31, 2018

Thank you!

@ptracton

This comment has been minimized.

Copy link

ptracton commented Jun 18, 2018

Thanks! This fixed it for me on Debian Stretch

@gangmul12

This comment has been minimized.

Copy link

gangmul12 commented Jul 10, 2018

Thanks! As CentOS 7.3 users, installing glibc-devel.i686 is helpful for escaping "configure: error: C++ compiler cannot create executables" error.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 10, 2018

Thank you very much

@PeterSorens

This comment has been minimized.

Copy link

PeterSorens commented Aug 18, 2018

Hi
Done and it worked, however I got an additional problem, the fonts are all too small, not just the text editor but all of them.
The normal Modelsim fontsize of 12 is too small for my 4K resolution. The menu edit preference don't work!
After correcting owner and edit right of .modelsim and setting environment variables to MODELSIM=/home/user and MODEL_TECH=/home/user the menu still don't work but I was able to change PrefDefault fontsizes from 12 to 18 directly in .modelsim
This works for some of the fonts but not all!
Official support just say Ubuntu is not supported use redhat.
I am not skilled enough in Linux to figure this out so It would be very nice if you or some other expert can find a solution.

@PeterSorens

This comment has been minimized.

Copy link

PeterSorens commented Aug 19, 2018

Hi again
Finally after spending a lot of hours I managed to get it fixed. Actually there where two problems, because modelsim did not read in all the standard libraries. My problems may relate to the fact that I did not install Quartus only Modelsim-altera, but I do not thinks so.
Also I do not use project files only do files to compile and simulate. Normally I start Modelsim in the folder where I want/have the work library.
PATH to modelsim was added by the installation script but other needed environment variables are NOT set as needed.
I found that beside running above instruction I had to do the following:
Setup environment variable MODELSIM to point to /home/peter and cp the modelsim.ini from the installation directory to /home/peter then do chmod +w modelsim.ini, second I set variable MODEL_TECH to point /home/peter/intelFPGA/17.1/modelsim_ase/bin; this fixed the library problem.
The small font was changed in the hidden file /home/peter/.modelsim line PrefDefault where I changed all 12 to 18 or 20. textfonfV2 is set to -18 to fix the additional editor unvisible font. font type sans-serif was changed to {DejaVu Serif} as fc-list showed that I do not have a font called sans-serif. (Never spend enough time to figure out how to add fonts to ubuntu). Now I have readable fonts.
The GUI way to change font is still not working, If I open that it shows all fonts as size 12 and if I change any and hit apply or save the fonts are all reset back to 12, I conclude GUI font-setting is defective.
Doing the work I also found two settings of fontsize 12 in the mgc_style.tcl file close to the end, but they do not seem to have any influence to GUI, properly only used in some tcl command mode.
I hope this may save others from giving up or spend as many hours as I did.I solved this by pure lock and being stubborn, I don't know much about linux in general so if this don't work for you I can't be of further assistance.

@Bosenraum

This comment has been minimized.

Copy link

Bosenraum commented Oct 18, 2018

This was very helpful! Got Modelsim running on Ubuntu 18.04. Thanks!

@te-bachi

This comment has been minimized.

Copy link

te-bachi commented Oct 28, 2018

Thanks a lot for sharing the solution. Works with Linux Mint 19 Tara and Quartus 18.1 (just the path is different: /opt/intelFPGA_lite/18.1/modelsim_ase)

@dannyerdr

This comment has been minimized.

Copy link

dannyerdr commented Oct 31, 2018

thanks a lot

@v21cesc

This comment has been minimized.

Copy link

v21cesc commented Jan 23, 2019

Great, thanks

@LuizFelipeLemon

This comment has been minimized.

Copy link

LuizFelipeLemon commented Mar 9, 2019

Thank you very much!!!!

@AlefCS

This comment has been minimized.

Copy link

AlefCS commented Mar 15, 2019

Thank you so much. I was already frustrated because I wasn't finding any solution for this problem (because I tried to solve one and then another error appear until I couldn't solve something) but this totally worked.

@edwin-oetelaar

This comment has been minimized.

Copy link

edwin-oetelaar commented Mar 17, 2019

Thank you very much.

@koko-ng

This comment has been minimized.

Copy link

koko-ng commented Apr 17, 2019

Thanks, a lot for this guide. Everything ran smoothly except that I had to remove libpng12-0 from the packages to install.

EDIT: I didn't read the guide completely ^^

@abdo1819

This comment has been minimized.

Copy link

abdo1819 commented Apr 29, 2019

it finally works thanks a lot by the way libpng12-0 wasn't found for me too but i remove it and it works great
i added this comment in fork and link to download it

@santosrafael

This comment has been minimized.

Copy link

santosrafael commented Jan 6, 2020

It worked on Linux Mint 19.1 Tessa.
Thank you very much!

@Rainerino

This comment has been minimized.

Copy link

Rainerino commented Jan 9, 2020

Thank you so much! It works on Ubuntu 19.10.

@clwe

This comment has been minimized.

Copy link

clwe commented Jan 17, 2020

Thanks! Works on Kubuntu 19.10 over here.

@tudor-sandu

This comment has been minimized.

Copy link

tudor-sandu commented Jan 29, 2020

Thanks! worked on Ubuntu 19.04.

@PronElle

This comment has been minimized.

Copy link

PronElle commented Mar 25, 2020

It worked! Neverthless, when I run Modelsim, the terminal hangs on "reading from pref.tcl" until I close Modelsim. Is there any possibility to avoid it?

@cuciureansergiu

This comment has been minimized.

Copy link

cuciureansergiu commented Apr 26, 2020

If you still get on ubuntu

configure: error: C compiler cannot create executables

try

sudo apt-get install gcc-multilib
@ksielewi

This comment has been minimized.

Copy link

ksielewi commented May 15, 2020

Thanks a lot!

@FedorChervyakov

This comment has been minimized.

Copy link

FedorChervyakov commented May 20, 2020

If you want to launch modelsim from Quartus, you have to edit quartus/adm/qenv.sh in the following way:

  • find the line export LD_LIBRARY_PATH=$QUARTUS_BINDIR:$LD_LIBRARY_PATH
  • prepend it with the path to a folder containing libfreetype 32-bit shared objects. So if you followed the instructions above, it should look like this: export LD_LIBRARY_PATH=/opt/modelsim_ase/lib32:$QUARTUS_BINDIR:$LD_LIBRARY_PATH
@jackfrye

This comment has been minimized.

Copy link

jackfrye commented May 24, 2020

@FedorChervyakov can you please detail your changes to quartus_sh? I am having this issue, but the file looks entirely different that vsim so I am not exactly sure what lines to change.

Also, thanks to whoever posted what is at the top. I almost cried when the ModelSim window came up.

@FedorChervyakov

This comment has been minimized.

Copy link

FedorChervyakov commented May 25, 2020

@jackfrye I apologise for the inconvenience, you should edit the quartus/adm/qenv.sh instead of quartus/bin/quartus_sh. Kindly check the original comment, I've updated it with proper instructions.

@jackfrye

This comment has been minimized.

Copy link

jackfrye commented May 25, 2020

@FedorChervyakov , I still cannot launch the ModelSim-Altera simulator from the tool. I seem to get this error message in the .rpt

Info: Starting NativeLink simulation with ModelSim-Altera software
Sourced NativeLink script /home/jfrye/intelFPGA_lite/19.1/quartus/common/tcl/internal/nativelink/modelsim.tcl
Warning: File test_run_msim_rtl_none.do already exists - backing up current file as test_run_msim_rtl_none.do.bak5
TCL READ VARNAME
Error: NativeLink simulation flow was NOT successful

@bernimgr

This comment has been minimized.

Copy link

bernimgr commented Jun 4, 2020

Hi,

Great job, it works great for me on Xubuntu 18.04.4 LTS !!
Some libs have not be found but it works great anyway!
Awesome!

Thanks a lot and keep the good job !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.