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

Boris Kolpackov boris at codesynthesis.com
Thu Mar 7 14:03:48 EST 2013


Hi Paul,

Stath Paul <pstath at axxcelera.com> writes:

> 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.

The ODB compiler doesn't add this directory so it must have come from
GCC, which could mean GCC wasn't configured properly (i.e., the 
--with-sysroot option wasn't specified).


> 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.

You can instruct the ODB compiler to pass any option to GCC by prefixing 
it with -x:

odb -x --sysroot=/path ...


> 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.)

I believe that would work as well since ODB doesn't use the -I values
itself, it just passes them as is to GCC.

Also it would be a pain to specify --sysroot in every invocation so 
another thing that you may find useful is support for the default 
options file (see the --options-file option documentation for the
format). When configuring ODB, you can use the --with-options-file
option to specify the path to the default options file which the ODB
compiler will read automatically. This path can be absolute (e.g.,
/etc/odb/default.options) or relative (e.g., ../etc/odb/default.options).
If it is relative, then it is resolved based on the ODB compiler
executable directory (e.g., /usr/bin).

If you build ODB with support for the default options file, then it 
would seem natural to place the --sysroot option there.

Boris



More information about the odb-users mailing list