-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized build on Windows fails to load plugins #1095
Comments
The Microsoft documentation for "Zc:inline" basically tells us that the USD sources are "non-conformant with C++11" and need an update: https://docs.microsoft.com/en-us/cpp/build/reference/zc-inline-remove-unreferenced-comdat?view=vs-2019 |
Thanks again for filing, @mistafunk -- for future reference, here is the usd-interest link for the original thread, so we can find it easily later: https://groups.google.com/forum/#!topic/usd-interest/s0l7TR-j-Qg As for this problem, it's interesting. We don't actually declare Plug_InitConfig as "inline" I don't think. Our code base, for better or for worse, does rely on being able to call these kinds of functions on dll load or startup, they're wrapped in ARCH_CONSTRUCTOR and a lot of our registry mechanisms are built around it. We don't use Windows in production and tend to lag on Windows support, but if you or anyone has suggestions on what the best way to handle this is, we'd love to hear them. Thanks again for the report! |
It's definitely an optimization bug on Microsoft's part. The problem isn't non-conformant code, it's this catch-all subclass of entities:
It's the "only have internal linkage" that's messing things up. It seems the msvc is unable to notice that the static global initialization in the plugins have non-local side effects. Pioneers building USD on iOS and Android are encountering the same issue. I have fixed this in custom builds in the past by exporting the static initialization functions in the plugins, so that the compiler/linker understands that they can't be dead-stripped. It's possible to achieve this through modification of the ARCH_CONSTRUCTOR macro (and several others that involve static global construction) to emit functions that call the constructors to fake the dead-stripper out. I haven't cracked the nut of making the macro work without adding an extra parameter though. Adding a parameter has a massive knock on effect in the codebase, so I don't currently have a nice solution to propose here. |
Filed as internal issue #USD-5808 |
Removing unreferenced data or functions that only have internal linkage causes errors when USD tries to load a plugin such as the SCC loader in IECoreUSD. See PixarAnimationStudios/OpenUSD#1095 for more discussion.
Removing unreferenced data or functions that only have internal linkage causes errors when USD tries to load a plugin such as the SCC loader in IECoreUSD. See PixarAnimationStudios/OpenUSD#1095 for more discussion.
Removing unreferenced data or functions that only have internal linkage causes errors when USD tries to load a plugin such as the SCC loader in IECoreUSD. See PixarAnimationStudios/OpenUSD#1095 for more discussion.
Description of Issue
Optimized ("release") builds on Windows fails to load plugins
Workaround:
-Zc:inline-
instead of-Zc:inline
Steps to Reproduce
pxr::PlugRegistry::GetInstance().GetAllPlugins()
.System Information (OS, Hardware)
Package Versions
Build Flags
The text was updated successfully, but these errors were encountered: