Ask Your Question

Optimization level for gcc linux 32

asked 2014-11-25 05:34:51 -0600

tomasth gravatar image

updated 2015-01-07 06:56:20 -0600

Found this announcement

SPECIAL NOTE for Ubuntu x86 12.04 users: By default OpenCV is now built with "-O2" optimization flag >instead of "-O3" on 32-bit Linux. The compiler in the 32-bit version of Ubuntu 12.04 produces incorrect >code with "-O3", so it's strongly recommended not to use this flag.

You are welcome to try out the latest and greatest OpenCV!

Best regards, OpenCV development team.

I notice that -O2 is still used as default in the CMake files for v3.0 beta Is the issue with using -O3 not resolved for newer versions of gcc than what is supported by Ubuntu 12.04? Is there a significant performance penalty associated with having to use -O2 ?

edit retag flag offensive close merge delete


Update: Back in '15 I tried compiling opencv 3.0 with -O3 and it did not work. I have since upgraded my gcc to 6.2 and now I tried with opencv 3.3

Seems to be working just fine

Still on Ubuntu 1204 32 bit

tomasth gravatar imagetomasth ( 2017-10-11 04:08:14 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-11 05:34:40 -0600

tomasth gravatar image

updated 2017-10-11 05:41:47 -0600

Ran a comparison test. Just my application using several opencv functions and classes compiled with -O3 or -O2 and timed the processing steps. I anything, the -O2 version performed better, but not a very scientific test.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-11-25 05:34:51 -0600

Seen: 508 times

Last updated: Oct 11 '17