Skip to content

Instantly share code, notes, and snippets.

@tejainece
Last active September 12, 2021 18:47
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tejainece/1c5edf08482c587cefb2 to your computer and use it in GitHub Desktop.
Save tejainece/1c5edf08482c587cefb2 to your computer and use it in GitHub Desktop.
This script installs all the 32 bit library dependencies of modelsim and also compiles freetype.
#!/bin/bash
ALTERA_PATH=~/altera/13.1/
sudo dpkg --add-architecture i386
sudo apt-get update
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
cd /tmp
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2
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
mkdir $(ALTERA_PATH)/modelsim_ase/lib32
sudo cp objs/.libs/libfreetype.so* $(ALTERA_PATH)/modelsim_ase/lib32
#this file is usually read-only, make it writeable
chmod 755 $(ALTERA_PATH)/modelsim_ase/vco
echo -e "Add the following line \n\texport LD_LIBRARY_PATH=\${dir}/lib32\nafter this line\n\tdir=\`dirname \$arg0\`\nin the file ${ALTERA_PATH}modelsim_ase/vco"
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install wine
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
mkdir -p /tmp/modelsim_crack
tar -xvzf ModelSim_linux_crack.tar.gz -C /tmp/modelsim_crack
cd /tmp/modelsim_crack/
./sfk6 rep -yes -pat -bin /5589E557565381ECD00000008B5508/31C0C357565381ECD00000008B5508/ -dir ~/modelsim/
sudo ./MentorKG.exe -i license.src -o ~/modelsim/license.dat -hn -pkg ~/modelsim/modeltech/linux_x86_64/mgls/lib/mgc.pkginfo
cd /tmp
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2
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
mkdir ~/modelsim/modeltech/lib32
sudo cp objs/.libs/libfreetype.so* ~/modelsim/modeltech/lib32
#this file is usually read-only, make it writeable
chmod 755 ~/modelsim/modeltech/vco
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/teja/modelsim/modeltech/lib32/
echo -e "Add the following line \n\texport LD_LIBRARY_PATH=\${dir}/lib32\nafter this line\n\tdir=\`dirname \$arg0\`\nin the file ~/modelsim/modeltech/lib32/vco"
export LM_LICENSE_FILE=~/modelsim/license.dat
export PATH=$PATH:/home/teja/modelsim/modeltech/linux_x86_64/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/teja/modelsim/modeltech/lib32/
@volcanosc
Copy link

Hi teja,
I tried to install modelsim 10.1c under ubuntu 14.04 following all your steps but still encountered the libfreetype problem that returned:
** Fatal: Read failure in vlm process (0,0)
Segmentation fault (core dumped)

In the 'modelsim_custom_libfreetype.sh' script it returned "Add the following line
export LD_LIBRARY_PATH=${dir}/lib32
after this line
dir=dirname $arg0
in the file /usr/local/modelsim/modeltech/lib32/vco" at last
There's no that file in the location 'xxxxx/modelsim/modeltech/lib32/'.Should I copy a 'vco' from 'xxxxxx/modelsim/modeltech/..' and then edit it?

@swinman
Copy link

swinman commented Sep 5, 2014

in configure_modelsim.sh you may want {} around ALTERA_PATH in instead of parenthesis, also there should not be a '/' after the {} if you have one in the definition of ALTERA_PATH..

unfortunately, after running this script (ubuntu 14.04.1) i still get the same read failure vlm process...

@swinman
Copy link

swinman commented Sep 5, 2014

actually... this is now working for me after making the following changes to configure_modelsim.sh and running it:

  • changing ALTERA_PATH=~/altera/13.1/ to =~/altera/*/
  • $(ALTERA_PATH)/ to ${ALTERA_PATH} in 2 locations

then updating modelsim_env.sh and running that

THANKS!!

@louiecaulfield
Copy link

You might have trouble with your NIC not being called eth0 (or ethX) as expected by modelsim, which will make it fail to accept your license file. A workaround is described at http://www.itzgeek.com/how-tos/mini-howtos/change-default-network-name-ens33-to-old-eth0-on-ubuntu-16-04.html

For details about what you're disabling, check FreeDesktop on predictable network interfaces

@jerrylogansquare
Copy link

just a big THANK YOU for these scripts, I was really struggling to get ModelSim 10.5b running on Ubuntu 18.04 until I found these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment