Library Compilation

Petalinux root file system configuration allows to the user select which libraries will be compiled in the build process.
$petalinux-create -t project -s <path-to-BSP> -n petalinux
$cd petalinux
$petalinux-config -c rootfs
.....
$petalinux-build
libs 1.JPGlibs2.JPG
Once the libraries are compiled, the libs and header files are deployed within the build directory, in the sysroot folder.
libs 3.JPG

Library Usage on SDK

When a Linux targeted application is created in the SDK, the wizard menu allows to set your own sysroot folder rather than the default one included in the installation directory. This will add the usr/include path within the sysroot folder, into the compiler include options as well as lib and usr/lib paths into the linker options.

libs 4.JPGlibs 5.JPG

Note: In the release 2017.1 and bellow there is a well known issue where the linker configuration does not include the --sysroot option.
libs 6.JPG

Above there are some examples of applications using libraries compiled in a petalinux project

Libxml2

Test application from xmlsoft.org compiled in the SDK.
libs 7.JPGlibs 8.JPG

zlib

Test application from zlib.net compiled in the SDK.
libs 10.JPG

Related Links

  • Title 1 & Link 1
  • Title 1 & Link 1