0
votes

I am trying to cross compile opencv, but it fails with cvdef.h:314:5: error: '__fp16' does not name a type.

The cross compiler has hf support and the fp16 extension.

... --enable-languages=c,c++ --with-cpu=cortex-a53 --with-fpu=vfpv3-fp16 --with-float=hard --with-pkgversion='crosstool-NG crosstool-ng-1.22.0' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath ...

I have tried to set extra flags in the cmake file:

set(GCC_COMPILER_VERSION "5.2.0" CACHE STRING "GCC Compiler version") set(GNU_MACHINE "arm-linux-gnueabihf" CACHE STRING "GNU compiler triple")

set(CMAKE_CXX_FLAGS " -mfloat-abi=hard -mfp16-format=ieee")
set(CMAKE_C_FLAGS " -mfloat-abi=hard -mfp16-format=ieee")

include("${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake")

But it looks like the flags were ignored. cmake configuration output:

-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG -DNDEBUG

thx for your help.

1

1 Answers

2
votes

This issue was fixed recently: https://github.com/opencv/opencv/pull/7294

Please try to use the latest master branch.