Installing magic

Install at least Magic VLSI version 8.3.367.

To install the latest version compile and build magic from the source distribution

1. download the latest source distribution using git

git clone https://github.com/RTimothyEdwards/magic.git git_magic

2. magic requires a number of supporting software packages

  • build-essential

  • flex

  • bison

  • m4

  • tcsh

  • csh

  • libx11-dev

  • tcl-dev

  • tk-dev

  • libcairo2-dev

  • libncurses-dev

  • blt

  • freeglut3

  • mesa-common-dev

  • libgl1-mesa-dev

  • libglu1-mesa-dev

To check what packages are installed use apt list package-name

To install the missing packages use sudo apt install package-name

The process of installing packages is quite empirical, and depends on the order in which you installed packages on you machine. This is because,
typically, whenever you install a software package, there is also a number of other dependent or recommended packages that will get installed with it.
For example installing the package flex does also install the package gcc that includes the compiler c99 (but this falls “under the radar”).

To check the dependencies of a package you can use apt show package-name or apt rdepends package-name

To check if a program belongs to a certain package you can use dpkg --search file-name or
if the file is not installed you can use apt-file search file-name

Example:

dpkg --search c99

To check all the files in a package you can use apt-file list package-name

3. configure and install magic

cd ~/git_magic
./configure --prefix=/home/<unixusername>/opt/magic
make
make install

The location of magic's binaries is ~/opt/magic/bin

4. create a .bash_profile file and add the location of the magic binaries to the PATH

cd
.bash_profile
#!/usr/bin/bash

PATH=${PATH}

# Careful:
# when there is a .bash_profile the WSL terminal does not source .bashrc by default
source ~/.bashrc

# prevent "Warning: Missing charset in String to FontSet conversion"
export LC_ALL=C

# magic: binaries location
MAGIC_BIN=$HOME/opt/magic/bin
export CAD_ROOT=$HOME/opt/magic/lib

# PATH
PATH="$MAGIC_BIN:$PATH"

# eliminate duplicates from the PATH
PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')"

# and finally export the PATH
export PATH="$PATH"