Trying to get a version of ModelSim running on a very modern version of Linux often presents challenges. Luckily I had lots of helpful information on the internet (major sources linked below) to get it going. This article mostly adapts the work done by the Arch Linux crew.
Problem number one: The free version of ModelSim Altera Edition is 32 bit only while the normal Linux PC will be 64 bit.
On Linux this requires us to install the 32 bit versions of the libraries that it depends on. Luckily this is fully supported on a modern Linux like Ubuntu 14.
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential
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
Problem number two: If you have the following error when running vsim:
** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
Then you probably need to build a new version of freetype, a font setting library and modify ModelSim to use it. For an unknown reason ModelSim has an issue with modern versions shipping in Arch and Ubuntu 14.04. First download the source code of freetype 2.4.12:
http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2
Now install the build dependencies needed for libfreetype6, extract the source (using tar) and configure and build libfreetype:
sudo apt-get build-dep -a i386 libfreetype6
tar -xjvf freetype-2.4.12.tar.bz2
cd freetype-2.4.12
./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make -j8
The finished libraries are now available inside the "objs/.libs" directory. As they are necessary to run ModelSim we need to copy them into the install directory so they don't get lost and then modify ModelSim's vsim script to use the new libraries instead of the system wide versions.
Change directory to the directory where you installed ModelSim, /opt/altera/13.1/modelsim_ase/, on my system. Note you may need to edit the directory paths to match those used on your system.sudo mkdir lib32
sudo cp ~/Downloads/freetype-2.4.12/objs/.libs/libfreetype.so* ./lib32
Now we need to edit the vsim launch script to ensure the new freetype libraries are used:
sudo vim bin/vsim
Search for the following line:
dir=`dirname $arg0`
and underneath add the following new line:
export LD_LIBRARY_PATH=${dir}/lib32
Test by running vsim and hopefully you will be greeted by the ModelSim GUI.
[Tested on fresh install of Ubuntu 14.04]
Sources:
Thanks for your guide. it work on linux mint
ReplyDeleteHoang Nguyen
Thanks, worked for me, too. In order to make Ubuntu to find the actual lib, I needed to create a symbolic link to libfreetype.so.6:
ReplyDeleteln -sf libfreetype.so.6.11.1 libfreetype.so.6
Thanks a lot sir.I am new to ubuntu.I was facing no problem during normal use but when i tried to install model sim,I was unable to do so.These lines of code solved my problem.I am an Electronics Engineer.So i always need a Verilog/vhdl/Sys verilog Compiler. I also have my own website on HDLs[ If you have some free time ,please have a look and give some feedback.
ReplyDeleteWEBSITE- www.veriloghdl.in
EMAIL- veriloghdl.in@gmail.com
Your feedback will be highly valuable,please email or comment there ]
#FINAL_YEAR_ENGINEERING_STUDENT
#INDIA
So I followed all of the steps and double checked that all the changes and files were downloaded/editted. But still getting the same fault. How can I find out what caused the fault? or should I try using a 32 install of ubuntu in a virtual machine
ReplyDeleteNeed a little more data here - can you post what command you are running to start ModelSim?
Deletewhen I configure freetype 2.4.12, it response me check whether c compiler work--no. my gcc is 4.8.2, ubuntu14.04
ReplyDeleteHum - that is rather odd. Perhaps another build tool is missing? have you tried a "apt-get install build-essential" first? build-essential is a metapackage with a lot of the UNIX basic build tools under it.
DeleteWow! Thanks! That saved me hours, if not days, of frustration!
ReplyDeleteI still having the same error
ReplyDelete** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
i use ubuntu14.04
Could you re run the steps and post the display on your terminal for me to see? Thanks!
DeleteThanks Sir! carefully follows all the steps, it work on my ubuntu 14.04
ReplyDeletePlease tell me how to compile freetype 2.4.12 on FEDORA 20. I am new to Linux.
ReplyDeleteThank you.
Have you read the following: https://communities.mentor.com/thread/13821?forceNoRedirect=true ?
DeleteIt is possible to put precompiled freetype library somewhere? It will save a lot of time for those who have problems with compilation.
ReplyDeleteI have thought about it however I don't have a file sharing system setup right now and I worry that these things age too quickly. If you build from scratch it will be the right one for your system pretty much all the time.
ReplyDeleteNormally adding all the build tools and installing the dependencies are automatic if you follow the instructions.
I shall have to look into serving a file from blogger or trying to get a third party to host it without it dissapearing etc.
Matthew
I did all the step mentioned above, all them worked without getting an error, restarted my laptop still ./vsim gives me the error
ReplyDelete** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
Please help.
Im using ubuntu 14.04
First question is are you using Altera Modelsim Starter edition or the full version?
ReplyDeleteCan you cd to the modelsim directory and ls the contents of the new lib32 directory and paste it here?
Thanks
libfreetype.so libfreetype.so.6 libfreetype.so.6.10.1
DeleteHum, those look correct. Can you cd into the "linux" directory inside the modelsim directory and type "pwd; LD_LIBRARY_PATH=directory of modelsim/lib32 ldd ./vsim" and paste the command you ran and all the output?
DeleteIt could be you are missing one of the other prerequisite libraries.
Matthew
hello,
Deletethis is what I get:
/data/sabb/altera/13.1/modelsim_ase/linux
linux-gate.so.1 => (0xf7754000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7723000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf76dd000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf752d000)
/lib/ld-linux.so.2 (0xf7755000)
Same problem as above: Ubuntu 14.04, repeated the steps and segmentation fault persists. The lib32 is correct and the pwd command result was:
ReplyDelete/home/vidigal/altera/13.1/modelsim_ase/linuxaloem
linux-gate.so.1 => (0xf77d4000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf77ac000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7766000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75b5000)
/lib/ld-linux.so.2 (0xf77d5000)
Can you paste the output of the following command just in case:
ReplyDeletesudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential
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
I am beginning to suspect that another library has been updated by ubuntu due to a bugfix or similar and that I need to do some more digging and updating the library.
"sudo apt-get update" gave
DeleteW: Erro GPG: https://download.01.org trusty InRelease: As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY A902DDA375E52366
It's in portuguese, but it says that the following signatures couldn't be verified because the public key wasn't available.
The apt-get install alerted that 25 packages are not updated, but all the listed libraries were already up-to-date.
Oh dear - I think that your linux system is not updating properly which means you will be missing some pieces of the puzzle. That would lead to what you are seeing. It looks, and I am no expert, that your download server settings are broken. Please could you post the errors from apt-get on an ubuntu forum asking for help? When apt-get is working properly you can then try the advice again. Please post more when you have apt-get working cleanly.
DeleteThe following packages were automatically installed and are no longer required:
Deletelibjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblzma-dev
libtiff5-dev libtiffxx5 libxrender-dev x11proto-render-dev
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 142 not upgraded.
Thanks for your guide!
ReplyDeleteWorked on Linux Mint 17 (cinnamon) as well!
Hi Matthew ,
ReplyDeleteI am still facing the same problem i am using ubuntu 14.04.
** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
please help me
I am sorry but if you read the other comments I do need some more information before I can help you.
DeleteDid you follow the instructions and have them work without errors? What version of Ubuntu are you using - 14.04?
I
I get no error whatsoever in any of the steps, what could be wrong?
DeleteI got tired of messing with this and that library, etc, etc... I used this incredibly heavy handed and ridiculous method. First, I did all the above to get a libfreetype (though, I think installing from the lib32 like Matthew Swabey would have been plenty). then I noticed ldd vsim pointed to some libs that exist in both /lib/x86_64-linux-gnu and in /lib/i386-linux-gnu ... also, gdb vsim (run) shows the sagfault in an x86_64 pthread library (comes with libc) ... so I did this:
ReplyDeletemv /opt/altera/14/modelsim/lib32 ~/ ; cd /opt/altera/14/modelsim/linux/ ; ln -svf ~/lib32/freetype* . ln -svf /lib/i386-linux-gnu/*.so . ; export LD_LIBRARY_PATH=/opt/altera/14/modelsim/linux (cuz there's other stuff in there too) ; cd /opt/altera/14/modelsim/linuxaloem/ ; ./vsim
It's working now, but this is not exactly a recommended method to ld.so.conf ...
I thought I could work around this problem by installing a 32-bit version of Linux.
ReplyDeleteThe installer is a 64-bit application. ಠ_ಠ
Hi, I get a whole other type of error. It something with a license requirement.
ReplyDelete~/altera/14.1/modelsim_ase/bin$ ./vsim
Unable to find the license file. It appears that your license file environment variable (e.g., LM_LICENSE_FILE) is not set correctly.
Unable to checkout a license. Vsim is closing.
** Fatal: Invalid license environment. Application closing.
Anyone has an idea what to do from here? I have spent an awful lot of time googling this problem with no success.
For this, you need to get a license from the Altera website (free). You can find that here: https://www.altera.com/download/licensing/free_software/lic-q2web.jsp
DeleteFrom there, try setting the LM_LICENSE_FILE parameter an bash, and see if that helps.
I had the exact same problem. The ModelSim installed that was giving me this issue was from the Quartus II .tar bundle ~18GB.
DeleteUninstalled it, went back to Altera website and downloaded the individual installer for ModelSim 10.3c~1.2GB and reinstalled again, and it works. Maybe the bundled installer is having some license file issues? OS is Ubuntu 14.04. And it works right way. No 32-bit library and font fixes were required (Btw many thanks to the original author-Matthew for this fix, it helped to get the previous version running without issues).
Hi,
ReplyDeleteWith this guide I was able to get vsim running from the bin directory, but the one in the linuxaloem directory (which Quartus uses) still segfaults. It maybe because I get a dpkg error trying to installl some of the 32-bit libs:
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.4_amd64.deb (--unpack):
trying to overwrite '/usr/include/bits', which is also in package libc6-dev-amd64 2.19-0ubuntu6.4
Hi,
ReplyDeleteWith this guide I was able to get vsim running from the bin directory, but the one in the linuxaloem directory (which Quartus uses) still segfaults. It maybe because I get a dpkg error trying to installl some of the 32-bit libs:
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.4_amd64.deb (--unpack):
trying to overwrite '/usr/include/bits', which is also in package libc6-dev-amd64 2.19-0ubuntu6.4
Hi Mr. Swabey,
ReplyDeletethank you for the post. I have had a problem with launch of vsim (to simulate a Leon3 processor). The error is the following:
** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
I have performed all the steps but I have the same problem.
My working environment is: 32-bit Ubuntu 13.04 running as Virtual Machine (host is a Windows 8), with ModelSim Starter Edition 13.1.
Can you help me?
If needed, I can re-run the steps and put messages in a comment.
PS: sorry for a repeated question, but peoples in the previous posts that have had my same problem doesn't complete the discussion..
Hi Mr. Swabey,
ReplyDeletethank you for the post. I have had a problem with launch of vsim (to simulate a Leon3 processor). The error is the following:
** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)
I have performed all the steps but I have the same problem.
My working environment is: 32-bit Ubuntu 13.04 running as Virtual Machine (host is a Windows 8), with ModelSim Starter Edition 13.1.
Can you help me?
If needed, I can re-run the steps and put messages in a comment.
PS: sorry for a repeated question, but peoples in the previous posts that have had my same problem doesn't complete the discussion..
It's a good guide.
ReplyDeleteI had the same problem, now I've fixed it in ubuntu 14.04 using ModelSim Altera Starter edition 10.1d
Thanks Matthew !
I'd like to thank you Mr. Swabey for the time and effort you have invested in this project and especially publishing this post. By following the instructions I ended up to the same out come as Alex Fuhr. The program must be started with ./vsim inside the folder /modelsim_ase/bin in order to avoid segfaulting. Sofar I have not encountered problem with compiling or simulating. I managed to compile simple vhd testbench without any errors and also the simulation worked fine.
ReplyDeleteSo thank you very much and also thank you Alex Fuhr for trying the /bin executable!
I wish you all the best.
OS: 64bit Ubuntu 14.04
yeahhh..!! it worked ..!! thanks a alot guys for ur help..!!
DeleteThank you for the time and effort to solve the problem and especially publishing these instructions. By following them I ended up to the same conclusion as Alex Fuhr. The program must be run from /modelsim_ase/bin folder in order to dodge segfaulting. Program seems to be working sofar, I managed to compile simple .vhd file and also simulating it worked without any problems whatsoever and the waveforms of the signals worked also.
ReplyDeleteSo thank you mr. Swabey and mr. Fuhr for your posts and I wish you all the best!
OS: 64-bit Ubuntu 14.04
It worked, but it took me a while to figure it out why it was not working after following all the steps in this tutorial. The problem, I believe, is the backup file of vsim that is created when opening the script to edit it with gedit (vsim~). Just by erasing this backup file should do it. I hope you find this helpful. :)
ReplyDeleteMatt, you are the man! You saved me so much headache with getting modelsim to work.
ReplyDeleteJust got this working with a minor change on Ubuntu 16.04, with ModelSim ASE 10.1d as included with Quartus II 13.0sp1.
ReplyDeleteWhen I tried to run bin/vsim, I received the message "Error: cannot find bin/../linux_rh60/vsim". Noticing that "linux_rh60" happened to be the output of the 'vco' script, I figured it was mis-detecting my platform or something weird, so I just symlinked "linux_rh60" in the modelsim_ase root to linuxaloem and it worked.
So if you followed all of the instructions but when you run bin/vsim you're getting "Error: cannot find bin/../linux_rh60/vsim", try the following within the modelsim_ase root:
ln -s linuxaloem linux_rh60
bin/vsim
For me, the ModelSim fonts are *ugly* and trying to change the fonts from Tools -> Edit Preferences gives a big list of fonts that almost literally all look the same (they shouldn't), so I think there's something wrong about font selection with the freetype hack, but hey, I'm just glad I got ModelSim to work in Linux.
Thank you!
Dr. Swabey thanks for your work. I found that another issue can arise from the kernel version being 4.x.
ReplyDeleteAs it happened with the 3.x update and can be seen here https://sites.google.com/site/longphanwiki/basic-skills/modelsim-doesn-t-work-with-linux-kernel-3-x
I simply modified my /bin/vsim file to include 4.x and it worked. For some reason I still can't launch ModelSim from linuxaloem, but at least it works.
Hope this helps.
Best regards,
Andrea
Thank You! This Works on the Ubuntu 16.04 :D
ReplyDeleteThanks working for me in
ReplyDeleteLinux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
Thanks so much for this resource. With your help, I just got Modelsim INTEL-FPGA edition (17.1) going on Debian 9.3 (Stretch) running Kernel 4.9.0-6-amd64. Please do not delete this page! I'm sure I'll be back here in the future!
ReplyDeleteThank you, it works on Debian 9 64 bits
ReplyDeleteExcellent, thanks for this info it is still useful for Quartus 18.1 and Debian 9. It's a shame they can't just build for 64 bit and modern systems.
ReplyDelete6 years later and this still worked for me on 18.04. Thank you very much sir.
ReplyDelete