[odb-users] Add --sysroot support to ODB compiler

Stath Paul pstath at axxcelera.com
Thu Mar 7 12:41:43 EST 2013


Boris--

I'm attempting to build my application in an a cross-compilation environment.  (Yocto / Open-Embedded)

When I invoke the ODB compiler in my cross-compile scenario, I get the error

<standard-odb-prologue>:4:4 error: #error incompatible ODB compiler and runtiume versions

The command being run by make is:

/home/pstath/yocto/poky/build/tmp/sysroots/i686-linux/usr/bin/odb --database sqlite --std c++11 --profile boost --generate-schema --schema-format sql -I.. -I../crypto/inc --hxx-suffix .hpp --ixx-suffix .ipp --cxx-suffix .cpp --generate-query --generate-session --show-sloc --sloc-limit 10000 row_status.hpp

This occurs because the ODB command does call out the default '-I/usr/include' which is where version.hxx (from a different libodb) is being found.

If I add '-I/home/pstath/yocto/poky/build/tmp/sysroots/i686-linux/usr/include' to prepend the '/usr/include' directory for my cross-compile environment, the correct version of '<odb/version.hxx>' is found and used.

/home/pstath/yocto/poky/build/tmp/sysroots/i686-linux/usr/bin/odb --database sqlite --std c++11 --profile boost --generate-schema --schema-format sql -I/home/pstath/yocto/poky/build/tmp/sysroots/i686-linux/usr/include -I.. -I../crypto/inc --hxx-suffix .hpp --ixx-suffix .ipp --cxx-suffix .cpp --generate-query --generate-session --show-sloc --sloc-limit 10000 row_status.hpp

While the above works, I believe it would be more elegant to have the ODB command accept the '--sysroot=<path>' argument with the same logic that GCC applies to --sysroot.
It would also be convenient if the '-I<dir>' argument would allow for a leading '=' character at the beginning of <dir> to replace the sysroot prefix. (per. The GCC man page.)

Please let me know your thoughts, or if you have a better work-around than using the "-I<alt-sysroot>/usr/include" argument.

-- Paul






More information about the odb-users mailing list