Reputation: 2402
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?
Upvotes: 1
Views: 1407
Reputation: 2402
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.
Upvotes: 2