Compiling 2.4.8 without shared libs

asked 2014-03-12 07:30:03 -0600

thistle gravatar image

updated 2014-03-12 08:34:14 -0600

berak gravatar image

Is it still possible to compile OpenCV as static libraries?

I am trying to compile OpenCV 2.4.8 (Linux distribution) without producing dynamic libraries.

The command I use is the following one:

 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/.../user/work/libs/opencv -D BUILD_SHARED_LIBS=off ..

When I compile, I got the following error:

 [19%] Generating precomp.hpp.gch/opencv_core_RELEASE.gch
 /usr/lib/../lib64/crt1.o: In function `_start':
 /usr/src/packages/BUILD/glibc-2.11.1/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
 collect2: error: ld returned 1 exit status
 make[2]: *** [modules/core/precomp.hpp.gch/opencv_core_RELEASE.gch] Error 1
 make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2

which is clearly to related to static/dynamic linking.

Is there anyone who can tell me what I am doing wrong?

cheers

edit retag flag offensive close merge delete

Comments

I can compile the library perfectly using the same command you used.

What happens when you build it without the option -D BUILD_SHARED_LIBS=off?

Are you sure you have all the needed dependencies?

It might also be related to your compiler version, mine is Ubuntu/Linaro 4.7.2-2ubuntu1 how about yours?

Martin Peris gravatar imageMartin Peris ( 2014-03-12 21:16:04 -0600 )edit