How to clone a project for the ML Librarified version and configure it to compile

V 2.0 of proto-runtime is known as the "ML" or Multi-Lang version. Two revisions exist, the first is built as one complete code base that includes proto-runtime, the language wrapper library and plugin, and the application. The second revision breaks the code up into separate shared libraries. This version is a bit slower do to the nature of PIC (position independent code), which calculates variables as offsets from the program counter, and uses trampoline code to call a function.

Hence, PRT-MLLib is the name of the shared library revision. Here we describe the organization of projects based on PRT-MLLib and describe how to get the libraries and connect them together inside netbeans and the Linux environment.

The code bases have no makefile, but rather are intended to be imported as a project into Netbeans, Eclipse, or a similar IDE which auto-generates the makefile. The developers of proto-runtime use netbeans, so the wiki pages all give instructions for setting up netbeans projects.

A PRT-MLLib project is organized as a number of separate projects, one project for the application code, and separate projects for each library. The top-level repo automatically gets and updates the child repositories. The child repositories are one of: direct application code, or static library source, or dynamic library source. The repositories for all libraries are included in the project so that debugging has the source available, and the developer can step through library code, jump to definitions, and so on. The top level directory is the overall "project repository", which has a .hgsub file that defines where all the other repositories reside in the directory structure.

The developer clones the top-level project repository, which then automatically clones the sub-repositories, then updates to the version of them that builds the project correctly.

Cloning the Source

To clone a project, browse the repositories at hg.opensourceresearchinstitute.org. The top level project repositories for PRT-MLLib all begin with: PR/PR_Projects/PR__MLLib__MC_sharedMem__Projects/ Once you choose a project, click on it, then copy the URL.

If you just want to run the project, but not contribute revisions back to the repository, then paste the URL into your "hg clone <URL>" command, or into the appropriate field of the TortoiseHg diaglog for clone. However, if you wish to modify the code and contribute the revisions back, use ssh to clone the project, as described here.

Once the project is cloned, the root directory should have a file of the pattern "__brch__<nameOfBrch>".. normally "__brch__default". See branch naming for more on the naming of branches. If you want a different branch, update to it. Even if you want to stay on the default branch, be sure the top-level project repository is updated to the most recent version on that branch. (Tortoise workbench is a nice tool for browsing repositories and seeing the branches and versions). At this point, the source is ready to be imported into an IDE and the project compiled and run.

Importing into IDE and Compiling

The standard tool for proto-runtiem development is netbeans. To get it, download from netbeans.org. Be sure to get the version that has C/C++ development. Once installed and running, here are some notes on setting up the netbeans project:

  • In netbeans, to import the code, do not use the intuitive "New project with existing files". Rather, instead either use the File menu or right-click in the project tab and select "New Project" then "C/C++ Application". This brings up a dialog, in which one can choose the location and name of the directory holding the netbeans project info and the build. The directory can be placed anywhere, and named anything. However, the standard PRT process is to put the netbeans project file into the top level directory of the project repository, as a sibling of the ".hg" and "src" folders. The project repo already contains a ".hgignore" file that makes sure the netbeans directory is not included in the repository.

Be sure to uncheck the "Create Main file" checkbox. If you forget, the file "main.cpp" will be placed in the top netbeans project directory and you'll have to delete it. After project creation is complete, it should appear in the project tab. Select the project, expand it and select the "Source Files" and right-click on it.. in the menu select "add existing items from folder", and navigate to the project directory, and choose the "src" directory. That imports all the source code into the netbeans project.

  • Most of the sub-repositories are the source code of libraries, so the netbeans project has to be pointed at the ".a" and ".so" files. directories have to be set up for the project. Right click on the project name (not the "Source Files") and select "properties", which brings up a dialog. In that, expand the "Build" bullet and select "C compiler". Under this, click on the "..." to the right of "include directories", which brings up a dialog box. In the dialog, click "add", navigate to the src folder, expand it, and select the "C_Libraries" directory. Repeat for the "VMS_Implementations" directory and the "src" directory itself. The reason for this is to treat each of the separate repositories as static libraries, so that none of them assume the directory structure.
  • Lastly, click on the "Linker" bullet, then the "..." to the right of "Libraries". This brings up a dialog box, click on "add standard library" button and choose "posix threads" and then repeat for "mathematics".

If you experience odd compilation errors, chances are there is an issue with the revisions that the repositories are updated to. Double checking that you're updated to the branch of the project you want, and that the sub-repositories are on the latest revision.

  • To get a project to run, there are often configuration files or other forms of input needed. Check the notes for the particular project to get the names and paths of these input files. They will all appear in the repository, and netbeans will always need to be configured to have the root of this repository be the working directory. This page says how to get the repo and configure netbeans.