bloomberg/bde-tools

Cannot Create Debug Build

Closed this issue · 10 comments

Given the following waf config

# waf 1.7.15 (abi 98, python 20708f0 on win32)
# using E:\BDE\bde-tools-master\bin\waf configure --build-type=debug

And a quick check on one of the produced libs

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>dumpbin /directives E:\BDE
\bde-master\build\groups\bsl\bsls\bsls.lib | find /i "/FailIfMismatch"
/FAILIFMISMATCH:"_MSC_VER=1800"
/FAILIFMISMATCH:"_ITERATOR_DEBUG_LEVEL=0"
/FAILIFMISMATCH:"RuntimeLibrary=MT_StaticRelease"

Which results in the following errors when trying to link in the "debug" version for a debug project

Error   1   error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in bsls_assert.t.obj
Error   2   error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in bsls_assert.t.obj

And the following waf environment setup

----------------------------------------
os_type
windows
----------------------------------------
os_name
windows_nt
----------------------------------------
cpu_type
x86
----------------------------------------
os_ver
6.1
----------------------------------------
comp_type
cl
----------------------------------------
comp_ver
18.00
----------------------------------------
uplid
windows-windows_nt-x86-6.1-cl-18.00
----------------------------------------
ufid
dbg_exc_mt
----------------------------------------
prefix
C:\users\stephenb\appdata\local\temp
----------------------------------------
Loading BDE metadata
ok
----------------------------------------
Evaluating options for 'bsl'
ok
----------------------------------------
Evaluating options for 'bdl'
ok
----------------------------------------
Saving configuration
ok

Does this happen when you make a clean build of bde (waf clean; waf build; waf install)?

@che2 is it possible that we will need to add /D_DEBUG to line 250 in etc/default.opts?

@abeels Yes that looks like it, but not just on line 250 ( or at least not for my setup ).. I have submitted a pull request with the fix #4

che2 commented

Can you please elaborate what you mean by link in the "debug" version for a debug project?

Are you linking one of the test drivers using waf or are you building a stand-alone application on top the BDE libraries? If it's the later, how are you building this application?

The necessarily flags to build against BDE libraries are described in the .pc (pkg-confing) files. So if you are building the separate application using Visual Studio, make sure you are using the same build flags described in the pkg-config files.

@che2 Building a stand-alone application on top of the BDE libraries.

However, I am not sure I follow what you are suggesting, since it is the BDE library build process that result in the _ITERATOR_DEBUG_LEVEL=0 being set in the BDE libraries when they are built in debug mode dbg_exc_mt which conflict with the _ITERATOR_DEBUG_LEVEL=2 setting I get in my stand alone application when it is compile in debug mode /D_Debug

But in case I was missing the obvious I did try adding the following switches to the my applications command line build :

-DBDE_BUILD_TARGET_DBG -DBDE_BUILD_TARGET_EXC -DBDE_BUILD_TARGET_MT /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /DNOMINMAX /DNOGDI /D_WIN32_WINNT=0x0500 /DWINVER=0x0500 /DBSLS_IDENT_OFF /DBSL_OVERRIDES_STD /DBDE_OMIT_INTERNAL_DEPRECATED /D_STLP_USE_STATIC_LIB /D_STLP_HAS_NATIVE_FLOAT_ABS

Which I found in the bdl.pc ( which seems to be a superset of the bsl.pc switches ).

As expected, It did not help, however, I think I might just be missing what you are suggesting. Unless you think I am perhaps attempting to manually build the BDE libraries manually without WAF -- which is not the case, as can be seen from the first bug comment.

In the mean time you can see my pull request #4 which shows how I addressed this, as it seems to me to simply be a matter of the _Debug preprocessor switch begin missing.

che2 commented

Created reference internal ticket #56738923.

che2 commented

@Stackingit, upon some initial investigation, the decision to not support iterator debug levels on Windows is deliberate to simplify our build process. For now, if you need to enable this feature, instead of changing default.opts, you can manually set the appropriate compiler flags using the CXXFLAGS environment variable. We will investigate this issue further and get back to you.

Thanks.

@Stackingit: We are still investigating this issue. We will update you here once we've reached a decision.

Is the workaround suggested by @che2 on Sept 15th working for you?

Great, and yes it is working for me.
On 10 Nov 2014 19:55, "Mike Giroux" notifications@github.com wrote:

@Stackingit https://github.com/Stackingit: We are still investigating
this issue. We will update you here once we've reached a decision.

Is the workaround suggested by @che2 https://github.com/che2 on Sept
15th working for you?


Reply to this email directly or view it on GitHub
#3 (comment).

che2 commented

After some consideration. We decided to not add support for setting iterator debug level in the build system as to not overly complicate it. We will reconsider if more people encounter this issue.