Tuesday, January 06, 2015

Compile Google Protocol Buffers On Oracle Linux

Google has released a lot of code as open source software. Free for download and free to use under different open source licenses. One of the software packages released is protobuf, protobuf is google's data interchange format. Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages – Java, C++, or Python.

When trying to compile RethinkDB on a Linux system you will notice that Protobuf is a prerequisite  and needs to be available. In general this is not an issue for most Linux distributions as you are able to download installation packages for it. However, when you do want to install it for Oracle Linux you will find that it is not available for Oracle Linux which leaves you with the source to compile which you need to compile to be able to use it.

As compiling is something which is generally not done by standard users and as Protobuf is something used primarily by developers do not expect everything to be as simple as you think. Some code hacking might be required to get the Google code working on your Oracle Linux machine.

During the first attempt I encountered a bug stating:
configure.ac:57: error: possibly undefined macro: AM_PROG_AR

After some hacking in the code it became clear that line 57 in configure.ac can be commented out when you encounter this issue. For some reason the macro is called and checked however not used in the rest of the code. After commenting out the line you can make and install the code without any issue.

Steps needed to get Protobuf working on Oracle Linux are the following:

1) Get the sourcecode from github.
$ git clone https://github.com/google/protobuf

2.a) Run autogen to automatically generate the config script
$ ./autogen.sh

2.b) If you run into the AM_PROG_AR issue open the configure.ac file and comment out the associated line

3)
run configure to prepare for make
$ ./configure

4)
Make the source code
$ make

5) check the make results
$ make check

6) install Protobuf
$ make install

By now you should have a completed installation of Google Protobuf. You will now be able to use it, in my case to compile the source from the RethinkDB project to create a RethinkDB instance on my Oracle Linux server.

Monday, January 05, 2015

Compile node.js on Oracle Linux

On a frequent basis new development techniques are developed, some get adopted and some do not. New programming languages are introduced and some become popular and some die in the first or second stage of their existence. Recently Node.js has been introduced and has seen a rapid acceptance, specially with back-end developers for mobile applications and web-based platforms who do have the need for strong API based solutions.

Node.js is an open source, cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux and FreeBSD.

Node.js provides an event-driven architecture and a non-blocking I/O API that optimizes an application's throughput and scalability. These technologies are commonly used for real-time web applications.

Installing Node.js can be done, for a number of Linux distributions via a package manager. Packages have been provided and installation is a painless task. For other distributions the installation of Node.js is a bit more complex as their is not a mainstream installation package available. For Oracle Linux their is no Node.js mainstream RPM available, this means that you will need to compile Node.js from source to make it available on your Oracle Linux server.

Ensuring you can use Node.js on your Oracle Linux server will take the following steps to complete:

1) Download the sourcecode
wget http://nodejs.org/dist/v0.10.35/node-v0.10.35.tar.gz

2) extract the downloaded sourcecode
tar zxf node-v0.10.35.tar.gz

3) decend into the new directory
cd node-v0.10.35

4) configure before compiling
./configure

5) make and install node.js
sudo make install

This should give you a fresh compiled version of Node.js on Oracle Linux. You can check if your compilation has succeeded by executing node with the --version option.