-
Notifications
You must be signed in to change notification settings - Fork 38
Build and Development Environment
EOS SDK lets you develop agents on any 32-bit Linux environments, making it easy to compile and test new programs. This is because the SDK is simply a collection of C++ header files. On a real switch or vEOS instance, the SDK, these headers are contained in the library libeos.so
, provided by the EosSdk.i686.rpm
extension. However, in your development environment, these headers are backed by stubbed-out functionality, free from any EOS-specific dependencies. Your agent builds against this stubbed-out library and produces a binary executable that, when copied to the switch, dynamically links against the full libeos.so
implementation.
This GitHub repository contains the entirety of the headers, stub implementation and examples. To develop against a specific version of the SDK, you can view and download a tarball from the releases page. We welcome improvements to stubs functionality, along enhancements to header comments and examples via pull requests. You can submit bug reports and suggestions through GitHub's issue tracker.
In order to compile C++ programs, you will need a 32-bit Linux system that has the following software installed:
Component | Minimum Version |
---|---|
g++ | 4.5.1 |
glibc | 2.13 (libc version 6) |
automake | 1.14 (minimum version supported) |
autoconf | 2.66 |
m4 | 1.4.14 |
These build tools are included with many distributions, including Ubuntu 12.04, Fedora Core 14, and Fedora Core 18. On Ubuntu systems, the build tools are included with g++-multilib
, while Fedora systems use libraries from the libgcc.i686
, glibc-devel.i686
, and libstdc++.i686
RPMs.
We recommend that users create a new (virtual) machine with one of these operating systems installed. Advanced users can cross-compile from a 64-bit environment to a 32-bit one, but instructions for that process are not included here.
Once you have a system that meets the above requirements, download the stubs tarball with the same version as the release of the EosSdk.i686.rpm
you plan on using. Then un-tar the package:
bash# tar xzf <SDK-stubs-version>.tar.gz
and run the build.sh
script, which will configure the build system and make the stub version of libeos.so
.
bash# cd <Newly-created-untarred-SDK-stubs-folder>
bash# ./build.sh
bash# sudo make install
The recommended set of flags when building your code can be found in build.sh
's CFLAGS
variable, and can be edited to include the compilation flags you prefer. Build output is saved in config.log
, and will show relevant information in case of a compilation error.
If you'd like to use the Python bindings, you will need SWIG installed. Then, invoke build.sh
with the --enable-python
flag:
bash# ./build.sh --enable-python
bash# sudo make install
bash# python -m "import eossdk; print eossdk.version"
1.3.1
The python bindings are already built and included with the EosSdk.i686.rpm
extension, so there is no need to transfer any of the generated SWIG files (like eossdk_wrap.cpp
).
After creating the library, you can build your agent:
bash# g++ -std=gnu++0x -o MyAgent MyAgent.cpp -leos
You may pass additional compilation flags to g++.
At this point, you now have a working C++ binary, and a real EOS agent! This binary can be unit-tested and even run locally, though it will do very little because the stubs implementation will not trigger many handlers. Once you copy to this executable to a switch with the extension installed, you can run the agent and have it link against the underlying SDK implementation.
Have a comment, question, or found a typo? Open an issue!