Ask Your Question
0

opencv-2.4.10 cross compilation with GTK+2.0 in ubuntu 14.04 (64-bit) for raspberry pi

asked 2015-04-08 02:32:58 -0600

mahadevi gravatar image

updated 2015-04-08 02:37:42 -0600

I am cross compiling opencv-2.4.10 with GTK+2.0. while doing cmake, I have enabled GTK using the below command

cmake -DWITH_GTK=ON -DCMAKE_TOOLCHAIN_FILE=../linux/arm-gnueabi.toolchain.cmake ../..

But still It is showing like this

-- GUI: -- QT: NO -- GTK+ 2.x: NO -- GThread : NO -- GtkGlExt: NO -- OpenGL support: NO -- VTK support: NO

Below is my arm-gnueabi.toolchain.cmake file,

set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR arm)

set(GCC_COMPILER_VERSION "4.8" CACHE STRING "GCC Compiler version")

set(FLOAT_ABI_SUFFIX "")

if (NOT SOFTFP) set(FLOAT_ABI_SUFFIX "hf") endif()

set(CMAKE_C_COMPILER /home/rpi/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc) set(CMAKE_CXX_COMPILER /home/rpi/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++) set(ARM_LINUX_SYSROOT /media/mahadevi/opencv_working/Rootfs/usr CACHE PATH "ARM cross compilation system root")

set(CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags") set(CMAKE_C_FLAGS "" CACHE STRING "c flags") set(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared linker flags") set(CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "module linker flags") set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nocopyreloc" CACHE STRING "executable linker flags")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")

set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_MODULE_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_EXE_LINKER_FLAGS}")

if(USE_NEON) message(WARNING "You use obsolete variable USE_NEON to enable NEON instruction set. Use -DENABLE_NEON=ON instead." ) set(ENABLE_NEON TRUE) elseif(USE_VFPV3) message(WARNING "You use obsolete variable USE_VFPV3 to enable VFPV3 instruction set. Use -DENABLE_VFPV3=ON instead." ) set(ENABLE_VFPV3 TRUE) endif()

set(CMAKE_FIND_ROOT_PATH /media/mahadevi/opencv_working/Rootfs ${ARM_LINUX_SYSROOT})

if(EXISTS ${CUDA_TOOLKIT_ROOT_DIR}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CUDA_TOOLKIT_ROOT_DIR}) endif()

set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." ) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)

macro to find programs on the host OS

macro( find_host_program ) set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) if( CMAKE_HOST_WIN32 ) SET( WIN32 1 ) SET( UNIX ) elseif( CMAKE_HOST_APPLE ) SET( APPLE 1 ) SET( UNIX ) endif() find_program( ${ARGN} ) SET( WIN32 ) SET( APPLE ) SET( UNIX 1 ) set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) endmacro()

macro to find packages on the host OS

macro( find_host_package ) set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) if( CMAKE_HOST_WIN32 ) SET( WIN32 1 ) SET( UNIX ) elseif( CMAKE_HOST_APPLE ) SET( APPLE 1 ) SET( UNIX ) endif() find_package( ${ARGN} ) SET( WIN32 ) SET( APPLE ) SET( UNIX 1 ) set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) endmacro()

can any one suggest how to resolve?

edit retag flag offensive close merge delete

Comments

I was able to activate some of the libraries by using cmake option: -DPKG_CONFIG_EXECUTABLE=arm-linux-gnueabihf-pkg-config. But this way had produced some other problems.

mshabunin gravatar imagemshabunin ( 2015-04-10 08:46:18 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-03 12:41:46 -0600

iwalpola gravatar image

updated 2017-02-03 12:48:30 -0600

I successfully got it to detect by using the normal pkg-config. You have to set "PKG_CONFIG_SYSROOT_DIR=/path/to/your/arm/sysroot" and "PKG_CONFIG_PATH=/path/to/arm/sysroot/usr/lib/pkgconfig:/path/to/arm/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig:/path/to/arm/sysroot/usr/share/pkgconfig"

These are environment variables, not cmake variables, so use "export variable=value" in terminal, or if you want to put it in your toolchain file, use "set(ENV{PKG_CONFIG_SYSROOT_DIR} /path/to/arm/sysroot)" somewhere at the beginning of the toolchain file.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-04-08 02:32:58 -0600

Seen: 2,135 times

Last updated: Feb 03 '17