build instructions and scripts for STASM 4
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

STASM 4 build scripts

This is a set of scripts, mainly cmake ones, that can be used to compile the STASM library (version 4 and later).

  • CMakeLists.txt: cmake build script to compile the STASM library and its examples
  • template to generate a STASMConfig.cmake which could be useful to use STASM as a library from another project
  • *.cpp.diff: patches to correct some compilation errors in unix.



  • created CMakeLists.txt and tested on linux and mac


  • added comments of windows compilation
  • added support for STASM 4.1.0


  • tested and added changes proposed by Yuji Ojamada:
    • added tasm support
    • added testing
    • added patches to correct compilation errors:
      • compile with newer unix compilers (gcc and clang) in appmisc.cpp
      • added #if directives for MS and Linux (shapefile.cpp)
    • removed some particular examples added by Juan Cardelino
  • tested in newer platforms
  • improved documentation



  • Download STASM source code from:
  • uncompress it, for example to stasm4.1.0. I will refer to this directory as STASM_DIR
  • unpack the provided files to STASM_DIR
  • patch the source files:
    • cd STASM_DIR/apps
    • patch -p0 < appmisc.cpp.20140201.diff
    • cd STASM_DIR/apps/shapefile
    • patch -p0 < shapefile.cpp.20140201.diff
  • run cmake and generate a makefile: it is recommended to use a different build directory, in my case I will build into STASM_DIR/@build
  • enter STASM_DIR/@build and compile with make or your favorite IDE (tested with make and netbeans)
  • you will end up with the minimal and minimal2 examples compiled and a static library libstasm.a

Tested in the following platforms (64bits if not specified):

  • Linux:
    • Ubuntu 13.04, STASM 4.0.0, cmake, gcc 4.7.3, make 3.81, netbeans 7.3.1
    • Ubuntu 13.10, STASM 4.1.0, cmake, gcc 4.8.1, make 3.81, OpenCV 2.4.5
  • Mac
    • OSX 10.8, STASM 4.0.0, cmake 2.8.9, gcc-clang 4.2, make XX, netbeans 7.2
    • OSX 10.9, STASM 4.0.0, cmake 2.8.12, clang 5.0, make 3.81, OpenCV 2.4.7
    • OSX 10.9, STASM 4.1.0, cmake 2.8.12, clang 5.0, make 3.81, OpenCV 2.4.7
    • OSX 10.9.4, STASM 4.1.0, cmake 2.8.12, clang 5.1, make 3.81, OpenCV 2.4.9
  • Windows:
    • Windows 8 64bit, STASM 4.1.0, cmake 2.8.11, Visual Studio 10, OpenCV 2.4.2. Built on 32bits

Using STASM as an external library

Once STASM is compiled, you will end up with a dynamic or static library. You can use the sample project provided in the external directory as an example of how to integrate STASM into another application

In the external directory you will find and example about


  • In order to generate a proper windows dll (with exports) it is required to add some #defines. But it could work as is.
  • Extend windows testing (64 bits, VS11)


  • Stephen Milborrow: for kindly sharing his research and tools and for taking the time to answer everybody.
  • Juan Cardelino: maintainance and initial version
  • Yuji Ojamada: corrections and improvements