Use individual function definitions from OpenCV instead of using library.

asked 2013-07-29 08:40:35 -0500

AJ7 gravatar image

I need to port my project to an embedded architecture. For that, is it possible to use function definitions instead of using libraries? I am working on Linux system (Ubuntu 12.04) and I need to to this because of some cross-compilation issues. If it is possible, how to do that?

edit retag flag offensive close merge delete


i did not understand exaclty, what you mean with "use function definitions instead of using libraries",

but if your concern is, to get rid of the shared so's, then yes, you can build static libs from opencv, and link your prog against that ( resulting in 1 big binary chunk )

berak gravatar imageberak ( 2013-07-29 10:00:09 -0500 )edit

@berak Yes, I want to do either what you said or get the source code of the functions I am using in my project, build an SO file using my Makefile. And to avoid 1 big binary chunk, I want to know how to build these CV functions (compile and link flags, switches etc). I am using only core, imgproc and highgui.

AJ7 gravatar imageAJ7 ( 2013-07-30 07:02:58 -0500 )edit

if you're thinking of "ripping off a function here and there" -

bad idea.

berak gravatar imageberak ( 2013-07-30 07:36:08 -0500 )edit

@berak Not exactly ripping. My only requirement is to build only above mentioned three libraries separately, so that they will fit in my embedded project. Its more of "using precisely what's needed".

AJ7 gravatar imageAJ7 ( 2013-07-30 08:33:23 -0500 )edit

ah, ok. still go for static build, and leave the choice, what to take from the libs to the linker. will result in one chunk, but less (binary) than a smallish exe and so's (which contain functionality, you never use)

berak gravatar imageberak ( 2013-07-30 08:41:52 -0500 )edit

Ok. But can you suggest what basic options/switches for Makefile might be? Or any pointer to do so? I'm currently studying structure of cmake files and Makefiles generated by cmake for clues. But it's taking forever.

AJ7 gravatar imageAJ7 ( 2013-07-30 10:11:10 -0500 )edit

do yourself a favour, and use cmake-gui ;)

and that would be: BUILD_SHARED_LIBS=OFF

berak gravatar imageberak ( 2013-07-30 10:17:38 -0500 )edit