Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve user-passed CXXFLAGS with --enable-debug #6434

Merged
merged 1 commit into from Jul 17, 2015

Conversation

@gavinandresen
Copy link
Contributor

gavinandresen commented Jul 14, 2015

I was surprised that this didn't work:
./configure --enable-debug CXXFLAGS="-DDEBUG_LOCKORDER"

@theuni : I don't THINK this will have unintended consequences, is there a reason --enable-debug overwrote CFLAGS/CXXFLAGS?

@theuni
Copy link
Member

theuni commented Jul 14, 2015

@gavinandresen looks good to me, agreed that the behavior is unexpected. A few thoughts, though:

  • I believe it's that way because "-O2 -g" are already added by default. After this change, a ./configure --enable-debug will end up with duped flags I think. Not a problem really, the last flag wins.
  • You really want to be passing that in as CPPFLAGS=-DDEBUG_LOCKORDER anyway. Those are pre-processor flags, which exist separately so they don't get mixed up in arguments about optim flags and etc.
  • IMO There should be no need to pass -DDEBUG_LOCKORDER via a flag, that kinda defeats the purpose of having configure options to begin with. How about just adding -DDEBUG_LOCKORDER to CPPFLAGS in the --enable-debug case?
@gavinandresen
Copy link
Contributor Author

gavinandresen commented Jul 14, 2015

RE: CPPFLAGS: hmm, then --enable-debug should add -DDEBUG to CPPFLAGS instead of CFLAGS/CXXFLAGS...

RE: adding -DDEBUG_LOCKORDER to --enable-debug: sounds good to me.

@laanwj
Copy link
Member

laanwj commented Jul 15, 2015

How about just adding -DDEBUG_LOCKORDER to CPPFLAGS in the --enable-debug case?

Sounds good to me.

Although maybe then it should be documented then that the flag doesn't just add debug information, but also enables specific debug functionality.

Or maybe that's already clear:

--enable-debug          use debug compiler flags and macros (default is no)
@laanwj laanwj added the Build system label Jul 15, 2015
Three changes to how configure --enable-debug behaves:

1. Preserve user-passed CXXFLAGS/CFLAGS
2. Compile with -DDEBUG_LOCKORDER
3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)
@gavinandresen gavinandresen force-pushed the gavinandresen:preserve_CXXFLAGS branch to 83b48c8 Jul 15, 2015
@gavinandresen
Copy link
Contributor Author

gavinandresen commented Jul 15, 2015

Tweaked based on comments:

Three changes to how configure --enable-debug behaves:

  1. Preserve user-passed CXXFLAGS/CFLAGS
  2. Compile with -DDEBUG_LOCKORDER
  3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)
@theuni
Copy link
Member

theuni commented Jul 15, 2015

Thanks, looks good.

@laanwj laanwj merged commit 83b48c8 into bitcoin:master Jul 17, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Jul 17, 2015
83b48c8 configure --enable-debug changes (Gavin Andresen)
luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Jan 9, 2016
Three changes to how configure --enable-debug behaves:

1. Preserve user-passed CXXFLAGS/CFLAGS
2. Compile with -DDEBUG_LOCKORDER
3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)

Github-Pull: bitcoin#6434
Rebased-From: 83b48c8
luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Jan 10, 2016
Three changes to how configure --enable-debug behaves:

1. Preserve user-passed CXXFLAGS/CFLAGS
2. Compile with -DDEBUG_LOCKORDER
3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)

Github-Pull: bitcoin#6434
Rebased-From: 83b48c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.