# How to turn off -O2 build flags ?

**URL:** <https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327>\
**Category:** Zeek\
**Created:** [October 23, 2014, 1:11pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327 "2014-10-23T13:11:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Donnelly](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@John\_Donnelly](https://community.zeek.org/u/John_Donnelly)\
**Post date:** [October 23, 2014, 1:11pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/1 "2014-10-23T13:11:23Z")

</div>

Hi,  
How can I turn off the optimization settings when I build bro ?

I would like to run gdb against a running proc but it gets confused due to optimizations .

---

<div class="post-metadata">

**Author:** ![John\_Donnelly](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@John\_Donnelly](https://community.zeek.org/u/John_Donnelly)\
**Post date:** [October 23, 2014, 1:22pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/2 "2014-10-23T13:22:24Z")

</div>

looks like ./configure --enable-debug

will do it 😉

---

<div class="post-metadata">

**Author:** ![Seth\_Hall3](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Seth\_Hall3](https://community.zeek.org/u/Seth_Hall3)\
**Post date:** [October 23, 2014, 1:50pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/3 "2014-10-23T13:50:55Z")

</div>

You could build with --enable-debug, but that turns on a lot of extra debugging and make Bro run quite a bit slower.

It seems that if you give -O0 as a CXXFLAG when you run configure we're currently appending those values in the wrong order when the compiler runs so you can't override it that way at the moment.

&nbsp;&nbsp;.Seth

---

<div class="post-metadata">

**Author:** ![Siwek\_Jon](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Siwek\_Jon](https://community.zeek.org/u/Siwek_Jon)\
**Post date:** [October 23, 2014, 2:46pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/4 "2014-10-23T14:46:05Z")

</div>

Just wondering if you’ve done any recent measurements? I can’t remember if [1] completely eliminated the overhead of —enable-debug without any `bro -B` flags versus just -O0, but it did help a lot.

- Jon

[1] [https://github.com/bro/bro/commit/302c063874f03c94eb0f96c974a2d0e2f137e51f](https://github.com/bro/bro/commit/302c063874f03c94eb0f96c974a2d0e2f137e51f)

---

<div class="post-metadata">

**Author:** ![Seth\_Hall3](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Seth\_Hall3](https://community.zeek.org/u/Seth_Hall3)\
**Post date:** [October 23, 2014, 2:55pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/5 "2014-10-23T14:55:05Z")

</div>

Oh, I haven't. That would be great if the debug overhead was gone or nearly gone.

&nbsp;&nbsp;.Seth

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:42pm UTC](https://community.zeek.org/t/how-to-turn-off-o2-build-flags/3327/6 "2022-05-06T15:42:10Z")

</div>


