[yocto] How to reference /usr/include

Mark Hatle mark.hatle at windriver.com
Sun Feb 20 07:03:53 PST 2011


On 2/19/11 6:13 PM, Chris Tapp wrote:
> I'm trying to make a simple recipe that uses libxml. However, the  
> headers for this are in libxlm2/libxml, so I need to add an include  
> path.
> 
> I can get this to work using an absolute path, as shown below:
> 
> do_compile() {
>     ${CC} -I/usr/include/libxml2 helloworld.c -o helloworld
> }

When compiling and using things like above you want to use "-I=/usr/include/libxml2"

The = tells the compiler to use the sysroot prefix as well as what was specified.

Note, NOT ALL VERSIONS OF THE COMPILER SUPPORT THIS!  The version in Yocto does,
and I believe most recent versions of the GNU compiler.

(If no sysroot is defined, say for a host binary "=" simply evaluates to nothing.)

The same syntax is supported for linking, so you can (and should) use
-L=/usr/lib/libfoo.so.  This syntax is much older, so all modern versions of
bintutils support it properly.

> However, this isn't good as it uses /usr. How should I do this? I've  
> tried to find a ${...} to use, but I've not found anything that works.
> 
> Chris Tapp
> 
> opensource at keylevel.com
> www.keylevel.com
> 
> 
> 
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto




More information about the yocto mailing list