Skip to content
spyhunter99 edited this page Mar 4, 2018 · 3 revisions

The SIGAR master Git repository is hosted on and can be checked out using:

% git clone git://github.com/hyperic/sigar.git sigar.git

To use the stable branch:

% git checkout --track -b sigar-1.6 origin/sigar-1.6

The native library, Java JNI bindings and Java classes are built using the same build system which has the following requirements:

  • JDK 1.4 or higher 1.6.5 or higher
  • Ant
  • Perl 5.6.1 or higher
  • C compiler

Perl is required to generate much of the JNI code as well as many of the Java classes. The ant build system uses a modified version of cpptasks which works on all platforms supported by SIGAR. The native library can be used by the following languages:

  • C/C++
  • Java (sigar.jar auto-loads the native library)
  • Perl (requires bindings/perl build)
  • .NET C# (requires bindings/csharp build)
  • Ruby (requires bindings/ruby build)
  • Python (requires bindings/python build)
  • PHP (requires bindings/php build)
  • Erlang (requires bindings/erl build)

Note: The native library includes functions, however there are no JRE Java_org_hyperic_sigar_* dependencies for pure C/C++ applications using SIGAR. The Java JNI interface uses runtime linking and a function-pointer interface which allows us to combine both the C API and JNI sigar_ implementations into a single library. If this is not desirable, it would be trivial to have your own project build system simply compile and , then link the object files src/.c src/os/$osname/.c directly into your library or application.

Example Build

% cd hyperic-sigar-1.6.4-src/bindings/java
% ant
% ls -1 sigar-bin/lib
libsigar-universal-macosx.dylib
sigar.jar

Test using:

% java -jar sigar-bin/lib/sigar.jar test

Building on Windows

Rereqs:

  • cmake
  • Windows SDK and probably Visual Studio
  • Visual Studio C++ Build Tools

cmake -G "Visual Studio 15 2017 Win64" msbuild sigar.sln

Clone this wiki locally