You should probably have an ABI compatibility namespace if defining this differently on each end causes ABI breakage.
For instance, we have 45 boost installations (boost version * gcc versions * 32/64 bit * options), and 30 valgrind installations. That would require 1350 boost+valgrind installations to generate all possible debug cases, hahaha. One ABI solution would be to leave the valgrind_stack_id declared in the struct at all times (or a field of equivalent size). At least the ABI wouldn't change. #if defined(BOOST_USE_VALGRIND) unsigned valgrind_stack_id; #else unsigned unused_valgrind_stack_id; #endif My solution is to force the define in the 7 header files that use it, such that it is always enabled, for the library/installation build, and all end-user code. Because ABI class layout mismatches are horrible to debug, we've been through that before. It would be nice if the installed *.so was not dependent on valgrind.h when BOOST_USE_VALGRIND is in play. Jason