title: How to cross-compile omniORB 4 (on x86_64 for ARM with omniORB 4.1.6)
body: <p>omniORB 4 uses an Autoconf configure script to support configuration of the build system. Many configure scripts support cross-compiling with the use of the <code>--host</code> and <code>--build</code> flags. Unfortunately, omniORB explicitly states in their <code>README.unix</code> file that cross compiling is not supported.</p>
  
  <blockquote>
    <p>The Autoconf build does not currently work for cross compiling.</p>
  </blockquote>
  
  <p>Here's what happens when you do try to use the <code>--host</code> and <code>--build</code> Autoconf flags: </p>
  
  <p>Environment:</p>
  
  <ul>
  <li><code>PATH</code> set to include the cross-compilation tools</li>
  <li><code>CPPFLAGS</code> set to include the ARM sysroot/include folder <code>-I.../sysroot/include</code></li>
  <li><code>LDFLAGS</code> set to include the ARM sysroot/lib folder <code>-L.../sysroot/lib</code></li>
  </ul>
  
  <p><em>Note: I use three dots (...) to omit parts of file paths or unimportant output.</em></p>
  
  <pre><code>$ pwd
  .../omniORB-4.1.6
  $ mkdir build
  $ cd build
  $ ../configure --build=x86_64-linux-gnu --host=arm-linux-gnueabihf
  ...
  $ make
  ...
  omniidl: ERROR!
  
  omniidl: Could not open IDL compiler module _omniidlmodule.so
  omniidl: Please make sure it is in directory .../omniORB-4.1.6/build/lib
  omniidl: (or set the PYTHONPATH environment variable)
  
  omniidl: (The error was '.../omniORB-4.1.6/build/lib/_omniidlmodule.so: wrong ELF class: ELFCLASS32')
  ...
  </code></pre>
  
  <p>I believe the important message there to be <code>wrong ELF class: ELFCLASS32</code>. I inspected this shared object library with <code>file</code>.</p>
  
  <pre><code>$ file lib/_omniidlmodule.so.4.1
  lib/_omniidlmodule.so.4.1: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, ...
  </code></pre>
  
  <p>So it appears the build system builds this shared object module for use by omniidl during the omniORB build. The issue is that it is built for ARM, and cannot be used on the host system.</p>
  
  <p>How can I cross-compile omniORB given the lack of support from their build system?</p>