Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
diana:windows:building:environment [2009-11-25 14:35:03]
dages moved
diana:windows:building:environment [2022-05-31 09:29:31] (current)
Line 3: Line 3:
 Assuming Windows XP 32.  We will use MinGW to build the libraries and application and MSYS as a working environment. Assuming Windows XP 32.  We will use MinGW to build the libraries and application and MSYS as a working environment.
  
-The distinction between MinGW and MSYS is very important: MinGW is a set of compilers and libraries you use to build Windows applications, while MSYS is GNU environment similar to (and, in fact, based on) Cygwin.  You can //not// use MSYS libraries in your Windows application.+The distinction between MinGW and MSYS is very important: MinGW is a set of compilers and libraries you use to build Windows applications, while MSYS is an emulated GNU environment similar to (and, in fact, based on) Cygwin.  You can //not// use MSYS libraries in your Windows application.  This means that you will sometimes have two copies of a particular library: an MSYS version used by MSYS tools, and a native version built with MinGW and used by MinGW tools and / or your application.
  
 +===== Directories =====
 +
 +We will install MinGW into ''C:\MinGW'' and MSYS into ''C:\MSYS''.
 +
 +MSYS maps Unix-like paths to Windows paths: ''/'' translates to ''C:\MSYS'' and ''/mingw'' translates to ''C:\MinGW'' In addition, all Windows drives will show up as ''/x'', where ''x'' corresponds to the drive letter, so ''/c/windows'' translates to ''C:\windows'', etc.
 +
 +We will install our libraries and applications into ''C:\met.no'' You should start by creating that directory and the required subdirectories:
 +
 +  C:\> mkdir met.no
 +  C:\> mkdir met.no\bin
 +  C:\> mkdir met.no\include
 +  C:\> mkdir met.no\lib
 +  C:\> mkdir met.no\share
 +  C:\> mkdir met.no\copyright
  
 ===== Subversion ===== ===== Subversion =====
Line 19: Line 33:
  
 At this point, you may want to download bsdtar from http://sourceforge.net/projects/mingw/files/MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/ and install ''bsdtar.exe'' as ''/mingw/bin/tar'' It supports a wider range of archive formats and compression algorithms than GNU tar, and automatically detects which one to use. At this point, you may want to download bsdtar from http://sourceforge.net/projects/mingw/files/MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/ and install ''bsdtar.exe'' as ''/mingw/bin/tar'' It supports a wider range of archive formats and compression algorithms than GNU tar, and automatically detects which one to use.
 +
 +You may want to install InfoZip's ''zip'' utility as well, since ''bsdtar'' can //extract// zip files but not //create// them: download the source code from http://sourceforge.net/projects/infozip/files/, extract it, and run the following commands in the source directory:
 +
 +  $ make -f win32/makefile.gcc
 +  $ cp zip.exe /mingw/bin
  
 ===== MSYS ===== ===== MSYS =====
Line 70: Line 89:
   GNU Fortran (GCC) 3.4.5 (mingw-vista special r3)   GNU Fortran (GCC) 3.4.5 (mingw-vista special r3)
   Copyright (C) 2004 Free Software Foundation, Inc.   Copyright (C) 2004 Free Software Foundation, Inc.
 +  
   GNU Fortran comes with NO WARRANTY, to the extent permitted by law.   GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
   You may redistribute copies of GNU Fortran   You may redistribute copies of GNU Fortran
Line 78: Line 97:
   $ cat >hello.f   $ cat >hello.f
         PROGRAM HELLOW         PROGRAM HELLOW
-        WRITE(UNIT=*, FMT=*) 'Hello World'+        WRITE(UNIT=*, FMT=*) 'Hello, Fortran world!'
         END         END
   ^D   ^D
Line 85: Line 104:
    Hello, Fortran world!    Hello, Fortran world!
  
-===== Perl =====+===== lex & yacc =====
  
-The GNU Autotoolswhich we will install next, require Perl.  Download and install the MSYS version of Perl from http://sourceforge.net/projects/mingw/files/MSYS%20perl/.  You will also need libcrypt from http://sourceforge.net/projects/mingw/files/MSYS%20crypt/.+Or rather, in our brave GNU worldflex and bison.  There is a problem here: you can't use the MSYS versions, because they're not just build tools—bison includes a runtime library (''liby'').  Hence we need native versions of both tools.  We can get those from [[http://sourceforge.net/projects/gnuwin32|GnuWin32]].
  
-===== pkg-config =====+Download the following files from http://sourceforge.net/projects/gnuwin32/files/:
  
-There are no MinGW or MSYS binaries for pkg-config, and building it from source is non-trivial due to a circular dependency on glib (you need pkg-config to build glib).  However, the Gnome project distribute Windows binaries of both glib and pkg-config, which you can download from http://www.gtk.org/download-windows.html.  They come in zip files, so you can just double-click them in Windows Explorer and copy the contents to your MinGW root (''C:\MinGW'').+  * the ''bin''''lib'' and ''dep'' zipfiles for the latest bison release (the ''dep'' zipfile contains a few libraries that bison needs, so you won't have to install them separately) 
 +  * the ''bin'' and ''lib'' zipfiles for the latest flex release
  
-===== lex & yacc =====+For some unfathomable reason, both the flex and bison ''lib'' zipfiles contain incorrect copies of ''<unistd.h>'' Either make a backup copy of ''/MinGW/include/unistd.h'' before you unpack them, or tell ''unzip'' (or ''bsdtar'') not to overwrite existing files: 
 + 
 +  $ tar -kxf bison-2.4.1-lib.zip -C /MinGW 
 + 
 +This will install a shell script called ''/MinGW/bin/yacc'' which incorrectly redirects to ''c:/progra~1/bison/bin/bison'' Edit it so the entire script looks like this:
  
-Or rather, in our brave GNU world, flex (http://downloads.sourceforge.net/project/mingw/MSYS%20flex/flex-2.5.35-1/flex-2.5.35-1-msys-1.0.11-bin.tar.lzma) and bison (http://downloads.sourceforge.net/project/mingw/MSYS%20bison/bison-2.4.1-1/bison-2.4.1-1-msys-1.0.11-bin.tar.lzma).  In addition, flex requires the GNU regex library (http://downloads.sourceforge.net/project/mingw/MSYS%20regex/regex-1.20090805-1/libregex-1.20090805-1-msys-1.0.11-dll-1.tar.lzma).  Download and install as usual.+  #! /bin/sh 
 +  exec /mingw/bin/bison -y "$@"
  
 ===== WiX ===== ===== WiX =====
  • diana/windows/building/environment.1259159703.txt.gz
  • Last modified: 2022-05-31 09:23:14
  • (external edit)