Monday, June 16, 2014

Notes - Developing with Clozure Common Lisp on Microsoft Windows Platforms, using the Eclipse IDE

Essential Outline, Overview

I. Install IDE

II. Install toolchain components

III. Install software components

  1. Install precompiled components
  2. Build source-code components

IV. "Write new lines of code"

V. "Release new lines of code"

VI. "Release party"

VII. "Maintain released code"


Note: This outline proposes an alternative to to crowd-sourced economic models.

IX. ....?

Practical Outline, Current Draft

  1. Install GNU C/C++ Toolchain via Cygwin
    • Supporting documentation resources may include:
    • Observe that there are two distinct C/C++ compiler toolchains available for installation via Cygwin: The GNU Compiler Collection (GCC) and the Minimialist GNU for Windows (MinGW) toolchain
      • Additionally, a 64 bit edition of the GCC toolchain is available via cygwin64-gcc 
      • Alternately, a 64 bit edition of the MinGW toolchain is available in two editions:
        • mingw64-i686-gcc 
        • mingw64-x86_64-gcc
        • Referencing the mingw-w64 General Usage Instructions, the mingw-w64 i686 toolchain would be used for compiling 32 bit binaries on a 64 bit host platform, whereas the x86_64 toolchain would be used exclusively for compiling 64 bit binaries
        • For compiling CCL for Microsoft Windows platforms, mingw64 is the recommended toolchain. For a complete Microsoft Windows build of CCL -- for Windows 32 bit and Windows 64 bit target platforms -- both of the MinGW-w64 i686 and x86_64 toolchains should be installed, for compiling the CCL Lisp kernel respectively for 32 bit and 64 bit Microsoft Windows platforms. 
        • Observe the advice denoted in the following source files, and the Cygwin packages recommended in the same:
          • Makefile for CCL 1.9 on Win32, recommending the following Cygwin packages:
            • make
            • m4
            • mingw64-i686-binutils
            • mingw64-i686-gcc-core
            • mingw64-i686-headers
            • mingw64-i686-pthreads
            • mingw64-i686-runtime
          • Makefile for CCL 1.9 on Win64, recommending Cygwin software packages:
            • make
            • m4
            • mingw64-x86_64-binutils
            • mingw64-x86_64-gcc-core
            • mingw64-x86_64-headers
            • mingw64-x86_64-pthreads
            • mingw64-x86_64-runtime
          • Using the Eclipse IDE C Development Tools (CDT) in an Eclipse CDT C/C++ project, each toolchain may be defined seperately, in an individual toolchain configuration, via the project properties dialogue window for the respective project.
  2. Install Eclipse IDE (Kepler)
  3. Install additional extensions for the Eclipse IDE:
    • Collaboration // Subversive (SVN) team provider 
    • Programming Languages // C/C++  Development Tools
  4. Download the CCL 1.9 distribution for Microsoft Windows Platforms (source and binaries). 
    • See Getting Closure CL
    • SVN URL
    • Create as Generic Project
      • After download: Convert to C Project, referring to Eclipse IDE online help documentation
        • Select C Project
        • Select Project Type: Makefile Project (Cygwin GCC)
          • NOTE: Ensure that the Cygwin GCC installed and that the user's PATH environment variable is appropriately configured, within the Eclipse IDE session -- e.g PATH should contain an entry  c:\cygwin\usr\bin at the end of the PATH environment variable value (refer to later outline entries, here)
        • Observe that the primary makefile is located under the directory lisp-kernel/{architecture}, for each supported {architecture} within the CCL source tree (e.g. win32, win64)
        • After converting the project containing the CCL source tree into a C project, then right click on the project, in the Eclipse IDE Project Explorer view, and select the Properties entry, in the project context menu
          • Observe the project properties, C/C++ Build and C/C++ General
          • Specifically, under the C/C++ Build property, as to ensure that Cygwin is available on the system PATH at build time
            1. Select the Build Variables entry
            2. Select ADD
            3. Enter PATH as the variable name
            4. Add the entry: ${CYGWIN_HOME}\usr\bin and select OK
            5. Select ADD, again
            6. Optionally, in the Build Variables dialogue window, select Show system variables to review the full list of environment variables that will be defined in the build environment.
          • Select the root C/C++ Build property, and append the appropriate CCL lisp-kernel makefile location to the Build Command, e.g substituting the appropriate project name (in this configuration, ccl-1.9-windows-ms)  the build command  for building CCL for 64 bit Microsoft Windows platforms:  make -f ${workspace_loc:/ccl-1.9-windows-ms}/lisp-kernel/win64/Makefile
          • TO DO: One or more of:
            • Define an "add on" central makefile for both of win32 and win64, such that the central makefile would permit for specification of which target platform to select, at build time
            • Configure the Eclipse project for the CCL build, such that an environment variable may be used to select which target platform to compile for, e.g to a Build Command:  make -f ${workspace_loc:/ccl-1.9-windows-ms}/lisp-kernel/${target.arch}/Makefile
            • Define a separate Eclipse CDT make target for each respective target runtime platform. See also: Creating a make target, in the Eclipse CDT Online Help Documentation
  5. Refer to CCL manual, Chapter 3: Building Clozure CL from its Source Code, specifically section 3.5, Using "make" to build the lisp kernel
  6. ... #YMMV
To do:
  • Developing with McCLIM
    • UI Concepts in CLIM
    • Contrast: 
      • Geometric GUI design / view
        • CLIM
      • Structural GUI design / view
        • Qt, GTK, Eclipse Standard Widget Toolkit, ...
    • Observations:
      • CLIM was designed for integration with window systems
      • CLIM was developed at a time before the widespread development and adoption of standard GUI component toolkits, as available in contemporary editions of the Microsoft Windows, OS X, and Linux/X11 desktop platforms
        • Sidebar: Toolkits and Desktop Environments -- primarily on Linux/X11 platforms
          • GTK, GNOME
          • Qt, K Desktop Environment (KDE)
      • The design of the CLIM GUI architecture effectively requires that the Common Lisp implementation will perform in a role as layout manager, on the graphical desktop platform
      • Standard GUI component toolkits such as Qt would be defined with, in each, their own respective layout managers
        • Functionally dependent on available interfaces, the toolkit's own layout manager may be interfaced via FFI
  • Developing with Qt and McCLIM
    • Qt 5 on Microsoft Windows (Windows 8, WinRT, Metro UI ) -- Resources
      • Qt for Windows (Qt 5)
        • Download Qt
          • Observe that the Qt WinRT 5.3.0 binary edition is compiled for a 32 bit architecture, and therefore would require a 32 bit Lisp image for FFI
          • Note that CommonQt does not presently support Qt 5
          • Observe that Qt 4.8 (4.8.6) is available in an edition compiled with MinGW
            • The exact toolchain edition, as mentioned in the text of a a dialogue window, at installation time: MinGW GCC 4.8.2 i686, POSIX threads, Dwarf exception handling. A corresponding edition is available via the MinGW-w64 project, as hosted at 
            • Observe that CommonQt makes reference to the Qt 4 edition compiled with Microsoft Visual Studio / Visual Studio Express
      • Qt 5 on Windows 8 and Metro UI (ca. 2012)
      • Introduction to jom 
        • jom - parallel alternative to nmakeMicrosoft Windows platforms
      • Qt 5 on Windows ANGLE and OpenGL
        • OpenGL ES 2.0 for embedded systems
        • QtMultimedia
        • Microsoft Windows RDP
    • Qt, Qt Smoke interfaces, and CLtL
  • A survey of free/open source software distribution models
    • Debian
      • Feature: Standardized, extensible packaging system
      • Feature: Command-line package management tools
      • Feature: Package signing
      • Feature: GUI package management tools available
      • Feature: OS-wide package management for Debian GNU/Linux and Debian-based GNU Linux distributions
      • Feature: Package dependency management specifications may include information about direct build dependencies
      • Feature: Repository structure delimited according to release objects, e.g. "Woody"
      • Feature: Allows convenient backporting of source packages, between individual release sets
    • Cygwin
      • Feature: Central repository of free/open source software (FOSS) for Microsoft Windows platforms
      • Feature: GUI package management tool
    • Eclipse Update Sites
      • Feature: GUI package management for Eclipse IDE extensions
      • Feature: Licensing notification, previous to installation time
      • Feature: XML format for repository metadata
      • Feature: Some extensions provide their source code in separate extension packages
    • Maven Repositories
      • Feature: Extensible model for public/private distribution of Java archives
      • Feature: Package metadata is defined in an XML POM (Project Object Model) file
      • Feature: Allows for distribution of source archives in parallel to compiled source archives
    • Emerge (KDE edition)
      • ....
    • See also: ChromiumOS source code repositories
      • ...

Backtrack Log

Errors were encountered when installing the following packages via Cygwin 
  • libcom_err2-1.42.10-1 (package libcom_err2, located under 'e2fsprogs' directory in the local package downloads cache)
    • "Unable to extract /usr/bin/cygcom_err-2.dll [...]"
  • libintl8- (package libintl8, located under the 'gettext' directory)
    • "Unable to extract /usr/bin/cygintl-8.dll [...]"
  • Apparent cause: Files "In use" within another process; unable to overwrite, due to process file-locking.
The package installation process proceeded otherwise normally, despite those errors.

Recommended resolution: Delete the downloaded package archives  for those packages, (Note: Possibly not necessary in this instance, but advised) and reinstall those packages, via Cygwin Setup.exe, after all of the packages are installed.

Those errors were repeatable. The errors were a result of there being a Squid HTTP proxy service running in background, during the installation of those software packages.

Recommended resolution (Updated): When encountering a similar error message, shut down the Microsoft Windows Service for Squid HTTP proxy and select "Retry," in the dialogue window displaying the error message. After the installation completes, restart the proxy service -- observing that any access to the local HTTP proxy service will be interrupted, during the installation.