Windows Modelbuilder startup problem, python init

Wondering if anyone has seen this before. I’m building with VS2019, which I don’t think has been done before.

I’m seeing a heap-corruption crash in Paths.cxx:

std::string Paths::pathToLibraryContainingFunction(void (*func)(void))
{
  return boost::dll::symbol_location(*func).parent_path().string();
}

called by

static std::string pythonLibraryLocation = Paths::pathToLibraryContainingFunction(Py_Initialize);

It’s a RelWithDebInfo build.
Debugging, it seems like the path retrieved is garbage, the parent_path() ends up being empty, and then when the temporary objects are cleaned up, the heap corruption is detected.

I’ve tried to set PATH and PYTHONPATH to point to the superbuild python, but it didn’t change the behavior.

Anyone seen something similar before?

  1. I would try constructing a minimal working executable (i.e. outside of SMTK) that calls boost::dll::symbol_location to make sure your installation of boost is returning what you’d expect. You can have the function point to any symbol you like within the compilation unit for reference.
  2. Using the above example, add python as a compile-time dependency and point the boost function to the python symbol.
  3. Take this example and put it into SMTK’s testing (still not using SMTK’s libraries, only its build infrastructure) to make sure you still have boost doing what you’d expect.

If I had to guess, I would guess the above will show an issue when you change the symbol to something in python’s library. If that’s the case, then this is a MSVC2019 + python issue.