How To Install B Compiler

Introduction

This part will teach you how install the B Compiler on your computer:

  • downloading and
  • compiling source files,
  • obtaining bcomp executable and static library.

Downloading

You can either:

  • download the latest development version by synchronizing with the Sourceforge subversion repository: https://bcomp.svn.sourceforge.net/svnroot/bcomp. You need to have a svn client installed on your computer. You can find here a comparison of existing subversion clients. For example, for Windows: Tortoise
  • or download latest packaged source files from Sourceforge B_COMPILER sources files. Unzip & unrar it in the directory you want to install in.

Source code organization

The B_COMPILER project is constituted of 5 directories  :

  • B_COMPILER : The most important directory. It contains all source files of the B Compiler, etc…
  • Doc : Contains 4 .pdf files which can help you to understand the B Compiler.
  • RESOURCES : library required for building B_COMPILER
  • FIND_SPEC : contain a sample project making use the B Compiler library
  • STUB_DECOMPILER : library required for building B_COMPILER

The file named « LICENSE GPL 3.0.txt », present in each directory with sources files, contain terms of the license used by BCompiler. For more informations, read it, or go to the official website
Each directory contains:

  • CMakeLists.txt, used by cmake (do not delete)
  • svn files, in order to be synchronize with others users
  • LICENSE GPL 3.0, who contain the term of the license, used by all BCOMP project

Building

To compile the source code and to generate both the bcomp executable and the bcomp library, you need the following:

  • CMake 2.6 or greater (available on [1]))
  • A C++ compiler. The following compilers should be able to compile the B Compiler:
    • MinGW/MSYS (windows)
    • g++ 3.x/4.x (linux). The default compilers of ubuntu 6.06, 7.10 and 8.04 have been tested
    • Xcode 2.5 or greater (mac os X). Older versions may work, but have not been tested
    • Other C++ compilers may work, but have not been tested

The default build process uses cmake. Make sure that your C++ compiler is accessible through you PATH environment variable.

  • cd to the directory containing this README.txt (you can also create another directory to hold the build files. In that case, you will have to specify the directory containing this readme to cmake)
  • Use the following command to generate Makefiles/IDE projects
    • cmake -G « MinGW Makefiles » to generate project files for MinGW
    • cmake -G « MSYS Makefiles » to generate project files for MSYS
    • cmake -G « Unix Makefiles » to generate makefiles for compiling with g++
    • cmake -G Xcode to generate Xcode project files
  • Depending on the compiler, type « make » or open the IDE files in your IDE

Below are the traces of execution of the compilation process on Windows/MinGW:

D:DEVTOOLSbcomp>cmake -G "MinGW Makefiles"
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/DEV/TOOLS/bcomp
D:DEVTOOLSbcomp>make
Scanning dependencies of target STUB_DECOMP
[  0%] Building CXX object STUB_DECOMPILER/CMakeFiles/STUB_DECOMP.dir/stub.obj
Linking CXX static library libSTUB_DECOMP.a
[  0%] Built target STUB_DECOMP
Scanning dependencies of target RES
[  1%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_trace.obj
[  1%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_mark.obj
[  2%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_string.obj
[  3%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_item.obj
[  3%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_line.obj
[  4%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_file.obj
[  4%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_comm.obj
[  5%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_resour.obj
[  6%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_tool.obj
[  6%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_mana.obj
[  7%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_synt.obj
[  8%] Building CXX object RESOURCES/CMakeFiles/RES.dir/p_api.obj
Linking CXX static library libRES.a
[  8%] Built target RES 
Scanning dependencies of target BCOMP
[  8%] Building CXX object B_COMPILER/CMakeFiles/BCOMP.dir/c_trace.obj
[  9%] Building CXX object B_COMPILER/CMakeFiles/BCOMP.dir/c_port.obj
...
[ 96%] Building CXX object B_COMPILER/CMakeFiles/BCOMP.dir/tinyxmlerror.obj
[ 97%] Building CXX object B_COMPILER/CMakeFiles/BCOMP.dir/tinystr.obj
Linking CXX static library libBCOMP.a
[ 97%] Built target BCOMP
Scanning dependencies of target BCOMP_EXE
[ 98%] Building CXX object B_COMPILER/CMakeFiles/BCOMP_EXE.dir/bcomp.obj
[ 98%] Building CXX object B_COMPILER/CMakeFiles/BCOMP_EXE.dir/c_auto_test.obj
Linking CXX executable bcomp.exe
[ 98%] Built target BCOMP_EXE 
Scanning dependencies of target find_spec
[ 100%] Building CXX object FIND_SPEC/CMakeFiles/find_spec.dir/t_fspec.obj
Linking CXX executable find_spec.exe
[ 100%] Built target find_spec