I have recently begun trying to write software to utilize the Analog Devices AD9361 transceiver in my petalinux application.
I have been able to successfully follow the instructions at https://github.com/analogdevicesinc/meta-adi/tree/main/meta-adi-xilinx to add in the meta-adi-core and meta-adi-xilinx user layers in the ncurses menu to bring the IIO kernel driver support for the AD9361 chip into the build.
After building and packaging, I then run the following commands:
petalinux-build –sdk
petalinux-package –sysroot
which creates the sysroot at myProject/images/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux
In this sysroot, the file iio.h has been added at usr/include, and the files (and symbolic links) libiio.so, libiio.so.0 and libiio.so.0.24 have been added at usr/lib.
At this point, I then write some code in my petalinux application to use the libiio to configure the AD9361 chip. This code contains the line:
#include <iio.h>
I can successfully build this petalinux application using Vitis, because I specified this sysroot (myProject/images/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux) when I created the platform project in Vitis.
Now, I am attempting to build the petalinux application using the petalinux tools, i.e. when I execute petalinux-build.
When I do this, the petalinux-build tool does not utilize the above sysroot. Instead, the petalinux tools adds the following flag to the compile command:
--sysroot=myProject/build/tmp/work/cortexa72-cortexa53-xilinx-linux/myApp/1.0-r0/recipe-sysroot
At this location, the usr/include directory does not contain the iio.h file and the usr/lib directory does not contain the libiio.so file.
Because these files are missing in this sysroot, petalinux-build fails when compiling the application code where it attempts to #include the iio.h file because it can’t find the file.
What do I need to do to make the petalinux tools generate the sysroot at this /build/tmp/… location to contain the iio stuff that the meta-adi user layers added? Do I need to specify it somehow in the myApp.bb file?