Building OpenCog

From OpenCog
Jump to: navigation, search

GNU/Linux is the primary development platform for OpenCog. The reference configuration used for continuous integration is Ubuntu, starting from 14.04. Although OpenCog should be compatible with any GNU/Linux distribution, Ubuntu is the recommended platform for development.

Setting Development Environment

These are options for setting development environment for working on opencog and it's subprojects.

GNU/Linux

Manual

If you prefer to manually install opencog and its dependencies, jump directly to the Building Section, and install whatever library CMake complains about. The only mandatory library is boost, the others depend on the projects and components that you wish to build.

Otherwise, for automatic installation, follow the instructions below.

Automatic

Ubuntu

For a quick start using Ubuntu version >= 14.04, use octool script.

  • get it by running
wget https://raw.githubusercontent.com/opencog/ocpkg/master/ocpkg -O octool && chmod +rx octool
  • Options that are available can be displayed by running
./octool -h
  • To install all dependencies necessary to build OpenCog run
./octool -rsdpcalv
  • To install all dependencies necessary to build AtomSpace and MOSES run
./octool -rdcv
# Optional: For atomspace add -s for installing dependencies for haskell binding.
  • To install all dependencies necessary to build Cogutil run
./octool -rdv
Raspbian

For a quick start using Raspbian OS on RPI3 board, use octool_rpi script.

  • get it by running
wget https://raw.githubusercontent.com/opencog/ocpkg/master/octool_rpi.sh && chmod +rx octool_rpi.sh

The script is suppose to run both on the cross-compiling PC and the RPI3 running Raspbian. More info here

  • To Install base dependencies and install opencog with pre-compiled binaries (it may be outdated) on RPI3 running Raspbian
./octool_rpi.sh -do
  • To cross compile on a much larger computer. This option cross-compiles opencog along with its dependencies (cogutil and atomspace) and creates a debian package.
./octool_rpi.sh -tc

For building opencog or updating it's dependencies scroll to the sections below

Other GNU/Linux Distributions

On systems that have other GNU/Linux OS installed, use the appropriate script for installing system dependencies. Distros which have dependency installation scripts are,

Virtual Machine

For using Ubuntu in virtual machine managed by vagrant for https://github.com/opencog/opencog repo, first install the tools for your os and then follow instruction below under Run Vagrant.

Windows setup

Mac setup

Linux setup

Install VirtualBox, git and vagrant. See here on instructions on vagrant installation.

Run Vagrant

The virtual machine created has all the dependencies required for working on cogutils, atomspace, moses, and opencog.

If you are new to vagrant, see https://www.vagrantup.com/docs/why-vagrant/ or https://www.vagrantup.com/docs/getting-started/ if you like to understand what vagrant is. Understanding the working of vagrant is not required for contributing to opencog.

The common steps after installing VirtualBox, git and Vagrant for your os and running a bash(on windows use the equivalent powershell commands) shell are:

mkdir opencog_repos
cd opencog_repos
git clone https://github.com/opencog/opencog

# You can clone other repos if you so choose

ln -s $PWD/opencog/lib/Vagrantfile Vagrantfile
vagrant up
vagrant ssh

# The folder from which your run 'vagrant up' is accessiable at
# '/home/vagrant/opencog' on sshing into the virtual machine.

# Do your thing

exit
vagrant halt


For building opencog or updating it's dependencies scroll to the sections below

Containers

For using containers managed by docker, follow instructions here.

For building opencog or updating its dependencies scroll to the sections below

Other OS

Building

Build OpenCog using the following commands after moving to the root of the three cloned directories (cogutil, atomspace, optionally moses, and opencog, in that order) or the corresponding directories in your vagrant/docker setup:

mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install

If you are using octool from the git clone directory, run

./octool -b

Updating Dependencies

To update your opencog's sub-project installations(cogutil, link-grammar and atomsapce), as they are in a continues state of development, you will need to run these series of commands, once/multiple times a week/day depending on what type of fun you are having with opencog, from your git clone.

If you are using octool, run

./octool -cal

Persistance

For backing up contents of an atomspace

PostgreSQL

See instructions here

  • If you are using octool then use -rd option for installing dependencies.
  • If you are using docker full configuration are done for you.