Skip to content

Building on Windows

tajmone edited this page Mar 7, 2020 · 2 revisions

Info, tips and troubleshooting on compiling the PureBasic IDE under Microsoft Windows.


Table of Contents


Introduction

The build system for compiling the PureBasic IDE under Windows is still being worked upon in order to improve it. With the help and feedback from end users we aim to ultimately provide a build toolchain that works seamlessly on every operating system, and to provide detailed instructions on how to do so.

This Wiki page is intended as a complement to BUILD.md instructions document included with the project, offering tips and advise on how to setup your local machine correctly and to help troubleshooting known issues which might be encountered during setup or compiling.

System Requirements

In order to compile the IDE you'll need the following software and tools to be available on your system:

  • A PureBasic installation.
  • Microsoft C Compiler.
  • The Windows SDK.
  • Some Unix and GNU tools for Windows.

The PureBasic Team uses the following tools to build the IDE:

Alternative tools to those listed above might also work, and we shall cover in this document some known alternatives which were reported to successfully build the IDE.

@ChrisRfr has successfully compiled the IDE using MSVS 2013 and the Windows 10 SDK, and is currently working to update the build scripts of the project to support this alternative configuration too.

If you've managed to compiler the IDE using different tools, please update this Wiki page or let us know about it.

PureBasic Installation

The build process requires access to a PureBasic installation which can be overwritten — i.e. the build system needs this installation not only to access the PureBasic compiler, libraries and SDK, but it will also compile the new IDE in this folder, overwriting the original files.

You should therefore create a dedicated installation of PureBasic for this task, outside of the usual programs installation folders on system drive (which are protected from changes).

  • If possible, install PureBasic in a drive (or disk partition) other than the system drive (i.e. where Windows resides, usually C:\).

  • If no secondary drives or partitions are available, avoid installing inside system-managed folders, which might be protected from modifications by third party applications.

  • Don't include spaces in the path of the installation, because it would cause failure with the GNU tools. E.g. don't choose an installation path like:

      E:\my pb ide\PureBasic\
    

    but use E:\my_pb_ide\PureBasic\ or E:\my-pb-ide\PureBasic\ instead.

Later, you'll need to edit the build scripts to correctly set the environment variables to point to this installation path, so that the build system will now were to look for to access the PureBasic compiler, etc., and where to generate the newly compiled IDE executable.

Microsoft Visual C

The PureBasic IDE project includes some components written in C language, so you'll also need to install the Microsoft C compiler in order to build the project, which is included in the Microsoft Visual Studio (MSVS) products.

Visual Studio 2013

The official build by the PureBasic Team uses VS 2013, which is also available as Community Edition, which is free to use for open source projects:

Later versions of Visual Studio might also work, but they haven't been tested. You could try using different versions yourself, but, you'll need to tweak the build scripts in order to set the correct paths to the VC bins and headers folders of other VS products.

MS Windows SDK

The Windows SDK (previously called Platform SDK), is a collection of software development kits (SDKs) from Microsoft. It contains documentation and examples, along with the required header files, libraries and tools to develop applications for Microsoft Windows.

The Windows SDK is designed to integrate with MS Visual Studio, but there are compatibility issues when combining products versions from different different "eras". For a full list of downloadable SDK versions visit the Microsoft Windows SDK archive.

Windows 7 SDK

The SDk used by PureBasic Team to build the IDE is the Windows SDK for Windows 7:

Windows 10 SDK

@ChrisRfr has successfully built the IDE using MSVS 2013 and the Windows 10 SDK and is currently working on an update of the build scripts of the project to support this alternative configuration.

Unix and GNU Tools

Because the build system relies on a Makefile, you'll also need to make available on your PATH some Unix shell command and GNU tools, ported to Windows executables:

  • GNU Make
  • cp
  • pwd
  • rm
  • touch
  • zip

@ChrisRfr has selected all the required utilities from the GnuWin project and collected them in an ad hoc Zip package, available from this Wiki:

Download the Zip archive, unpack it and add it to your PATH (full instructions inside the Zip file).

NOTE — The GnuWin utilities selected by @ChrisRfr are a better alternative to the UnxUtils package, which is very old (1999-2000) and contains many others tools (118 executables) which are not required to build the PureBasic IDE, some of them having the same name of native CMD commands, which they end up replacing entirely.


Troubleshooting

There are a number of known problems when installing older Visual Studio Windows SDK versions on recent Windows versions. This section tries to gather useful information on these known issues and their solutions.

Please, feel free to edit this page and add the problems and solutions you've experienced in your own setup process.

Windows 7 SDK Installation

Chances are that if you're installing the Win 7 SDK from scratch you'll encounter a number of problems due to Windows containing more recent versions of the tools that the Win 7 SDK wants to install.

For a good tutorial on how to install the Windows 7 SDK

Installation Order Matters

Beware that installation order matters, and that in some cases you'll have to uninstall MSVS, the Win SDK and other VC related components in order to successfully install them and update them in right succession, preventing these applications from blocking each other's setup and/or updates.

Visual C++ 2010 Redistributable Conflicts

PROBLEM — The Windows 7 SDK fails to complete installation reporting error code 5100.

CAUSE — This error occurs when installing the Windows 7 SDK on a computer that has a more recent version of the Visual C++ 2010 Redistributable installed.

SOLUTION — Uninstall all versions of the Visual C++ 2010 Redistributable before installing the Windows 7 SDK. The VC++ 2010 components will be reinstalled by the SDK and updated again, so you won't loose them.

For more details, see the following article by Microsoft support:

RTM .NET Framework 4 Error

PROBLEM — The Windows 7 SDK fails to install reporting that the RTM .NET Framework 4 component can't be installed.

CAUSE — This error occurs because a more recent version of the .NET Framework (.NET Framework 4.5) is already installed on your computer.

SOLUTION — Uninstall the .NET Framework 4.5 and run the Win 7 SDK installer again, this should fix the problem. After the Win 7 SDK is installed and updated, you'll get the .NET Framework 4.5 back on your machine.

For more details on this problem, see:


External References

Windows SDK Links

PureBasic Forums

Links to relevant discussions on the PureBasic Forums.