1

I'm trying to write BitBake unixodbc, postgresql, and psqlodbc recipes for ARM platform, to integrate with Yocto Project. First of all, I wrote custom BitBake recipes for unixodbc and postgresql. These recipes build and package libs and bins for the ARM platform, as expected.

Now I'm trying to write a recipe for the Official ODBC driver for PostgreSQL (psqlodbc). The psqlodbc configure task needs a "odbc_config" tool (--with-unixodbc flag) compiled for native (x86) platform to execute do_configure task fine. That "odbc_config" tool is built by my custom unixodbc recipe for the ARM platform (as expected), but not for the native platform (x86):

$ file /path/to/tmp/work/armplatform/unixodbc/2.3.1-r0/image/usr/bin/odbc_config /path/to/tmp/work/armplatform/unixodbc/2.3.1-r0/image/usr/bin/odbc_config: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=06728a67598eca297d7dcf83cf15a020c74d11ce, not stripped

The problem is when my psqlodbc recipes tries to use "odbc_config" generated by my unixodbc recipe, task do_configure fails with this ERROR message:

/path/to/tmp/work/armplatform/psqlodbc/09.03.0210-r0/psqlodbc-09.03.0210/configure: line 4272: /path/to/tmp/work/armplatform/unixodbc/2.3.1-r0/image/usr/bin/odbc_config: cannot execute binary file: Exec format error

How should this situation be properly managed with BitBake recipes?

Charles C.
  • 3,725
  • 4
  • 28
  • 50
aicastell
  • 2,182
  • 2
  • 21
  • 33
  • 1
    FYI, you do not need to write custom recipes for unixodbc, and postgresql, they are available on [Openembedded layer index](http://layers.openembedded.org/layerindex/branch/master/recipes/?q=ODBC). Maybe this will fix your `Exec format error` – Charles C. Mar 07 '16 at 23:35
  • I'm doing this task for educational purposes, however the URL provided has been useful because I haven't found this information googling and it clarifies some concepts a lot. Thank you for sharing! – aicastell Mar 08 '16 at 16:24

1 Answers1

2

After analyzing the link provided by LightenS (thank you!), I have understood the proper way to manage my problem. The key issue was to define this variable into my unixodbc recipe:

BBCLASSEXTEND = "native nativesdk" 

After doing that, you can build this unixodbc recipe variant:

$ bitbake nativesdk-unixodbc

This generates odbc_config binary to run on the MACHINESDK platform. After that you can customize psqlodbc recipe configuration with this:

EXTRA_OECONF += " \ 
    --with-sysroot=${STAGING_DIR_TARGET} \
    --with-unixodbc=${STAGING_DIR_NATIVE}/usr \
    --enable-shared \
"

Where --with-unixodbc points the native (x86) binary of odbc_config and --with-sysroot points to the target sysroot. This will be enough to build the package for the psqlodbc recipe properly.

aicastell
  • 2,182
  • 2
  • 21
  • 33