GitHunt
LI

linas/cogutils

Very low-level C++ programming utilities used by severa components

OpenCog Utilities

CircleCI

The OpenCog utilities is a miscellaneous collection of C++ utilities
use for typical programming tasks in multiple OpenCog projects.
These include:

  • thread-safe queues, stacks and sets
  • asynchronous method caller
  • thread-safe resource pool
  • thread-safe backtrace printing
  • high-performance signal-slot
  • random tournament selection
  • OS portability layers.

The main project site is at http://opencog.org

Status

Version 2.2.1. Notable changes since January 2025:

  • Enhanced barrier support for async_buffer: every worker can be
    given the barrier message, thus synchornizing all workers.
  • Replacment of (minor) busy-waits by c++-20 std::atomic::wait()
    This reduces latency during congestion and improves performance.
  • Remove all dependency on boost. Unfortunately, boost causes more
    headaches than it solves, and just making it obsolete works best.
  • Removal of a large number of unused, stale files and functions.
    Decades of work allowed arcane cruft and litter to accumulate.
    That has been removed. Assorted single-user files have been moved
    to that single user (almost entirely to as-moses; some to miner)

Prerequisites

To build the OpenCog utilities, the packages listed below are required.
With a few exceptions, most Linux distributions will provide these
packages. The Docker containers located at
https://github.com/opencog/docker
simplify the entire install and build process, and casual users are
encouraged to try those first.

cmake

Build management tool; v3.12 or higher recommended.
http://www.cmake.org/ | cmake

cxxtest

Unit test framework
https://cxxtest.com/ | apt-get install cxxtest

Optional Prerequisites

The following are optional, but are strongly recommended, as they result
in "pretty" stack traces, which result in far more useful and readable
stack traces. These are requires, and not really optional, if you are
a regular OpenCog developer.

binutils BFD library

The GNU binutils linker-loader, ahem, cough, "Binary File Description".
http://gnu.org/s/binutils | binutils-dev
The linker-loader understands calling conventions.

iberty

The GNU GCC compiler tools libiberty component.
http://gcc.gnu.org | libiberty-dev
The GCC compiler, and iberty in particular, know stack traces.

doxygen

Documentation generator under GNU General Public License
http://www.stack.nl/~dimitri/doxygen/ | doxygen
Generates code documentation

Building Cogutil

Perform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake ..
    make

Libraries will be built into subdirectories within build, mirroring the
structure of the source directory root.

Unit tests

To build and run the unit tests, from the ./build directory enter (after
building opencog as above):

    make check

Install

After building, you MUST install the utilities!

    sudo make install

Languages

C++52.4%CMake38.5%Python4.6%C2.9%Shell1.7%GDB0.0%
Other
Created April 27, 2015
Updated December 21, 2025
linas/cogutils | GitHunt