I'm working with android NDK and OpenCV (Version 2.4.1). What I'm trying to do is to profile an android application that uses opencv as a library (and profile the function called into opencv too).
I set up all the environment (android NDK, SDK, openCV, and openCV for android) but obviously is not possible to profile opencv because with android it uses a bunch of prebuilt libraries.
I have tried this two way:
1 - recompile the openCV library adding the C flag -pg
I have tried to put the option -pg but it gives me an error of incompatibility so as is suggested Here. I correct this error putting the option -DENABLE_PROFILING=ON -DOPENCV_LINKER_LIBS=/full/path/to/libandprof.a but however I get this error:
[ 0%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_aux.c.o
In file included from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:32: /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:56: error: expected declaration specifiers or '...' before 'size_t'
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:56: error: expected declaration specifiers or '...' before 'size_t'
In file included from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:60, from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:32: /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:67: error: expected '=', ',', ';', 'asm' or 'attribute' before 'tmsize_t'
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:77: error: expected '=', ',', ';', 'asm' or 'attribute' before 'tsize_t'
In file included from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:60, from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:32: /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:275: error: expected declaration specifiers or '...' before '*' token
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:275: error: expected declaration specifiers or '...' before 'tmsize_t'
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:275: warning: type defaults to 'int' in declaration of 'tmsize_t'
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:275: error: 'tmsize_t' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:348: error: 'TIFFScanlineSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:350: error: 'TIFFRasterScanlineSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:352: error: 'TIFFStripSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:354: error: 'TIFFRawStripSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:356: error: 'TIFFVStripSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:358: error: 'TIFFTileRowSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:360: error: 'TIFFTileSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:362: error: 'TIFFVTileSize' declared as function returning a function
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:376: error: expected '=', ',', ';', 'asm' or 'attribute' before 'TIFFGetReadProc'
/home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:377: error: expected '=', ',', ';', 'asm' or 'attribute' before 'TIFFGetWriteProc' /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:434: error: expected declaration specifiers or '...' before 'TIFFReadWriteProc' /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:434: error: expected declaration specifiers or '...' before 'TIFFReadWriteProc' /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:452: error: 'TIFFReadTile' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:453: error: 'TIFFWriteTile' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:456: error: 'TIFFReadEncodedStrip' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:457: error: 'TIFFReadRawStrip' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:458: error: 'TIFFReadEncodedTile' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:459: error: 'TIFFReadRawTile' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:460: error: 'TIFFWriteEncodedStrip' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:461: error: 'TIFFWriteRawStrip' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:462: error: 'TIFFWriteEncodedTile' declared as function returning a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:463: error: 'TIFFWriteRawTile' declared as function returning a function In file included from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:32: /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:148: error: field 'tif_tilesize' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:171: error: field 'tif_scanlinesize' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:172: error: field 'tif_scanlineskew' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:174: error: field 'tif_rawdatasize' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:175: error: field 'tif_rawdataoff' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:176: error: field 'tif_rawdataloaded' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:178: error: field 'tif_rawcc' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:181: error: field 'tif_size' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffiop.h:186: error: expected specifier-qualifier-list before 'TIFFReadWriteProc' In file included from /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:33: /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_predict.h:40: error: field 'stride' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_predict.h:41: error: field 'rowsize' declared as a function /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c: In function '_TIFFCheckRealloc': /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:67: error: function 'bytes' is initialized like a variable /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:67: error: invalid operands to binary * (have 'int ()()' and 'int ()()') /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:72: error: invalid operands to binary / (have 'int ()()' and 'int ()()') /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:67: error: nested function 'bytes' declared but never defined /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c: In function 'TIFFDefaultTransferFunction': /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:101: error: cast specifies function type /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:102: error: invalid operands to binary * (have 'int (*)()' and 'unsigned int') /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:106: error: lvalue required as left operand of assignment /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:106: error: lvalue required as increment operand /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:107: error: pointer value used where a floating point value was expected /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:107: error: pointer value used where a floating point value was expected /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:108: error: array subscript is not an integer /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c: In function 'TIFFDefaultRefBlackWhite': /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tif_aux.c:137: warning: passing argument 1 of '_TIFFmalloc' makes pointer from integer without a cast /home/bacci/librerie/OpenCV-2.4.1/3rdparty/libtiff/tiffio.h:295: note: expected 'int (*)()' but argument is of type 'unsigned int'
make[2]: * [3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_aux.c.o] Error 1
make1: * [3rdparty/libtiff/CMakeFiles/libtiff.dir/all] Error 2
make: * [all] Error 2
`
2 - try to integrate some of the source code of openCV in mine c++ android application (extern C)
This is not a good solution because however i can't get a real tree with all the calls of the program, since you don't integrate all opencv source into my app in jni folder.
Can someone give me an hand to solve this issue??
Thank you