Updated Mingw build instructions from Martin.

This commit is contained in:
Stephen Williams 2010-09-27 09:07:34 -07:00
parent 85ebc1162b
commit c7d1bf5d6a
1 changed files with 194 additions and 196 deletions

390
mingw.txt
View File

@ -1,27 +1,21 @@
Please NOTE:
These directions are slightly outdated and need to be updated.
The plan is to rewrite all this using the latest MinGW at
some time in the not too distant future (CR Aug. 2009)
MINGW PORT OF ICARUS VERILOG MINGW PORT OF ICARUS VERILOG
Copyright 2006 Stephen Williams <steve@icarus.com> Copyright 2006 Stephen Williams <steve@icarus.com>
Copyright 2010 Martin Whitaker
Icarus Verilog source can be compiled with the mingw C/C++ compilers Icarus Verilog source can be compiled with the MinGW C/C++ compilers
to get a Windows binary that does not require the POSIX compatibility to get a Windows binary that does not require the POSIX compatibility
cruft of the Cygwin.dll library. The resulting program can be run with cruft of the Cygwin.dll library. The resulting program can be run with
or without Cygwin, so this is the preferred Windows distribution form. or without Cygwin, so this is the preferred Windows distribution form.
The configure scripts automatically detect that the compilers in use The configure scripts automatically detect that the compilers in use
are the mingw compilers and will configure the Makefiles appropriately. are the MinGW compilers and will configure the Makefiles appropriately.
The mingw patch doesn't contain tools beyond the compiler, but there The base MinGW package doesn't contain tools beyond the compiler, but
is the "msys" package that the makers of Mingw publish that has enough there is the MSYS package that the makers of MinGW publish that has
extra tools to get most everything else working. There are a few extra enough extra tools to get most everything else working. There are a
packages needed beyond mingw and msys, and the following instructions few extra packages needed beyond MinGW and MSYS, and the following
explain how to get them and install them. instructions explain how to get them and install them.
* Some Preliminary Comments -- PLEASE READ ME -- * Some Preliminary Comments -- PLEASE READ ME --
@ -34,248 +28,252 @@ software development can do this, but some patience (and access to the
Internet) is required. You may choose to print these instructions. FOR Internet) is required. You may choose to print these instructions. FOR
BEST RESULTS, FOLLOW THESE INSTRUCTIONS CAREFULLY. BEST RESULTS, FOLLOW THESE INSTRUCTIONS CAREFULLY.
NOTE that if you have Cygwin installed, it is best to not use a cygwin NOTE that 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 window to do the build, as the Cygwin tools will intermix with the
mingw tools such that it is hard to be sure you are using the right MinGW tools such that it is hard to be sure you are using the right
compiler. Thus, it is recommended that these steps be *not* done in a compiler. Thus, it is recommended that these steps be *not* done in a
Cygwin window. Use an MSYS window instead, and be careful that your Cygwin window. Use a MinGW window instead, and be careful that your
msys/mingw tools are not masked by paths that point to Cygwin binaries. MSYS/MinGW tools are not masked by paths that point to Cygwin binaries.
I have no plans to intentionally support MSVC++ compilation. Don't ask. We have no plans to intentionally support MSVC++ compilation. Don't ask.
* Summary of Prerequisites Incidentally, besides MinGW, none of the packages installed in the
following steps are needed after installation of Icarus Verilog is
complete. They are only needed to build the compiler. The MinGW
package can be used to compile VPI modules if you choose.
This is a brief list of prerequisite packages, along with the URL * Install MinGW and MSYS Base Packages
where each can be found. In most cases, the specific version is not
critical, but these are the versions I use.
msys-1.0 <http://www.mingw/org> From the MinGW project (http://www.mingw.org), download and run the
msysDTK-1.0 <http://www.mingw.org> MinGW graphical installer (mingw-get-inst). Select the following
Mingw32-5.x <http://www.mingw.org> components to be installed:
... including the sub-packages binutils, gcc-core and gcc-g++
if you are given the option.
readline-5.0-1 <http://gnuwin32.sourceforge.net>
bzip2-1.0.3 <http://gnuwin32.sourceforge.net>
zlib-1.2.3 <http://gnuwin32.sourceforge.net>
gperf-3.0.1 <http://gnuwin32.sourceforge.net>
bison-2.1 <http://gnuwin32.sourceforge.net>
flex-2.5.4a <http://gnuwin32.sourceforge.net>
The above table lists the packages required. It is convenient to C Compiler
install them in the above order. Many of these packages are also C++ Compiler
collected into the directory: MSYS Basic System
MinGW Developer Toolkit
<ftp://icarus.com/pub/eda/verilog/win32-build-parts> NOTE: If the download site is responding slowly, the installer tends
to time out. If this happens it will skip the package it is
currently trying to download and continue. If this happens,
you can install the skipped packages later using the mingw-get
command in a MinGW shell.
Incidentally, besides Mingw32, none of these packages are needed after The default installation path is C:\MinGW, but you can change this to
installation of Icarus Verilog is complete. These are only needed to anything you like (but make sure there are no spaces in the path names).
build the compiler. The Mingw32 package can be used to compile VPI This path is referred to as <mingw> in subsequent instructions.
modules if you choose.
* Install MSYS and msysDTK The installation will leave a "MinGW Shell" icon in the MinGW sub-menu
of your Start menu. This icon brings up a shell window (a command line)
that has paths all set up for executing MSYS and MinGW commands.
The msys package is available from the mingw download site. This is NOTE: If you intend to compile VPI modules for Icarus Verilog, you
not the compiler but a collection of *nix tools ported to Windows and need MinGW, even if you are using a precompiled binary. VPI
wrapped in a convenient installer. The msys package is all the various modules only require MinGW, and none of the other libraries.
basic tools (shells, file utils, etc) and the msysDTK is extra
developer tools other than the compiler.
Download the msys-1.x.x.exe and msysdtc-1.x.x.exe binaries. These are * Install Additional MinGW Packages
self-installing packages. Install msys first, and then msysDTC. Most
likely, you want to install them in c:/msys. (The msysDTK is installed
in the same location, as it is an add-on.)
This install should be easy and reliable. Start a MinGW shell. In the shell window, execute the following
commands:
The installation will leave an "msys" icon on your desktop and in the mingw-get install libz
mingw sub-menu of your Start menu. This icon brings up a shell window mingw-get install bzip2
(a command line) that has paths all set up for executing msys and mingw-get install pthreads-w32
mingw commands. This is what you will want to use while executing mingw-get install msys-man
commands below.
* Install Mingw32 If you also want to build Git:
The obvious step 2, then, is install the mingw compilers. These can be mingw-get install libiconv
found at the web page <http://www.mingw.org>. The Mingw-5.x.x package mingw-get install msys-perl
is a convenient remote installer. Download this program and run
it. The installer will ask which components you want to install. You
need only the base C compiler and the C++ compiler. (You may install
other languages if you wish.)
When I install Mingw32 (using the installer) I typically set a NOTE: Building Git allows you to execute Git commands in a MinGW shell,
destination directory of d:\mingw or the like. You will be using and allows the Icarus Verilog tools to report more detailed version
that path later. information when called with the -V option.
NOTES:
If you intend to compile VPI modules for Icarus Verilog, you
need Mingw32, even if you are using a precompiled binary. VPI
modules only require Mingw32, and none of the other libraries.
Finally, as part of installing the mingw32 compilers, remember to add
the mingw/bin directory to your path. You will need that to be able to
find the compilers later.
* Install GnuWin32 Packages * Install GnuWin32 Packages
The GnuWin32 project is a collections of open source programs and The GnuWin32 project is a collection of open source programs and libraries
libraries ported to Windows. These also work well with the Mingw ported to Windows. These also work well with the MinGW compiler, and in
compiler, and in fact Icarus Verilog uses a few pieces from this fact Icarus Verilog uses a few pieces from this collection.
collection.
You will need these gnuwin32 packages to compile Icarus Verilog: >From the GnuWin project (http://gnuwin32.sourceforge.net), download the
following packages:
<http://gnuwin32.sourceforge.net> gperf-3.0.1-bin
bzip2-1.0.3.exe readline-5.0.1-bin
zlib-1.2.3.exe
gperf-3.0.1.exe
bison-2.1.exe
flex-2.5.4a.exe
readline-5.0-1.exe
I suggest creating a common directory for holding all your gnuwin32 NOTE: You need the binaries and the developer files, but you do not
packages. I use C:\gnuwin32. The download page at the gnuwin32 site need the source to these packages.
has a "setup" link for each of these packages. Click the setup to
download the installer for each of the desired programs, then execute
the downloaded .exe files to invoke the installer. Install into the
c:\gunwin32 directory.
NOTES: >From the downloaded gperf-3.0.1-bin zip archive:
You need the binaries and the developer files, but you do not
need the source to these packages. The installer gives you the
choice.
After you are done installing the gnuwin32 tools, you should add the extract bin\gperf.exe to <mingw>\bin
c:\gnuwin32\bin directory (assuming you installed in c:\gnuwin32) to
your Windows path. The msys shell will pick up your Windows path.
* Unpack Icarus Verilog source >From the downloaded readline-5.0.1-bin zip archive:
Unpack the compressed tar file (.tar.gz) of the source with a command extract bin\* to <mingw>\bin
like this: extract lib\* to <mingw>\lib
extract include\* to <mingw>\include
$ gunzip -d verilog-xxxxxxxx.tar.gz | tar xvf - where <mingw> is the location you chose to install MinGW.
NOTE: readline is only required to enable command line editing when
in the vvp interactive mode.
* Install Git for Windows (optional)
NOTE: You can skip this step if you are building from a snapshot.
>From the msysgit project (http://code.google.com/p/msysgit), download
and install the Git for Windows binary package.
NOTE: When installing, you must select the option of preserving Unix
style line endings.
The installation will leave a "Git Shell" icon on the desktop and in the
Git sub-menu of your Start menu. This icon brings up a shell window (a
command line) that has paths all set up for executing Git commands.
* Get the Git Source (optional)
NOTE: You can skip this step if you don't want to build Git.
Start a Git shell. In the Git shell window, change directory to the
location where you wish to store the source code and execute the
following command:
git clone git://repo.or.cz/git/mingw.git git
This will create a directory "git" that contains all the source code
for Icarus Verilog.
The path to the directory containing the source code is referred to as
<git-source> in subsequent instructions.
NOTE: Make sure there are no spaces in the <git-source> path names.
Use forward slashes in place of back slashes when using
<git-source> in a MinGW shell.
* Build Git (optional)
NOTE: You can skip this step if you don't want to build Git.
In the MinGW shell window, execute the following commands:
cd <git-source>
make NO_OPENSSL=YesPlease NO_TCLTK=YesPlease INSTALL=/bin/install \
prefix=/usr/local install
You can now uninstall the Git for Windows binary package if you wish,
as Git commands can now be executed in the MinGW shell.
* Get the Icarus Verilog Source
In the MinGW shell window, change directory to the location where you
wish to store the source code.
If you are building from a snapshot, execute the following command:
gunzip -d verilog-xxxxxxxx.tar.gz | tar xvf -
This will create a directory "verilog-xxxxxxxx" that contains all the This will create a directory "verilog-xxxxxxxx" that contains all the
source for Icarus Verilog. Descend into that directory, as that is source code for Icarus Verilog.
where we will work from now on.
$ cd verilog-xxxxxxxx NOTE: The exact name of the file will vary according to the snapshot.
The 'xxxxxxxx' name is only an example.
NOTES: If you are obtaining source from Git, execute the following command:
The exact name of the file will vary according to the
snapshot. The 20030303 name is only an example.
Unpack the source into a directory that has no spaces. The git clone git://icarus.com/~steve-icarus/verilog verilog
makefiles included in the source get confused by white space in
directory names.
* Preconfigure Icarus Verilog (Not normally needed) This will create a directory "verilog" that contains all the source code
for Icarus Verilog.
NOTE: If you haven't built Git, you will need to execute the above
command in a Git shell.
The path to the directory containing the source code is referred to as
<ivl-source> in subsequent instructions.
NOTE: Make sure there are no spaces in the <ivl-source> path names.
Use forward slashes in place of back slashes when using
<ivl-source> in a MinGW shell.
* Preconfigure Icarus Verilog (not normally needed)
Under certain cases, you may need to "preconfigure" the Icarus Verilog Under certain cases, you may need to "preconfigure" the Icarus Verilog
source tree. You should only need to do this if you are getting the source tree. You should only need to do this if you are obtaining source
Icarus Verilog source tree from CVS, or you are using an existing from Git, or you are using an existing source tree that you've patched to
source tree that you've patched to cause configure.in files to change. cause configure.in files to change.
NOTE: If you are building from a fresh, bundled source tree that NOTE: If you are building from a fresh, bundled source tree that you
you downloaded from an FTP site, then SKIP THIS STEP. Go on to downloaded from an FTP site, then SKIP THIS STEP. Go on to the
the "Configure Icarus Verilog" step below. "Configure Icarus Verilog" step below.
First, remove any autom4te.cache directories that may exist in your First, remove any autom4te.cache directories that may exist in your
source tree. These can make a mess of autoconf runs. Then, generate source tree. These can make a mess of autoconf runs. Then, in the
configure scripts with this command: MinGW shell window, execute the following commands:
$ sh autoconf.sh cd <ivl-source>
sh autoconf.sh
This script will run the "autoconf" command (part of the msysDTK) to This script will run the "autoconf" command to generate all the necessary
generate all the necessary "configure" scripts. This will take a few "configure" scripts.
minutes. This should go smoothly.
* Configure Icarus Verilog * Configure and Build Icarus Verilog
Now we are all set to configure and compile Icarus Verilog. Choose a Now we are all set to configure and compile Icarus Verilog. Choose a
destination path where you will want to install the binaries. I chose destination path where you will want to install the binaries. This
on my system the directory "D:\iverilog". This choice is not choice is not permanent, so don't get too much angst over it. Just
permanent, so don't get too much angst over it. Just choose a name choose a name without white space. The destination path is referred
without white space. to as <ivl-install> in subsequent instructions.
Now, configure the source to make the makefiles and configuration NOTE: Make sure there are no spaces in the <ivl-install> path names.
details. Run these commands: Use forward slashes in place of back slashes when using
<ivl-install> in a MinGW shell.
$ CPPFLAGS="-Ic:/gnuwin32/include In the MinGW shell window, execute the following commands:
$ LDFLAGS="-Lc:/gnuwin32/lib
$ export CPPFLAGS LDFLAGS
$ ./configure --prefix=c:/iverilog
NOTES: cd <ivl-source>
The CPPFLAGS and LDFLAGS variables tell configure where ./configure --prefix=<ivl-install>
the gnuwin32 packages are. The configure program will make
write these values into the Makefiles, so you only need to
keep these variables long enough for the configure program
to work.
Your PATH variable was set in the previous step.
Use forward slashes as directory characters. All the various
tools prefer the forward slash.
Substitute your chosen directory for the prefix. This will cause the
makefiles to build and the source code to configure. The configure
program will detect that this is a mingw environment and set things up
to build properly.
(For a prefix, use the drive letter notation; the mingw compiled parts
require it, and the Cygwin tools should be able to handle it. You may
need to check or upgrade your Cygwin installation if this causes
problems for you.)
* Compile Icarus Verilog
This, believe it or not, should be the easy part:
$ make
It could take a while. Now is a good time to go get some coffee or
take a tea break.
NOTE: If you execute configure without the --prefix option, the
default installation path is <mingw>\msys\1.0\local, which
in a MinGW shell is aliased to /usr/local/bin.
* Install Icarus Verilog * Install Icarus Verilog
If the compile ran OK, then next you install Icarus Verilog in the If the compile ran OK, then next you install Icarus Verilog in the
directory you have chosen. When you are ready, install like this: directory you have chosen.
$ make install 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 This is part of what the configure program did for you. The Makefiles
now know to put the files under the D:\iverilog directory (or whatever know to put the files in the <ivl-install> directory.
directory you chose) and away you go.
You may find that you need to put some of the prerequisite DLLs into You now need to add <ivl-install>\bin and <mingw>\bin to your Windows
the d:\iverilog\bin directory. These include: "PATH" environment variable. Alternatively, you can copy the DLLs
needed by Icarus Verilog from <mingw>\bin to <ivl-install>bin, and
c:\mingw\bin\mingw10.dll just add <ivl-install>\bin to your Windows "PATH" environment variable.
c:\gnuwin32\bin\readline.dll
c:\gnuwin32\bin\history.dll
c:\gnuwin32\bin\bzip2.dll
c:\gnuwin32\bin\zlib.dll
If you already have these in your Windows path (i.e. your system32
directory) then you do not need to copy them into the iverilog
directory. However, prepackaged Icarus Verilog binaries include these
files.
* Running Icarus Verilog * Running Icarus Verilog
Finally, put the C:\iverilog\bin directory in your Windows path, and You can run Icarus Verilog either from a Windows command shell window
you should be able to run the iverilog and vvp commands to your or from a MinGW shell window.
heart's content.
Currently, the iverilog.exe uses the path to itself to locate the NOTE: You will need to start a new shell to pick up any changes you
libraries and modules associated with itself. In other words, if you have made to the "PATH" environment variable.
execute the C:\iverilog\bin\iverilog.exe program, it will locate its
subparts in the C:\iverilog directory and subdirectories below Currently, iverilog.exe uses the path to itself to locate the libraries
that. This means you can move the Icarus Verilog installation by and modules associated with itself. In other words, if you execute the
simply moving the root directory and all its contents. <ivl-install>\bin\iverilog.exe program, it will locate its subparts 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.
The vvp.pdf and iverilog.pdf files document the main commands. View The vvp.pdf and iverilog.pdf files document the main commands. View
these with Acrobat reader, or any other viewer capable of displaying these with Acrobat reader, or any other viewer capable of displaying