Vcpkg: How do I build all required Windows Libraries with ITERATOR_DEBUG_LEVEL=0 (in debug)

Created on 16 Apr 2020  路  11Comments  路  Source: microsoft/vcpkg

How to do it? Is there the way to control it via triplet? What runtime should I link against in this case?
Or I shouldn't do it at all, because I'm looking for trouble?

question

Most helpful comment

I think you should set it into here.

The correct way to do it use a custom triplet and specific a toolchain via VCPKG_CHAINLOAD_TOOLCHAIN_FILE

https://vcpkg.readthedocs.io/en/latest/users/triplets/

but it should be enough to

set(VCPKG_C_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")
set(VCPKG_CXX_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")

in a custom triplet

All 11 comments

.._LEVEL=0 ?

add_definitions("-D...

You could try
set(ENV{_CL_} "/D_ITERATOR_DEBUG_LEVEL=0")
or
set(VCPKG_C_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")
set(VCPKG_CXX_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")
in the triplet.

But it is probably not consistent across all ports.

But it is probably not consistent across all ports.

@Neumann-A yes, this is what bothers me either.
The following question would be: how to I verify, that ports have been build consistently. Ootherwise it could end up in a disaster, because inconsistency could be noticed only in some cases and only after some surprise segfaults.

@invy: You can check the debug build logs if the flag is in the cl call. Isn't it considered a feature in MS STL that libraries build with different _ITERATOR_DEBUG_LEVEL won't link due to the famous linker error. Here is just one example: https://github.com/conan-io/conan/issues/1341

@Neumann-A they won't if you link statically, but dynamically everything would link fine.

I think you should set it into here.

@JackBoosY this looks good.
Will toolchain settings also affect libraries built with msbuild and automake?

I think you should set it into here.

The correct way to do it use a custom triplet and specific a toolchain via VCPKG_CHAINLOAD_TOOLCHAIN_FILE

https://vcpkg.readthedocs.io/en/latest/users/triplets/

but it should be enough to

set(VCPKG_C_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")
set(VCPKG_CXX_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=0")

in a custom triplet

@Neumann-A great!
It would be cool if I also could somehow add a custom linter :)

@invy Does this issue solved?

Please reopen this issue if it still bother you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grandprixgp picture grandprixgp  路  3Comments

angelmixu picture angelmixu  路  3Comments

F0I0l0I0P picture F0I0l0I0P  路  3Comments

cjvaijo picture cjvaijo  路  3Comments

cskrisz picture cskrisz  路  3Comments