Building Erlang's C/C++ Client Libs Only

On a host which is going to be only an Erlang/OTP (Open Telecom Platform) C-node client, it may not be desirable nor even possible to build a complete release of OTP. It is not necessary to do so, either, if all you want is, say, libei.a and ei.h.

Here is a recipe for building only the C/C++ interface libraries from the OTP distribution. An optional patch is included to allow the use of transaction IDs with ei_rpc calls and improve select() on R9C-0. There are really only two major steps:

The following will install ei and erl_interface headers and libraries to prefix/lib/erlang/lib/erl_interface-3.4/include and to prefix/lib/erlang/lib/erl_interface-3.4/lib.

NOTE: The newer client library, with or without the patch provided, is compatible with older releases of OTP. So, by installing to unique destination, you can use the steps below to generate experimental C interface code without affecting other installed versions of OTP.

  1. Fetch the OTP distribution, for example from
  2. Extract the sources and set ERL_TOP.
    gtar -xzf .../otp_src_R9C-0.tar.gz
    cd otp_src_R9C-0
  3. Configure and set TARGET. Don't worry about switches for configure other than --prefix. Set TARGET to the name of the target configuration.
    sh configure --prefix=/usr/pkg  (or whatever)
    Doing "echo $TARGET" should now get you your system configuration, e.g. "i386-pc-solaris2.8".
  4. Export variables.
    export ERL_TOP TARGET
    cd lib/erl_interface
  5. Optional. Apply ei_connect.c patch.
    patch src/connect/ei_connect.c < .../ei_connect.c.patch
  6. Make the libraries. The message just before the end saying "Skipping subdir doc/src, it is missing" is benign.
    gmake opt
  7. At this point, you should have a good set of libs at $ERL_TOP/lib/erl_interface/obj/$TARGET. If you want, you can install them using the following, which leaves the headers and libraries at $RELEASE_PATH/lib/erlang/erl_interface-3.4/include and $RELEASE_PATH/lib/erlang/erl_interface-3.4/lib.
    gmake release RELEASE_PATH=/usr/pkg/lib/erlang

Now you are ready to talk to remote OTP nodes from C and C++. Remember to add the right CPP and ld options, e.g.

LDFLAGS="-L/usr/pkg/lib/erlang/erl_interface-3.4/lib \
         -R/usr/pkg/lib/erlang/erl_interface-3.4/lib -lei"