GCC multiple errors while compiling fastcv
Join Date: 7 Apr 17
Posts: 4
Posted: Thu, 2018-01-11 00:27
Hello,
I am trying to use FastCV 1-2-2 on my Dragonboard 410c with Debian distro, so I just started to kick-off with it.
Attempting to compile a source (but just including the fasctcv header and linking the library) GCC gives a lot of errors, for example:
In file included from ../fastcv-1-2-2/inc/fastcv.h:23216:0,
../fastcv-1-2-2/inc/fastcv.inl: In function ‘void fcvFilterMedian3x3u8(const uint8_t*, unsigned int, unsigned int, uint8_t*)’:
../fastcv-1-2-2/inc/fastcv.inl:4205:21: error: cast from ‘const uint8_t* __restrict__ {aka const unsigned char* __restrict__}’ to ‘int’ loses precision [-fpermissive]
fcvAssert( ((int)src & 0xF) == 0 ); // 128-bit alignment
^
../fastcv-1-2-2/inc/fastcv.inl:60:13: note: in definition of macro ‘fcvAssert’
if( !(FASTCV_ASSERT_IN) ) \
^~~~~~~~~~~~~~~~
../fastcv-1-2-2/inc/fastcv.inl:4206:21: error: cast from ‘uint8_t* __restrict__ {aka unsigned char* __restrict__}’ to ‘int’ loses precision [-fpermissive]
fcvAssert( ((int)dst & 0xF) == 0 ); // 128-bit alignment
^
../fastcv-1-2-2/inc/fastcv.inl:60:13: note: in definition of macro ‘fcvAssert’
if( !(FASTCV_ASSERT_IN) ) \
^~~~~~~~~~~~~~~~
../fastcv-1-2-2/inc/fastcv.inl: In function ‘void fcvFilterMedian3x3u8_v2(const uint8_t*, unsigned int, unsigned int, unsigned int, uint8_t*, unsigned int)’:
../fastcv-1-2-2/inc/fastcv.inl:4229:21: error: cast from ‘const uint8_t* __restrict__ {aka const unsigned char* __restrict__}’ to ‘int’ loses precision [-fpermissive]
fcvAssert( ((int)src & 0xF) == 0 ); // 128-bit alignment
These errors can be turned to warning if the flag -fpermissive is being used, but this is not safe and the the compilation execution is time expensive due tue the massive amount of warnings (the amount of errors can be cutted with -fmax-errors=N flag).
What can I do to fix this painful compile execution ?
Thank you in advance.
Regards,
Simon
The problem is due to the C code in fastcv.inl.
Since the macro fcvAssertHook is declared as such:
#ifndef NDEBUG