Using the Command Line Recall that earlier the manual discussed how to use an existing toolchain tarball that had been installed into /opt/poky, which is outside of the Yocto Project build tree (see the section "Using an Existing Toolchain Tarball)". And, that sourcing your architecture-specific environment setup script initializes a suitable cross-toolchain development environment. During the setup, locations for the compiler, QEMU scripts, QEMU binary, a special version of pkgconfig and other useful utilities are added to the PATH variable. Variables to assist pkgconfig and autotools are also defined so that, for example, configure.sh can find pre-generated test results for tests that need target hardware on which to run. These conditions allow you to easily use the toolchain outside of the Yocto Project build environment on both autotools-based projects and Makefile-based projects.
Autotools-Based Projects For an Autotools-based project, you can use the cross-toolchain by just passing the appropriate host option to configure.sh. The host option you use is derived from the name of the environment setup script in /opt/poky resulting from unpacking the cross-toolchain tarball. For example, the host option for an ARM-based target that uses the GNU EABI is armv5te-poky-linux-gnueabi. Note that the name of the script is environment-setup-armv5te-poky-linux-gnueabi. Thus, the following command works: $ configure --host=armv5te-poky-linux-gnueabi \ --with-libtool-sysroot=<sysroot-dir> This single command updates your project and rebuilds it using the appropriate cross-toolchain tools. If configure script results in problems recognizing the --with-libtool-sysroot=<sysroot-dir> option, regenerate the script to enable the support by doing the following and then re-running the script: $ libtoolize --automake $ aclocal -I ${OECORE_NATIVE_SYSROOT}/usr/share/aclocal \ [-I <dir_containing_your_project-specific_m4_macros>] $ autoconf $ autoheader $ automake -a
Makefile-Based Projects For a Makefile-based project, you use the cross-toolchain by making sure the tools are used. You can do this as follows: CC=arm-poky-linux-gnueabi-gcc LD=arm-poky-linux-gnueabi-ld CFLAGS=”${CFLAGS} --sysroot=<sysroot-dir>” CXXFLAGS=”${CXXFLAGS} --sysroot=<sysroot-dir>”