2020年4月21日星期二

install ModelSim on Arch linux

My Arch linux is 64-bit, ModelSim only have 32-bit version.

First of all, do what the following blog says.
https://gist.github.com/dries007/36c31fb8b2d712dfb41c6709f16e6e66

ModelSim 17.1 (Starters Edition) for (Arch) Linux

You need to download the setup file yourself. Put in where you run the setup script. Easy DL link It should be named ModelSimSetup-17.1.0.590-linux.run.
  1. Install dependencies (some AUR, both 32 and 64 bit is required.)
    • 64 bit: expat fontconfig freetype2 xorg-fonts-type1 glibc gtk2 libcanberra libpng libpng12 libice libsm util-linux ncurses tcl tcllib zlib libx11 libxau libxdmcp libxext libxft libxrender libxt libxtst
    • 32 bit lib32-expat lib32-fontconfig lib32-freetype2 lib32-glibc lib32-gtk2 lib32-libcanberra lib32-libpng lib32-libpng12 lib32-libice lib32-libsm lib32-util-linux lib32-ncurses lib32-zlib lib32-libx11 lib32-libxau lib32-libxdmcp lib32-libxext lib32-libxft lib32-libxrender lib32-libxt lib32-libxtst
    • ncurses compat libs: ncurses5-compat-libs and lib32-ncurses5-compat-libs
  2. Run setup file, from console, install in default location (~/intelFPGA/17.1) The setup hangs after completing.
  3. Get lib32-freetype2-2.5.0.1 and unpack libs to ~/intelFPGA/17.1/modelsim_ase/lib32
  4. Modify the startup script (~/intelFPGA/17.1/modelsim_ase/vco)
    • Replace linux_rh60 with linux
    • Add LD_LIBRARY_PATH=${dir}/lib32 after $dir is set
A semi automatic script is provided below for the lazy :)


-----the script------
#/bin/bash

echo Installing dependencies...
pacaur -S --needed expat fontconfig freetype2 xorg-fonts-type1 glibc gtk2 libcanberra libpng libpng12 libice libsm util-linux ncurses tcl tcllib zlib libx11 libxau libxdmcp libxext libxft libxrender libxt libxtst lib32-expat lib32-fontconfig lib32-freetype2 lib32-glibc lib32-gtk2 lib32-libcanberra lib32-libpng lib32-libpng12 lib32-libice lib32-libsm lib32-util-linux lib32-ncurses lib32-zlib lib32-libx11 lib32-libxau lib32-libxdmcp lib32-libxext lib32-libxft lib32-libxrender lib32-libxt lib32-libxtst ncurses5-compat-libs lib32-ncurses5-compat-libs

echo Running setup file...
./ModelSimSetup-17.1.0.590-linux.run --modelsim_edition modelsim_ase --accept_eula 1 --mode unattended --unattendedmodeui minimal &
PID=$!
echo Press enter when the setup dialog says \"Setup complete.\"
read -n 1
kill $PID

wget -q --show-progress https://dl.dries007.net/lib32-freetype2-2.5.0.1.tar.xz -O lib32-freetype2-2.5.0.1.tar.xz
tar xf lib32-freetype2-2.5.0.1.tar.xz -C ~/intelFPGA/17.1/modelsim_ase/

cd ~/intelFPGA/17.1/modelsim_ase/
sed -i 's/linux_rh60/linux/' vco
sed -i 's/dir=`dirname "$arg0"`/dir=`dirname "$arg0"`\nexport LD_LIBRARY_PATH=${dir}\/lib32/' vco # adds "export LD_LIBRARY_PATH=${dir}/lib32" after $dir is found.
cat > ~/.local/share/applications/modelsim.desktop <<EOF
[Desktop Entry]
Version=1.0
Name=ModelSim
Comment=ModelSim
Exec=$HOME/intelFPGA/17.1/modelsim_ase/bin/vsim
Icon=applications-electronics
Terminal=true
Type=Application
Categories=Development
EOF

echo "Done, enjoy!"

------------------------------------------------------------------------------------------

To install 32bit lib:

sudo vim /etc/pacman.conf

uncomment multilib:

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

multilib-testing]
Include = /etc/pacman.d/mirrorlist

[multilib]
Include = /etc/pacman.d/mirrorlist


then 
$sudo pacman -Sy
$sudo pacman -Syy


You may have conflict files when installing lib32-gtk2. Skipping it is fine.


-------------------------------------------------------------------------------------

When trying to run vsim, this may show up.

[uty@u bin]$ ./vsim 
./../linux/vish: symbol lookup error: /usr/lib32/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var


it means that the version of libfontconfig is too new, it doesn't have FT_Done_MM_Var anymore.
What I installed is :

[uty@u bin]$ pacman -Q lib32-fontconfig
lib32-fontconfig 2:2.13.91+24+g75eadca-2

I didn't find the released binary. 

So do this.

https://j-marjanovic.io/new-ubuntu-old-problems-with-modelsim.html

$ git clone https://gitlab.freedesktop.org/fontconfig/fontconfig.git
$ git checkout -b 2.12.92 2.12.92
$ sudo pacman -S lib32-libxml2

$ aclocal -I m4
$ autoconf
$ libtoolize
$ ./autogen.sh
$ CFLAGS=-m32 LDFLAGS=-L/home/jan/local/packages/freetype-2.4.7-32bit/lib ./configure --prefix=/home/jan/local/packages/fontconfig-2.12.92-32bit --enable-libxml2
$ make
$ make install

Basically, compile it from source code, taking branch 2.12.92.

copy the generated binary to /usr/lib32
[uty@u fontconfig]$ sudo cp src/.libs/libfontconfig.so.1.11.0 /usr/lib32/

[uty@u fontconfig]$ ls /usr/lib32/libfont* -l
lrwxrwxrwx 1 root root     34 Apr 21 15:59 /usr/lib32/libfontconfig.so -> /usr/lib32/libfontconfig.so.1.11.0
lrwxrwxrwx 1 root root     34 Apr 21 15:58 /usr/lib32/libfontconfig.so.1 -> /usr/lib32/libfontconfig.so.1.11.0
-rwxr-xr-x 1 root root 342952 Apr 21 15:55 /usr/lib32/libfontconfig.so.1.11.0
-rwxr-xr-x 1 root root 342952 Apr 21 15:53 /usr/lib32/libfontconfig.so.1.12.0

then create the symbolic link
[uty@u fontconfig]$ sudo ln -sfn /usr/lib32/libfontconfig.so.1.11.0 /usr/lib32/libfontconfig.so


Finally, I can run it.

没有评论:

发表评论