Log in Page Discussion History Go to the site toolbox

Installing IRI drivers in non ROOT locations

From WikIRI

Contents

Motivation

In some scenarios could be needed to install IRI drivers in different locations than root of system, such as chroots or cross-compiling enviroments.

The Institut provides the drivers with a CMake install script, which not always is easy to adapt to installations outside of root system.

The current and working way

Installing files

Installing the files under something different than system root is really easy using the support DESTDIR option when running make install:

DESTDIR="/my/non/root/path" make install

Searching libs, headers and cmake modules

In order to use the non system root as source of provided libraries, headers and cmake modules, one way is to use a CMAKE_TOOLCHAIN_FILE to provide modifiers to PATHs used by cmake. An example is below:

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Linux)
SET(CHROOT_PATH /my/non/root/path)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH ${CHROOT_PATH})
SET(CMAKE_MODULE_PATH ${CHROOT_PATH}/usr/share/cmake-2.8/Modules)
SET(CMAKE_LIBRARY_PATH ${CHROOT_PATH}/usr/local/lib)

# Need to simulate the auto include /usr/local/include from gcc
INCLUDE_DIRECTORIES(${CHROOT_PATH}/usr/local/include)

# Need to simulate default rpath for libs
# CMAKE_EXE_LINKER_FLAGS is override by the module CMakeCommonLanguageInclude.cmake 
# so the only way I found was to use this obscure variable :)
SET (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-rpath,${CHROOT_PATH}/usr/local/lib")

So, the cmake command to run in order to generate and install IRI drivers should be:

cd build && cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ..


The ideal solution

The ideal solution should be integrate the install and search configuration under the toolchain file and don't need to provide the PATH again in the DESTDIR variable.

Current problems

Currently, there are at leats two problems stopping us of going this way:

  • IRI CMakeLists.txt override the CMAKE_INSTALL_PREFIX variable with a hardcoded value, so it's not possible to provide one in the toolchain file.
  • Instalation of cmake Find modules is doing in a path hardcoded and can not be modified. So it's impossible to install in other place without patching.

Integrating into ROS

TODO

Site Toolbox:

Personal tools
This page was last modified on 20 April 2011, at 16:33. - This page has been accessed 181 times. - Disclaimers - About WikIRI