Forums - GCC multiple errors while compiling fastcv

2 posts / 0 new
Last post
GCC multiple errors while compiling fastcv
simozz
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
  • Up0
  • Down0
simozz
Join Date: 7 Apr 17
Posts: 4
Posted: Thu, 2018-01-11 04:30

The problem is due to the C code in fastcv.inl.

Since the macro fcvAssertHook is declared as such:

#ifndef NDEBUG

   #define fcvAssert( FASTCV_ASSERT_IN ) \
      if( !(FASTCV_ASSERT_IN) ) \
         fcvAssertHook( FASTCV_ASSERT_IN, __FILE__, __LINE__ );
#else
   #define fcvAssert( FASTCV_ASSERT_IN ) ((void)0)
#endif
 
The solution is just to do not use debug, so in the app source code:
 
#ifndef NDEBUG
#include <fastcv.h>
 
Regards,
Simon
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.