Skip to content
Pavel Koneski edited this page Nov 28, 2023 · 7 revisions

Ironclad 3.4

Ironclad 3.4 only builds as a 64-bit package. 32-bit builds are not supported.

Building on Windows

Using a Docker container

In the root of the project there is a Dockerfile that contains Docker instructions to create a Docker image suitable to run a Docker container with all tools necessary for the build of the main branch of Ironclad.

To create and run the container, change the current directory to the project root directory and, using PowerShell:

docker build -t ironclad-build:v3.4 -m 2GB .
docker run -it -v ${pwd}:C:\ironclad ironclad-build:v3.4

Install build dependencies

For building outside of a Docker container, install the following prerequisites:

  • .NET Framework 4.6.2 or higher

  • Visual Studio 2022 (any edition), with:

    • Visual C tools and libraries (64-bit)

    • Windows 10 SDK

    • .NET 6.0 SDK or higher

    • Clang toolset

  • MinGW64 with the NASM compiler (the tools have to be put on the search path $env:PATH)

  • CPython 3.4 64-bit (no need to put it on the search path)

  • Visual C 2010 Redistributable (latest version)

  • CPython 3.9 or higher (executable as to be put it on $env:PATH), with the following packages installed:

    • scons

    • castxml

    • pygccxml

  • IronPython 3.4, latest release

    • for .NET Framework

    • for .NET (Core)

The above setup is sufficient to build Ironclad with Clang (which is the default build). To build using MSVC v16.0, additionally install:

  • Windows® SDK for Windows® 7 and .NET Framework 4

  • Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1

Edit SCons script

Ironclad’s build process is configured by main.scons in the project root directory. Go to the section marked PLATFORM-SPECIFIC GLOBALS, and change anything that looks wrong for your system. The values provided in current main.scons are known to work with the Docker container and on Windows 11 x64 with the following assumptions:

  • IronPython for .NET Framework installed using Chocolatey

  • IronPython for .NET installed as a dotnet tool IronPython.Console

  • MinGW64, CPython 3.9+ are on executable search path

  • Other tools and components installed in default locations

Build

Having done the above, running scons in the project root directory (C:\ironclad in Docker container), in your favourite shell, should build everything required by Ironclad. By default, it will build a release configuration targeting the .NET Framework. To build for other frameworks or configurations, use SCons build parameters on the scons command line, like scons framework=all configuration=debug. The final build output is placed in directory 'out/«configuration»/«framework»'. Intermediate build artifacts are placed in 'build/«configuration»/«framework»'. Run scons -h for info about supported build parameters and options, their accepted values, and where the final build artifacts are placed.

Clean

Run scons -c. Again, by default it will only clean a release configuration targeting the .NET Framework. To clean other builds, run scons -c with the same build parameters as used to create those builds.

It is also possible to purge all artifacts created by any build run, by deleting the whole trees build and out in the project root directory.

Testing

Running complete test suite

Run scons test with the relevant build parameters on command line. This will execute the whole test suite for the selected configuration/framework. E.g. to run all rests for all builds:

scons test configuration=all framework=all

Running single test case

To run a specific test, first set IRONPYTHONPATH to the directory containing the Ironclad package in the out directory, and the DLLs and site-packages directories of CPython 3.4. E.g. to run a test for a debug build on .NET 6.0 in PowerShell on Windows:

$env:IRONPYTHONPATH = ".\out\debug\net6.0;C:\Python34\DLLs;C:\Python34\Lib\site-packages"

Then set environment variable TESTDATA_BUILDDIR to the location of the compiled test files in the build directory. Continuing the example above:

$env:TESTDATA_BUILDDIR = ".\build\debug\net6.0\tests\data"

Finally run the test with:

\path\to\ipy.exe .\runtests.py tests.«testtfile».«testcase»

Use ipy.exe for the same .NET CLR as the one Ironclad under test is targeting. E.g.

~\.dotnet\tools\ipy.exe .\runtests.py tests.dllreadertest.DllReaderTest

Ironclad 2.7

Ironclad 2.7 only builds as a 32-bit package.

Building on Windows

Install build dependencies

  • Python 2.7 python-2.7.8.msi

  • SCons 2.3.4 scons-2.3.4-setup.exe

  • mingw mingw-get-setup.exe

    • install and start mingw-get

    • under Basic Setup select mingw32-base mingw32-gcc-g++ msys-base

    • under All Packages select mingw32-pexports

    • Apply Changes

    • add C:\MinGW\bin to PATH

    • if you have cygwin, make sure PATH has no references to it or at least it is after MinGW

  • cmake cmake-3.0.2-win32-x86.exe

  • GCCXML 0.9.0

    • get the source

      $ git clone  https://github.com/gccxml/gccxml
    • generate makefiles with cmake

      • open cmake gui

      • provide source code directory (e.g. c:\Users\auser\github\gccxml)

      • provide build directory, next to source directory (e.g. c:\Users\github\gccxml-build)

      • configure

      • select MinGW Makefile and Use default native compilers, Finish, wait …​

      • set CMAKE_BUILD_TYPE to Release

      • generate

    • compile using mingw

      in cmd window, change dir to build and invoke

      $ mingw32-make.exe
    • install into c:\Program File (x86)\gccxml

      in cmd.exe with administrator privileges, change dir to the build and invoke

      $ mingw32-make.exe install
  • IronPython 2.7.5 IronPython-2.7.5.msi

  • install pyexpat from fepy

    take pyexpat.py rename to expat.py and copy into "c:/Program Files (x86)/IronPython 2.7/lib/xml/parsers"

    $ copy "c:/Python27/lib/xml/dom/expatbuilder.py" "c:/Program Files (x86)/IronPython 2.7/lib/xml/dom"
    $ copy "c:/Python27/lib/xml/sax/expatreader.py" "c:/Program Files (x86)/IronPython 2.7/lib/xml/sax"
  • pygccxml 1.6.2 pygccxml-v1.6.2.tar.gz

    after unpacking install into ironpython site-packages

    $ ipy setup.py install --user
  • nasm 2.11 nasm-2.11.06-installer.exe

    once setup is complete copy nasm.exe to MinGW/bin

    $ copy C:\Users\auser\AppData\Local\nasm\nasm.exe c:\MinGW\bin
  • up to date version of .NET (4.0 or better). No effort is made to support .NET 3.5 (CLR 2.0)

At this point the version check script (bin/versions.bat) can be used to verify configuration.

c:\Users\auser\github\ironclad\bin>versions.bat
MINGWBASEDIR=C:\MinGW
gcc version 4.8.1 (GCC)
GNU gdb (GDB) 7.6.1
NASM version 2.11.06 compiled on Oct 20 2014
GNU ld (GNU Binutils) 2.24
GNU windres (GNU Binutils) 2.24
GNU dlltool (GNU Binutils) 2.24
PExports 0.46; Originally written 1998, Anders Norlander
GNU Make 3.82.90
#define __MINGW32_VERSION           3.20
#define __W32API_VERSION 3.17

Edit SConstruct

Ironclad’s build process is configured by SConstruct in the top- level directory. Go to the section marked PLATFORM-SPECIFIC GLOBALS, and change anything that looks wrong for your system. The values provided in current SConstruct are known to work under Windows 7 x64 with all dependencies installed in default locations.

MSVCR90_DLL is of particular note: to find it on your system, find a directory in windows/winsxs that starts with:

x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_

…​and use the full path to the msvcr90.dll therein.

Build

Having done the above, running scons in the top-level directory, from a cmd.exe shell, should build everything required by Ironclad.

$ c:\Python27\Scripts\Scones.bat

Clean

$ c:\Python27\Scripts\Scones.bat -c

Testing

Test dependencies

  • pysvn pysvn 1.7.9

  • numpy numpy 1.9.1

    patch numpy:

    $ cd c:\Python27\Lib\site-packages
    $ patch -p0 < c:\Users\auser\github\ironclad\misc\numpy.patch

Note: numpy is known to be broken.

Test

You can either fire up a complete test suite:

$ c:\Python27\Scripts\Scones.bat test

Or select subset, giving module, class or individual test case.

$ set IRONPYTHONPATH=.;C:\Python27\DLLs;C:\Python27\Lib\site-packages
$ ipy runtests.py tests.functionalitytest.BZ2Test.testFunctionsWork

The original and outdated instructions can be found under doc/build.txt

Clone this wiki locally