OpenCV static compilation in Ubuntu12.04

Source: Internet
Author: User
1. tu12.04 without the new lide, can not stand the slow Software Center, so the installation of the new lide apt-getinstallsynaptic2. install gcc C/C ++ programming related tools sudoapt-getinstallbuild-essential3. install gtk + (it depends on the opencv Interface) to install the GTK environment. You only need to install libgtk2.0-dev, and install the gnome Development Environment

1. There is no new mode in Ubuntu 12.04, so it cannot stand the slow speed of the Software Center. Therefore, the new mode is installed.

Apt-get install synaptic

2. Install C/C ++ programming tools such as gcc

Sudo apt-get install build-essential

3. Install gtk + (it depends on the display of opencv Interface)

To install the GTK environment, you only need to install libgtk2.0-dev. to install the gnome development environment, you need to install gnome-core-devel, which contains the GTK development kit.

Sudo apt-get install gnome-core-devel (a little slow, need to download, view the network speed)

Pkg-config -- modversion gtk + (view version 1.2.x)

Pkg-config -- modversion gtk +-2.0 (view version 2.x)

Pkg-config -- version (view the version of pkg-config)

Pkg-config -- list-all | grep gtk (check whether gtk is installed)

4. Use synaptic to install cmake-qt

It is easier to configure the opencv compilation option with the interface cmake.

5. Install wxWidgets (codeblocks IDE required) V2.8

Since codeblocks is developed using wxWidgets, wxWidgets needs to be installed first. for the purpose of compiling with minimal size, the shared, unicode version, library file is compiled into a file, 2.8 is not supported, the debug information is removed, and the final configuration command is as follows (. /configure -- help to view the parameter information ):

./Configure -- enable-unicode -- enable-shared -- enable-monolithic -- disable-compat28 -- disable-debug_flag

Make (takes some time)

Make install

Ldconfig (Add/usr/local/lib to the last line of/etc/ld. so. conf, and then execute ldconfig)

The compiled file is stored in the/usr/local/bin and/usr/local/lib directories. You can change the path through-prefix.

Since Codeblocks currently only supports 2.8, uninstall make uninstall. reinstall 2.9.

./Configure -- enable-unicode -- enable-shared -- enable-monolithic -- disable-compat26 -- disable-debug_flag

Make (takes some time)

Make install

6. Install CodeBlocks (Ver10.05)

Codeblocks Latest Version 10.05 (as of) can only use wxWidgets2.8, incompatible 2. 9. the following error occurs when you use 2.9: editarrayorderdlg. h: 20: error: default argument for parameter of type 'const wxArrayString & 'hastype 'long int '. wxWidgets must be compiled into a single file. the BUILD File under the source code contains the compilation instructions. execute the following three commands in sequence.

./Configure -- with-contrib-plugins = all

Make

Make install

After the installation is complete, open it and only find that it disappears after a flash in the taskbar. The interface cannot be displayed. run the following command on the terminal: codeblocks: error while loading shared libraries: libcodeblocks. so.0: cannot open your dobject file: No such file or directory

Solution: In that case make sure the library path where the Code: Blocks librarieswhere installed into is "known" to the system. for example: On Ubuntuusing a default build process on a clean system will install the Code: Blocksexecutables to/use/local/bin and the libraries to/usr/local/lib. the latteris usually not known to a "clean" Ubuntu system. to add it to thesearch path for libraries do the following (as root/using sudo respectively): Add the following line to the file/etc/ld. so. conf:

/Usr/local/lib

... And run:

Ldconfig

That's it-Code: Blocks shocould now work just fine asall libraries are being found.

WxSmith is unavailable. When CB is enabled, the following message is displayed:

/Usr/local/lib/codeblocks/plugins/libwxSmithAui. so: not loaded (missing symbols ?)

/Usr/local/lib/codeblocks/plugins/libwxsmithcontribitems. so: not loaded (missing symbols ?)

/Usr/local/lib/codeblocks/plugins/libwxsmith. so: notloaded (missing symbols ?)

Run sudo ldconfig.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.