[odb-users] Add --sysroot support to ODB compiler
Stath Paul
pstath at axxcelera.com
Fri Mar 8 14:11:21 EST 2013
Boris --
> You can instruct the ODB compiler to pass any option to GCC by
> prefixing
> it with -x:
>
> odb -x --sysroot=/path ...
I had missed the -x option on my initial read-through of the command line arguments for ODB.
However, I'm now running into a different error.
I'm getting:
# error ODB and C++ compilers see different libodb-boost interface versions
Adding back the "-I <sysroot>/usr/include" argument again allowed the ODB command to generate
The database access classes.
Looking onto the odb.cxx code, it appears that in the profile_paths() method, you
determine the default search libraries by running the C preprocessor with the -v option.
Then scan the output to obtain the search directories.
( Essentially: c++ -v -E -P - < /dev/null" | sed -n '/^#include <\.\.\.>/,/^End of search list/p' )
When invoking this command, you pass though any "-I" arguments, as well as "-isystem", "-iquote",
"-idirafter" or "-framework".
I believe that passing through the "--sysroot" argument is also required, since "--sysroot" effects
the default search path.
I'm also unsure if the compiler is always "c++", or might be modified by "-x /path/to/gcc/non-installed-g++".
There seems to be some fragility with parsing the "c++ -v -E -P - < /dev/null" output. (NLS, possible change or message by GCC, etc.)
Since you already have a plug-in, would it be possible to have it obtain the gcc search path from GCC and
output it in a fixed, easy to parse format that is under your control?
Something like:
$ g++ -E P - -fplugin=<odb.so> -fplugin-arg-odb-print=searchpath
./include
/usr/lib/gcc/i686-linux-gnu/4.6/include
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
/usr/include
-- Paul
More information about the odb-users
mailing list