Icarus Verilog source can be compiled with the MinGW-w64 C/C++ compilers to get a standalone Windows binary. This is the preferred Windows distribution form. The configure scripts automatically detect that the compilers in use are the MinGW-w64 compilers and will configure the Makefiles appropriately.
The base MinGW-w64 compiler package doesn't contain tools beyond the compiler, but the MSYS2 project provides a convenient package that has all the tools needed to get everything working.
NOTE: If you have Cygwin installed, it is best to not use a Cygwin window to do the build, as the Cygwin tools will intermix with the MSYS2 tools such that it is hard to be sure you are using the right compiler. Thus, it is recommended that these steps not be done in a Cygwin window. Use a MSYS2 window instead, and be careful that your MSYS2 tools are not masked by paths that point to Cygwin binaries.
Installing MSYS2 Edit
The following instructions assume you have none of the necessary build tools installed. If you have already installed MSYS2 with some/all of the necessary packages on your machine, you can of course skip the appropriate steps.
Incidentally, apart from the base MinGW-w64 compiler, none of the packages installed in the following steps are needed after installation of Icarus Verilog is complete. They are only needed to build Icarus Verilog. The MinGW-w64 compiler is only needed if you wish to compile VPI modules for use with Icarus Verilog.
Step 1 - Install the MSYS2 Base System Edit
Follow the instructions on the MSYS2 installer page.
The default installation path is C:\msys32 for a 32-bit installation or C:\msys64 for a 64-bit installation, but you can change this to anything you like (but make sure there are no spaces in the path names). This path is referred to as <msys2> in subsequent instructions.
MSYS2 provides three different command prompt windows (a.k.a "shells") for you to use:
- mingw32_shell - for building standalone 32-bit applications
- mingw64_shell - for building standalone 64-bit applications (only available in a 64-bit system)
- msys2_shell - for building applications that only run in a MSYS2 shell
These are fundamentally the same - they just configure the tools appropriately for the specified task. You should use mingw32_shell if you want to build a 32-bit version of Icarus Verilog and mingw64_shell if you want to build a 64-bit version. The chosen shell will be referred to simply as the MinGW shell in the following instructions.
NOTE: If you are running a 64-bit version of Windows, you can choose to build and use either a 32-bit or 64-bit version of Icarus Verilog. Note however that 64-bit builds are not supported prior to the v10 release of Icarus Verilog.
Unless you are using Windows 8, the installation will leave short-cuts to the shells in the MSYS2 sub-menu of your Start menu. If you are using Windows 8, you will find the .BAT files that start the shells in the <msys2> directory. You can of course place short-cuts to these .BAT files on your desktop.
Step 2 - Install Additional MSYS2 Packages Edit
If you wish to build a 32-bit version of Icarus Verilog, start a 32-bit MinGW shell and execute the following command:
pacman -S mingw-w64-i686-toolchain mingw-w64-i686-ghostscript
If you wish to build a 64-bit version of Icarus Verilog, start a 64-bit MinGW shell and execute the following command:
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-ghostscript
In either case, then execute the following commands:
pacman -S base-devel git git config --global core.autocrlf true
Building and Installing Icarus Verilog Edit
Now we have the necessary build tools installed, we can build and install Icarus Verilog.
Step 1 - Get the Icarus Verilog Source Edit
The path to the directory containing the source code is referred to as <ivl-source> in subsequent instructions.
Step 2 - Configure and Build Icarus Verilog Edit
Now we are all set to configure and compile Icarus Verilog. Choose a destination path where you will want to install the binaries. This choice is not permanent, so don't have too much angst over it. Just choose a name without white space. The destination path is referred to as <ivl-install> in subsequent instructions.
NOTE: Make sure there are no spaces in the <ivl-install> path names. Use forward slashes in place of back slashes when using <ivl-install> in a MinGW shell.
In the MinGW shell window, execute the following commands:
cd <ivl-source> ./configure --prefix=<ivl-install> make
NOTE: If you execute configure without the --prefix option, the default installation path is <msys2>\usr\local, which in a MinGW shell is aliased to /usr/local.
NOTE: If you get an error message saying that ./configure doesn't exist, revisit the last part of the Obtaining Source from git instructions.
Step 3 - Install Icarus Verilog Edit
If the compile ran OK, then next you install Icarus Verilog in the directory you have chosen. In the MinGW shell window, execute the following commands:
cd <ivl-source> make install
This is part of what the configure program did for you. The Makefiles know to put the files in the <ivl-install> directory.
You now need to add <ivl-install>\bin and <msys2>\<mingw>\bin to your Windows "PATH" environment variable (where <mingw> is mingw32 if you've built a 32-bit version of Icarus Verilog or mingw64 if you've built a 32-bit version of Icarus Verilog). Alternatively, you can copy the DLLs needed by Icarus Verilog from <msys2>\<mingw>\bin to <ivl-install>\bin, and just add <ivl-install>\bin to your Windows "PATH" environment variable.
iverilog.exe uses the path to itself to locate the libraries and modules associated with itself. In other words, if you execute the <ivl-install>\bin\iverilog.exe program, it will locate its sub-parts in the <ivl-install> directory and subdirectories below that. This means you can move the Icarus Verilog installation by simply moving the root directory and all its contents.
NOTE: When moving the installation to a different location, the new installation path may contain spaces in the path names.