Merge branch 'master' into verilog-ams
[sverilog.git] / mingw.txt
blobd90d32542c45ee213ecf36827905566708477f86
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         ... including the sub-packages binutils, gcc-core and gcc-g++
51         if you are given the option.
52      readline-4.2-20010727.zip  <http://mingwrep.sourceforge.net>
53      bzip2-1.0.3                <http://gnuwin32.sourceforge.net>
54      zlib-1.2.3                 <http://gnuwin32.sourceforge.net>
55      gperf-3.0.1                <http://gnuwin32.sourceforge.net>
56      bison-2.1                  <http://gnuwin32.sourceforge.net>
57      flex-2.5.4a                <http://gnuwin32.sourceforge.net>
59 The above table lists the packages required. It is convenient to
60 install them in the above order. Many of these packages are also
61 collected into the directory:
63      <ftp://icarus.com/pub/eda/verilog/win32-build-parts>
65 Incidentally, besides Mingw32, none of these packages are needed after
66 installation of Icarus Verilog is complete. These are only needed to
67 build the compiler. The Mingw32 package can be used to compile VPI
68 modules if you choose.
70 * Install MSYS and msysDTK
72 The msys package is available from the mingw download site. This is
73 not the compiler but a collection of *nix tools ported to Windows and
74 wrapped in a convenient installer. The msys package is all the various
75 basic tools (shells, file utils, etc) and the msysDTK is extra
76 developer tools other than the compiler.
78 Download the msys-1.x.x.exe and msysdtc-1.x.x.exe binaries. These are
79 self-installing packages. Install msys first, and then msysDTC. Most
80 likely, you want to install them in c:/msys. (The msysDTK is installed
81 in the same location, as it is an add-on.)
83 This install should be easy and reliable.
85 The installation will leave an "msys" icon on your desktop and in the
86 mingw sub-menu of your Start menu. This icon brings up a shell window
87 (a command line) that has paths all set up for executing msys and
88 mingw commands. This is what you will want to use while executing
89 commands below.
91 * Install Mingw32
93 The obvious step 2, then, is install the mingw compilers. These can be
94 found at the web page <http://www.mingw.org>. The Mingw-5.x.x package
95 is a convenient remote installer. Download this program and run
96 it. The installer will ask which components you want to install. You
97 need only the base C compiler and the C++ compiler. (You may install
98 other languages if you wish.)
100 When I install Mingw32 (using the installer) I typically set a
101 destination directory of d:\mingw or the like. You will be using
102 that path later.
104     NOTES:
105       If you intend to compile VPI modules for Icarus Verilog, you
106       need Mingw32, even if you are using a precompiled binary. VPI
107       modules only require Mingw32, and none of the other libraries.
109 Finally, as part of installing the mingw32 compilers, remember to add
110 the mingw/bin directory to your path. You will need that to be able to
111 find the compilers later.
113 * Install Mingw32 Packages
115 There is a collection of precompiled libraries and add-on packages
116 that are intended for use with the Mingw32 compiler. These do not come
117 with simplified Windows installers, but they are pretty easy to
118 install by hand. Icarus Verilog uses the readline-4.2 package from
119 that collection.
121 Since I installed Mingw32 in c:\mingw, I also created a
122 Mingw-packages directory called c:\mingw-packages. The install, then,
123 is as easy as this:
125   <msys shell>
126     $ cd c:/mingw-packages
127     $ unzip readline-4.2-20010727.zip
128         [lots of inflating...]
130 There is no need to adjust your execution path for this package as we
131 are only using a library out of here. However, do remember the
132 directory name, as you will need it later.
134 Done. On to the next packages.
136 * Install GnuWin32 Packages
138 The GnuWin32 project is a collections of open source programs and
139 libraries ported to Windows. These also work well with the Mingw
140 compiler, and in fact Icarus Verilog uses a few pieces from this
141 collection.
143 You will need these gnuwin32 packages to compile Icarus Verilog:
145   <http://gnuwin32.sourceforge.net>
146     bzip2-1.0.3.exe
147     zlib-1.2.3.exe
148     gperf-3.0.1.exe
149     bison-2.1.exe
150     flex-2.5.4a.exe
152 I suggest creating a common directory for holding all your gnuwin32
153 packages. I use C:\gnuwin32. The download page at the gnuwin32 site
154 has a "setup" link for each of these packages. Click the setup to
155 download the installer for each of the desired programs, then execute
156 the downloaded .exe files to invoke the installer. Install into the
157 c:\gunwin32 directory.
159    NOTES:
160       You need the binaries and the developer files, but you do not
161       need the source to these packages. The installer gives you the
162       choice.
164 After you are done installing the gnuwin32 tools, you should add the
165 c:\gnuwin32\bin directory (assuming you installed in c:\gnuwin32) to
166 your Windows path. The msys shell will pick up your Windows path.
168 * Unpack Icarus Verilog source
170 Unpack the compressed tar file (.tar.gz) of the source with a command
171 like this:
173         $ gunzip -d verilog-xxxxxxxx.tar.gz | tar xvf -
175 This will create a directory "verilog-xxxxxxxx" that contains all the
176 source for Icarus Verilog. Descend into that directory, as that is
177 where we will work from now on.
179         $ cd verilog-xxxxxxxx
181     NOTES:
182       The exact name of the file will vary according to the
183       snapshot. The 20030303 name is only an example.
185       Unpack the source into a directory that has no spaces. The
186       makefiles included in the source get confused by white space in
187       directory names.
189 * Preconfigure Icarus Verilog (Not normally needed)
191 Under certain cases, you may need to "preconfigure" the Icarus Verilog
192 source tree. You should only need to do this if you are getting the
193 Icarus Verilog source tree from CVS, or you are using an existing
194 source tree that you've patched to cause configure.in files to change.
196     NOTE: If you are building from a fresh, bundled source tree that
197       you downloaded from an FTP site, then SKIP THIS STEP. Go on to
198       the "Configure Icarus Verilog" step below.
200 First, remove any autom4te.cache directories that may exist in your
201 source tree. These can make a mess of autoconf runs. Then, generate
202 configure scripts with this command:
204         $ sh autoconf.sh
206 This script will run the "autoconf" command (part of the msysDTK) to
207 generate all the necessary "configure" scripts. This will take a few
208 minutes. This should go smoothly.
210 * Configure Icarus Verilog
212 Now we are all set to configure and compile Icarus Verilog. Choose a
213 destination path where you will want to install the binaries. I chose
214 on my system the directory "D:\iverilog". This choice is not
215 permanent, so don't get too much angst over it. Just choose a name
216 without white space.
218 Now, configure the source to make the makefiles and configuration
219 details. Run these commands:
221         $ CPPFLAGS="-Ic:/gnuwin32/include -Ic:/mingw-packages/include"
222         $ LDFLAGS="-Lc:/gnuwin32/lib -Lc:/mingw-packages/lib"
223         $ export CPPFLAGS LDFLAGS
224         $ ./configure --prefix=c:/iverilog
226     NOTES:
227       The CPPFLAGS and LDFLAGS variables tell configure where
228       the gnuwin32 packages are. The configure program will
229       write these values into the Makefiles, so you only need to
230       keep these variables long enough for the configure program
231       to work.
233       Your PATH variable was set in the previous step.
235       Use forward slashes as directory characters. All the various
236       tools prefer the forward slash.
238 Substitute your chosen directory for the prefix. This will cause the
239 makefiles to build and the source code to configure. The configure
240 program will detect that this is a mingw environment and set things up
241 to build properly.
243 (For a prefix, use the drive letter notation; the mingw compiled parts
244 require it, and the Cygwin tools should be able to handle it. You may
245 need to check or upgrade your Cygwin installation if this causes
246 problems for you.)
249 * Compile Icarus Verilog
251 This, believe it or not, should be the easy part:
253         $ make
255 It could take a while. Now is a good time to go get some coffee or
256 take a tea break.
259 * Install Icarus Verilog
261 If the compile ran OK, then next you install Icarus Verilog in the
262 directory you have chosen. When you are ready, install like this:
264         $ make install
266 This is part of what the configure program did for you. The Makefiles
267 now know to put the files under the D:\iverilog directory (or whatever
268 directory you chose) and away you go.
270 You may find that you need to put some of the prerequisite DLLs into
271 the d:\iverilog\bin directory. These include:
273       c:\mingw\bin\mingw10.dll
274       c:\mingw-packages\bin\libreadline.dll
275       c:\gnuwin32\bin\bzip2.dll
276       c:\gnuwin32\bin\zlib.dll
278 If you already have these in your Windows path (i.e. your system32
279 directory) then you do not need to copy them into the iverilog
280 directory. However, prepackaged Icarus Verilog binaries include these
281 files.
283 * Running Icarus Verilog
285 Finally, put the C:\iverilog\bin directory in your Windows path, and
286 you should be able to run the iverilog and vvp commands to your
287 heart's content.
289 Currently, the iverilog.exe uses the path to itself to locate the
290 libraries and modules associated with itself. In other words, if you
291 execute the C:\iverilog\bin\iverilog.exe program, it will locate its
292 subparts in the C:\iverilog directory and subdirectories below
293 that. This means you can move the Icarus Verilog installation by
294 simply moving the root directory and all its contents.
296 The vvp.pdf and iverilog.pdf files document the main commands. View
297 these with Acrobat reader, or any other viewer capable of displaying
298 PDF format files.