Cross compiling omniORB
Cross compiling omniORB poses several problems, some of them having conceptual roots. I created this page after trying to cross compile debianized omniorb4/omniidl4 for ARM on x86 host, and having spent almost 2 days on this.
Skipping all the gory details etc., there are actually 2 major problems:
omniORB compiling is unfortunately a bootstrapped process. Indeed, first it builds omniidl and then uses it to build the rest of omniorb. Of course, in case of x86->ARM compiling, all binaries (e.g. _omniidlmodule.so.1.0) are for ARM platform/ABI and you can't directly execute them.
omniidl (in fact the corresponding platform's _omniidlmodule.so.1.0) has some arcane knowledge about what's appropriate for ARM and what's for x86 (like e.g. HAS_LongDouble), and thus you can't just execute x86's omniidl to produce headers for ARM.
Here comes the solution:
First, you must have basic working x86->ARM cross-compile environment, for example:
plus additional libraries, like:
Solution for x86->ARM compiling omniORB
The described method has been successfully applied to compile omniORB 4.0.7 & 4.1.2.
1. configure for ARM:
$ make clean $ ./configure CC=arm-linux-gcc-3.4 CXX=arm-linux-g++-3.4 \ --host=arm-linux \ --build=i386-linux
You might have to adapt both --host and --build. The host option can be obtained from the prefix used to name the gcc binaries of your cross compiler toolchain. The build option is clearly indicated in the output log of a ./configure command (passing no options). I (NL) used the following:
2. build x86->ARM omnicpp:
$ make CC=gcc-3.4 -C src/tool/omniidl/cxx/cccp
3. build x86->ARM omniidl:
$ make CXX=g++-3.4 -C src/tool/omniidl/cxx
4. build x86->ARM omkdepend:
$ make CC=gcc-3.4 -C src/tool/omkdepend
5. build rest of omniorb:
In order to fix a link error in the compilation of the omniORB applications (src/appl/omniNames, src/appl/omniMapper, src/appl/utils/...), I (NL) had to manually add the stdc++ library. For each application, I edited its associated dir.mk file and did the following change:
@(libs="$(CORBA_LIB_NODYN)"; $(CXXExecutable)) -> @(libs="$(CORBA_LIB_NODYN) -lstdc++"; $(CXXExecutable))
A quite ugly hack isn't it? I don't know how to do this in a more generic manner. Sorry!
6: re-build omnicpp and omniidl for ARM [optional unless you want to use omniidl on the target]:
$ rm -f lib/_omniidlmodule.so* lib/omnicpp $ make -C src/tool/omniidl/cxx clean $ make -C src/tool/omniidl/cxx $ make
P.S. Note that I have explicitly specified version for both native and cross gcc/g++, otherwise you may face problems like for e.g. native gcc 3.3 vs. cross gcc 3.4 and -fno-unit-at-a-time option.