Creating a Development Environment on Windows

Here's how to set up your build environment in Windows. Admittedly, it is a bit more complicated than the Linux instructions (see below) because you have to set up a "Linux-like" programming environment. Actually, it is a Posix-type environment with a cross-compiler for Windows. A lot of stuff is going on in the build environment you are about to set up, but believe me, this is a lot easier than it use to be!

  1. Preparation. To avoid weird bugs, do the following. Turn off your virus scanner. It will just slow things down, and may find a false positive in the many files that you download. Uninstall or "hide" (by renaming a directory) your installations of cygwin and strawberry perl, or other packages that contain cygwin*.dll, or gcc. Another example is git bash. If those programs are in your path, remove them from the path.
  2. Go to http://msys2.github.io/ and follow the simple instructions there. You pick the i686 version of the package if you are in 32-bit Windows; you pick the x86_64 version of the package for 64-bit Windows. Make sure that you use the default directory suggested, msys64 or msys32, depending on which platform you are on.
  3. Be sure to follow the instructions, including the one about closing the window after step 6. Use the Red X and allow Windows to kill the process(es) that are associated with it. Restart the MSys2 Shell from Start | All Programs | MSYS2 64bit | MSYS2 Shell (I'm assuming a 64-bit shell here, but you may use a 32-bit shell just as well.)
  4. Make sure that your shortcuts are updated properly so that they will start msys and mingw properly:
    * MSYS2_ROOT\msys2_shell.cmd -mingw32
    * MSYS2_ROOT\msys2_shell.cmd -mingw64
    * MSYS2_ROOT\msys2_shell.cmd -msys
  5. You have to do things a bit different if you going to use the 64-bit toolchain (x86_64) or the 32-bit toolchain (i686). On a 64-bit version of Windows, you can use either one. Be careful which shell you are using.
  6. Start a mingw-w64 Win64 shell and install the 64-bit toolchain: pacman -S mingw-w64-x86_64-toolchain --or--
  7. Start a mingw-w64 Win32 shell and install the 32-bit toolchain: pacman -S mingw-w64-i686-toolchain
  8. For the above, install package numbers "1,2,3,7,9-16" by typing just what I have in quotes (I did not include packages ada, objc, or fortran).
  9. Did I mention that you need to start a MINGW shell? You do not want to use the MSYS shell now. It is only necessary sometimes, like when initially bootstrapping up the development environment. After that, MINGW shells are what you should use.
  10. Wait for it to download a bunch of stuff. You can watch if you want. It's like watching grass grow.
  11. pacman -S base-devel
  12. And make sure to select all the packages (the default)
  13. To update the msys2 system, run the command: pacman -Syuu. Repeat this until no packages are updated. This can be done in an msys2 shell or a mingw shell.
  14. wget http://fbcaa.org/bibledit/buildenvWin64.sh
  15. Run ./buildenvWin64.sh ...... It determines what to download based on the MSYSTEM environment variable.
  16. It downloads a bunch of packages and git clones the source code repository onto your system. Wait.
  17. The source code repo will be in 32bit/bibledit-desktop or 64bit/bibledit-desktop depending...
  18. Verify by "which gedit" whether /mingw32/bin/gedit is present. Run it and it should work. This is your test that all is well so far.
  19. Modify your /home/username/.bash_profile so that the path doesn't have a bunch of Windows cruft in it. This will avoid a multitude of problems. For instance, if gcc points to some other gcc on your system (on mine, strawberry/gcc), then you will have problems. You can use the sample in bibledit/gtk/windows/bash_profile. If you want, just cp ~/64bit/bibledit/gtk/windows/bash_profile ~/.bash_profile. It has a section where it looks at $MSYSTEM to determine what path to set, and it does NOT add the old PATH back to the end of the new PATH.
  20. Verify that "gcc --version" says 5.4.0 or later. If not, exit the Mingw shell and restart it. Check again. If you have no gcc in the path, then you forgot to install the toolchain. Do step 8 again. I have done this several times when I install the x86_64 (64-bit) tools and then later add on the i686 (32-bit) tools using buildenvWin.sh. I forget that I need to install the 32-bit toolchain.
  21. Don't go to the next step until gcc --version reports the right thing.
  22. Go to Building on Windows

Last updated 6/9/2016.

© 2004-2017 Fellowship Bible Church | 2775 Bedford Road, Ann Arbor, MI 48104 | 734-971-2837 | Privacy Policy | Sitemap