Adding Third Party Libraries To The Cross-Compiler

Use the following sequence of steps to add third-party library to your cross-compiler. It applies to any libraries, from simple independent libraries with one module (like WiringPi) to large multi-module libraries with subdependenties (e.g. OpenCV).

  • Make sure you are using Raspbian, Pidora or other hardfp-enabled Linux version for Raspberry Pi. If you are using softfp-enabled Linux on RPi, replace all instances of "arm-linux-gnueabihf" with "arm-linux-gnueabi" below.
  • Log in to Rasberrpy Pi via SSH protocol (e.g. using PuTTY software), enter root shell using the following command:
    sudo bash
  • Save list of all files in filesystem:
    find / > /root/all_files_before
  • Install/compile your library on Raspberry Pi usual way:
    apt-get install ...
    or
    cd ~
    tar zxf ...
    cd ...
    ./configure ...
    make
    make install
  • Save list of all files in filesystem:
    find / > /root/all_files_after
  • Upload /root/all_files_before + /root/all_files_after files to Windows environment and compare them using WinMerge or other similar tool. In such way, derive list of files related to your library.
  • Copy lib*.a, lib*.so files (related to your library) from /lib to %CROSS_COMPILER_DIR%\arm-linux-gnueabihf\lib
  • Copy lib*.a, lib*.so files (related to your library) from /usr/lib to %CROSS_COMPILER_DIR%\arm-linux-gnueabihf\usr\lib
  • Copy lib*.a, lib*.so files (related to your library) from /usr/local/lib to %CROSS_COMPILER_DIR%\arm-linux-gnueabihf\usr\lib (trim local component)
  • Copy *.h files (related to your library) from /usr/include to %CROSS_COMPILER_DIR%\arm-linux-gnueabihf\usr\include
  • Copy *.h files (related to your library) from /usr/local/include to %CROSS_COMPILER_DIR%\arm-linux-gnueabihf\usr\include (trim local component)