0

I want to build a custom Linux using the Yocto Project for a system using the nvidia tegra k1 processor, which has an arm cortex A 15 (32bit) and a GPU. Furthermore, OpenCV (version >= 3.0) with CUDA support needs to be installed.

Now when Bitbake tries to compile OpenCV with CUDA it crashes because nvcc throws an error Syntax error: word unexpected (expecting ")") which I learned is usually the case if you try to run an nvcc binary that is for the wrong system (e.g. 32bit-nvcc on 64bit-system). So I guess it just runs the nvcc that is suppost for the target system and therefore crashes.

  1. I don't know whether I need to compile using the usual x86-64bit-nvcc of the host system or (if this exists) some cross-compilation-nvcc.
  2. I need to know how I can involve said compiler into bitbake's process that builds OpenCV.
6
  • can you use openCV4tegra? Afaik it is much better optimized than plain cuda opencv Commented Nov 3, 2016 at 21:47
  • OpenCV4tegra is not an option since an OpenCV version of 3.0 or higher is required. Afaik OpenCV4tegra releases are all 2.4.X. Commented Nov 4, 2016 at 10:39
  • Have a look at the 2nd version in elinux.org/Jetson/Installing_OpenCV on how to compile openCV for tk1. Commented Nov 4, 2016 at 10:45
  • There is no actual information on cross-compiling at that page except for what it means or am I missing something? Commented Nov 4, 2016 at 11:00
  • so your question is about how cross compiling can be used at all? Commented Nov 4, 2016 at 11:03

1 Answer 1

1

I figured it out:

  1. One needs to use an nvcc binary that supports the host architecture. To specify the target architecture on can pass it cross compilation flags (see http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#cross-compilation). These are passed via the the cmake flag -DCUDA_NVCC_FLAGS
  2. EXTRA_OECMAKE_append = "-DCUDA_NVCC_EXECUTABLE=${PATH_TO_THE_NVCC_BINARY}"

The whole statement in the bbappend file could look like this

EXTRA_OECMAKE_append = " \
    -DCUDA_NVCC_EXECUTABLE=${NVCC_BINARY} \ 
    -DCUDA_NVCC_FLAGS="--compiler-bindir ${GCC_BINARY}"  \
    "
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.