Page MenuHome

USD: Fix whole archive linking on windows.
ClosedPublic

Authored by Ray Molenkamp (LazyDodo) on Mar 20 2022, 8:37 PM.

Details

Summary

Strange this hasn't caused issues before, but LINK_FLAGS_* only applies to executables and shared libraries, so the /WHOLEARCHIVE link parameter got lost.

Ran into this in the 3.2 lib update which ran out of memory during the unit tests, root cause is either some brilliant engineering at pixar or pure random luck on their part.

Here's what's happening:

  1. USD Tries to figure out the calling overhead for their tracing functions over here it tries to estimate the the tick quantum noise by taking the ArchGetTickQuantum and multiplying it by 2000.
  1. WHOLEARCHIVE was not applied, and the ctor's have been eliminated by the linker, meaning Arch_InitTickTimer has not been called at this point.
  1. Meaning, Arch_TickQuantum still has it's default value ~0
  1. ~0 * 2000 = uh ow, and for every time the loop runs, TraceCollector add a sample to it's database, which runs ok for a few seconds, then runs out of memory and takes down the process.
  1. Fun!

Placing the whole archive link at the interface level fixes the issue.

Diff Detail

Repository
rB Blender

Event Timeline

Ray Molenkamp (LazyDodo) requested review of this revision.Mar 20 2022, 8:37 PM
Ray Molenkamp (LazyDodo) created this revision.

LGTM, but then again, it's a Windows-only change. You know more about what you're doing there than I do ;-)

This revision is now accepted and ready to land.Mar 25 2022, 4:58 PM

The linker commands haven't changed they were good from the start, it was just that cmake didn't propagate them to the final target :)

This looks good to me, as well. (With the caveat that I don't have a lot of specific experience building the USD libs.) Good catch on an interesting issue!

This revision was automatically updated to reflect the committed changes.