How to cross compile omniORB

This HowTo gives details on how you can cross compile omniORB

When used with C++ or Python, Tango requires the omniORB librairies. Depending on the hardware on which you want to run Tango device server or client, it is sometimes needed to cross-compile Tango and therefore to cross compile omniORB. omniORB is distributed as a set of CORBA idl and cpp files. When you build omniORB, the idl files are compiled by a CORBA IDL to C++ compiler before they are sent to a classical C++ compiler with the set of cpp files in order to build the libraries. This is represented in the following figure


From this figure it is easay to understand that the first thing which is done when you build omniORB is to build the IDL to C++ compler which will be used in the following build steps. When you cross-compile omniORB, you provide to the configure command line the path to the C++ and C compilers for the target hardware (CXX=path_to_target_cpp_compiler and CC=path_to_target_C_compiler). If you don't take special care, omniORB build system will create the IDL to C++ compiler using these tools and it will generate an executable for your target host which will obviously not run on your compilation host. If for instance, you cross compile omniORB on a x64 host for a ARM CPU, the IDL to C++ compiler will be created for the ARM architecture and will certainly not run on your x64 host.

Here are what you have to type to correctly cross-compile omniORB:

tar xjf $(TOP)/omniORB-4.1.7.tar.bz2
cd omniORB-4.1.7
mkdir build
cd build
../configure --prefix=/opt/tango/orb/omniORB-4.1.7/arm 

When the configure command is run, the CC and CXX variables define the target architecture C and Cpp compilers. the configure host option defines the target architecture while the build option defines the architecture on which the cross compilation is done.

We now need to build the IDL to Cpp compiler

with the local compilers

make CC=gcc-4.7 -C src/tool/omniidl/cxx/cccp
make CXX=g++-4.7 -C src/tool/omniidl/cxx
make CC=gcc-4.7 -C src/tool/omkdepend

There are some small changes required in the omniORB build system: Edit file in following directories:

  • omniORB-4.1.7/src/appl/omniMapper/
  • omniORB-4.1.7/src/appl/omniNames/
  • omniORB-4.1.7/src/appl/utils/catior/
  • omniORB-4.1.7/src/appl/utils/convertior/
  • omniORB-4.1.7/src/appl/utils/genior/
  • omniORB-4.1.7/src/appl/utils/nameclt/

to find the definition @(libs="$(CORBA_LIB_NODYN)"; $(CXXExecutable)) and replace it by @(libs="$(CORBA_LIB_NODYN) -lstdc++"; $(CXXExecutable))


Then finally build the omniORB libs

sudo make install

 The  omniORB Wiki and experiments done by ESRF colleagues have been used to write this HowTo.