3 MINGW PORT OF ICARUS VERILOG
5 Copyright 2006 Stephen Williams <steve@icarus.com>
8 Icarus Verilog source can be compiled with the mingw C/C++ compilers
9 to get a Windows binary that does not require the POSIX compatibility
10 cruft of the Cygwin.dll library. The resulting program can be run with
11 or without Cygwin, so this is the preferred Windows distribution form.
12 The configure scripts automatically detect that the compilers in use
13 are the mingw compilers and will configure the Makefiles appropriately.
15 The mingw patch doesn't contain tools beyond the compiler, but there
16 is the "msys" package that the makers of Mingw publish that has enough
17 extra tools to get most everything else working. There are a few extra
18 packages needed beyond mingw and msys, and the following instructions
19 explain how to get them and install them.
21 * Some Preliminary Comments -- PLEASE READ ME --
23 The Windows port of Icarus Verilog is the most difficult of all the
24 ports. The Windows system off the shelf is completely stripped, devoid
25 of any support for software development. Everything needed to compile
26 Icarus Verilog must be collected from various sources and stitched
27 together by hand. Normal human beings with a basic understanding of
28 software development can do this, but some patience (and access to the
29 Internet) is required. You may choose to print these instructions. FOR
30 BEST RESULTS, FOLLOW THESE INSTRUCTIONS CAREFULLY.
32 NOTE that if you have Cygwin installed, it is best to not use a cygwin
33 window to do the build, as the Cygwin tools will intermix with the
34 mingw tools such that it is hard to be sure you are using the right
35 compiler. Thus, it is recommended that these steps be *not* done in a
36 Cygwin window. Use an MSYS window instead, and be careful that your
37 msys/mingw tools are not masked by paths that point to Cygwin binaries.
39 I have no plans to intentionally support MSVC++ compilation. Don't ask.
41 * Summary of Prerequisites
43 This is a brief list of prerequisite packages, along with the URL
44 where each can be found. In most cases, the specific version is not
45 critical, but these are the versions I use.
47 msys-1.0 <http://www.mingw/org>
48 msysDTK-1.0 <http://www.mingw.org>
49 Mingw32-5.x <http://www.mingw.org>
50 readline-4.2-20010727.zip <http://mingwrep.sourceforge.net>
51 bzip2-1.0.3 <http://gnuwin32.sourceforge.net>
52 zlib-1.2.3 <http://gnuwin32.sourceforge.net>
53 gperf-3.0.1 <http://gnuwin32.sourceforge.net>
54 bison-2.1 <http://gnuwin32.sourceforge.net>
55 flex-2.5.4a <http://gnuwin32.sourceforge.net>
57 The above table lists the packages required. It is convenient to
58 install them in the above order. Many of these packages are also
59 collected into the directory:
61 <ftp://icarus.com/pub/eda/verilog/win32-build-parts>
63 Incidentally, besides Mingw32, none of these packages are needed after
64 installation of Icarus Verilog is complete. These are only needed to
65 build the compiler. The Mingw32 package can be used to compile VPI
66 modules if you choose.
68 * Install MSYS and msysDTK
70 The msys package is available from the mingw download site. This is
71 not the compiler but a collection of *nix tools ported to Windows and
72 wrapped in a convenient installer. The msys package is all the various
73 basic tools (shells, file utils, etc) and the msysDTK is extra
74 developer tools other than the compiler.
76 Download the msys-1.x.x.exe and msysdtc-1.x.x.exe binaries. These are
77 self-installing packages. Install msys first, and then msysDTC. Most
78 likely, you want to install them in c:/msys. (The msysDTK is installed
79 in the same location, as it is an add-on.)
81 This install should be easy and reliable.
83 The installation will leave an "msys" icon on your desktop and in the
84 mingw sub-menu of your Start menu. This icon brings up a shell window
85 (a command line) that has paths all set up for executing msys and
86 mingw commands. This is what you will want to use while executing
91 The obvious step 2, then, is install the mingw compilers. These can be
92 found at the web page <http://www.mingw.org>. The Mingw-5.x.x package
93 is a convenient remote installer. Download this program and run
94 it. The installer will ask wich components you want to install. You
95 need only the base C compiler and the C++ compiler. (You may install
96 other languages if you wish.)
98 When I install Mingw32 (using the installer) I typically set a
99 destination directory of d:\mingw or the like. You will be using
103 If you intend to compile VPI modules for Icarus Verilog, you
104 need Mingw32, even if you are using a precompiled binary. VPI
105 modules only require Mingw32, and none of the other libraries.
107 Finally, as part of installing the mingw32 compilers, remember to add
108 the mingw/bin directory to your path. You will need that to be able to
109 find the compilers later.
111 * Install Mingw32 Packages
113 There is a collection of precompiled libraries and add-on packages
114 that are intended for use with the Mingw32 compiler. These do not come
115 with simplified Windows installers, but they are pretty easy to
116 install by hand. Icarus Verilog uses the readline-4.2 package from
119 Since I installed Mingw32 in c:\mingw, I also created a
120 Mingw-packages directory called c:\mingw-packages. The install, then,
124 $ cd c:/mingw-packages
125 $ unzip readline-4.2-20010727.zip
126 [lots of inflating...]
128 There is no need to adjust your execution path for this package as we
129 are only using a library out of here. However, do remember the
130 directory name, as you will need it later.
132 Done. On to the next packages.
134 * Install GnuWin32 Packages
136 The GnuWin32 project is a collections of open source programs and
137 libraries ported to Windows. These also work well with the Mingw
138 compiler, and in fact Icarus Verilog uses a few pieces from this
141 You will need these gnuwin32 packages to compile Icarus Verilog:
143 <http://gnuwin32.sourceforge.net>
150 I suggest creating a common directory for holding all your gnuwin32
151 packages. I use C:\gnuwin32. The download page at the gnuwin32 site
152 has a "setup" link for each of these packages. Click the setup to
153 download the installer for each of the desired programes, then execute
154 the downloaded .exe files to invoke the installer. Install into the
155 c:\gunwin32 directory.
158 You need the binaries and the developer files, but you do not
159 need the source to these packages. The installer gives you the
162 After you are done installing the gnuwin32 tools, you should add the
163 c:\gnuwin32\bin directory (assuming you installed in c:\gnuwin32) to
164 your Windows path. The msys shell will pick up your Windows path.
166 * Unpack Icarus Verilog source
168 Unpack the compressed tar file (.tar.gz) of the source with a command
171 $ gunzip -d verilog-xxxxxxxx.tar.gz | tar xvf -
173 This will create a directory "verilog-xxxxxxxx" that contains all the
174 source for Icarus Verilog. Descend into that directory, as that is
175 where we will work from now on.
177 $ cd verilog-xxxxxxxx
180 The exact name of the file will vary according to the
181 snapshot. The 20030303 name is only an example.
183 Unpack the source into a directory that has no spaces. The
184 makefiles included in the source get confused by white space in
187 * Preconfigure Icarus Verilog (Not normally needed)
189 Under certain cases, you may need to "preconfigure" the Icarus Verilog
190 source tree. You should only need to do this if you are getting the
191 Icarus Verilog source tree from CVS, or you are using an existing
192 source tree that you've patched to cause configure.in files to change.
194 NOTE: If you are building from a fresh, bundled source tree that
195 you downloaded from an FTP site, then SKIP THIS STEP. Go on to
196 the "Configure Icarus Verilog" step below.
198 First, remove any autom4te.cache directories that may exist in your
199 source tree. These can make a mess of autoconf runs. Then, generate
200 configure scripts with this command:
204 This script will run the "autoconf" command (part of the msysDTK) to
205 generate all the necessary "configure" scripts. This will take a few
206 minutes. This should go smoothly.
208 * Configure Icarus Verilog
210 Now we are all set to configure and compile Icarus Verilog. Choose a
211 destination path where you will want to install the binaries. I chose
212 on my system the directory "D:\iverilog". This choice is not
213 permanent, so don't get too much angst over it. Just choose a name
216 Now, configure the source to make the makefiles and configuration
217 details. Run these commands:
219 $ CPPFLAGS="-Ic:/gnuwin32/include -Ic:/mingw-packages/include"
220 $ LDFLAGS="-Lc:/gnuwin32/lib -Lc:/mingw-packages/lib"
221 $ export CPPFLAGS LDFLAGS
222 $ ./configure --prefix=c:/iverilog
225 The CPPFLAGS and LDFLAGS variables tell configure where
226 the gnuwin32 packages are. The configure program will
227 write these values into the Makefiles, so you only need to
228 keep these variables long enough for the configure program
231 Your PATH variable was set in the previous step.
233 Use forward slashes as directory characters. All the various
234 tools prefer the forward slash.
236 Substitute your chosen directory for the prefix. This will cause the
237 makefiles to build and the source code to configure. The configure
238 program will detect that this is a mingw environment and set things up
241 (For a prefix, use the drive letter notation; the mingw compiled parts
242 require it, and the Cygwin tools should be able to handle it. You may
243 need to check or upgrade your Cygwin installation if this causes
247 * Compile Icarus Verilog
249 This, believe it or not, should be the easy part:
253 It could take a while. Now is a good time to go get some coffee or
257 * Install Icarus Verilog
259 If the compile ran OK, then next you install Icarus Verilog in the
260 directory you have chosen. When you are ready, install like this:
264 This is part of what the configure program did for you. The Makefiles
265 now know to put the files under the D:\iverilog directory (or whatever
266 directory you chose) and away you go.
268 You may find that you need to put some of the prerequisite DLLs into
269 the d:\iverilog\bin directory. These include:
271 c:\mingw\bin\mingw10.dll
272 c:\mingw-packages\bin\libreadline.dll
273 c:\gnuwin32\bin\bzip2.dll
274 c:\gnuwin32\bin\zlib.dll
276 If you already have these in your Windows path (i.e. your system32
277 directory) then you do not need to copy them into the iverilog
278 directory. However, prepackaged Icarus Verilog binaries include these
281 * Running Icarus Verilog
283 Finally, put the C:\iverilog\bin directory in your Windows path, and
284 you should be able to run the iverilog and vvp commands to your
287 Currently, the iverilog.exe uses the path to itself to locate the
288 libraries and modules associated with itself. In other words, if you
289 execute the C:\iverilog\bin\iverilog.exe program, it will locate its
290 subparts in the C:\iverilog directory and subdirectories below
291 that. This means you can move the Icarus Verilog installation by
292 simply moving the root directory and all its contents.
294 The vvp.pdf and iverilog.pdf files document the main commands. View
295 these with Acrobat reader, or any other viewer capable of displaying