Open AsperTheDog opened 1 month ago
Is there a reason you need to go through std::filesystem
? What happens if you simply pass your string literal to CreateNew()
? I think that the functions you are calling may give you back wchars (and UTF_16) on Windows, neither of which USD is expecting. USD is UTF-8.
A string literal containing an absolute path causes a segmentation fault.
A string literal containing a relative path gives the following error
Coding Error: in _CreateNew at line 558 of ... \pxr\usd\sdf\layer.cpp -- Failed verification: ' fileFormat '
Filed as internal issue #USD-10253
OK, sounds like you have build/configuration issues going on, and I'm not the right person to help you. The only thing I can suggest is that even with static builds, you need to ensure that USD can find all of its plugInfo.json files
I see, thanks for the help, in any case :) How do I ensure that? What are those files and where should they be?
We need higher-level documentation like a user guide to talk through more of the gotchas in plugin development and deployment (all USD file formats are plugins). I've never tried statically linking only the libraries you list, but usually the thing to do in these situations is to turn on verbose diagnostics in the plugin system. You can do this by setting the environment variable TF_DEBUG to PLUG* to turn on all debug channels for libPlug. This will tell you where your build of OpenUSD is looking for plugins.
You can also turn on PLUG* diagnostics for the prebuilt binaries from https://developer.nvidia.com/usd#section-getting-started and compare the reported plugin discovery when running its scripts/usdview_gui.bat to launch usdview with a simple USDA that contains a transform and a sphere.
https://openusd.org/release/tut_generating_new_schema.html#using-the-schema-classes is the closest thing I could find that covers a bit of plugin bootstrapping information.
To be fair I have been just randomly fighting with this. I have no idea if I am linking the correct libraries, if I should link more or less, if statically linking is harder than dynamically linking... All docs I can find are about the python API and precompiled binaries often come with python bindings which turn into dependency hell when I try to use it because it'll ask for 1000 python related libraries and modules.
I have also tried building as monolithic and I still get the fileFormat error
I am at a loss here. Am I missing any documentation or is this as confusing for everyone?
There definitely needs to be better docs for this-- in the meantime trying the TF_DEBUG diagnostics is the best advice I can offer.
Another thing we should document is that static builds should be considered advanced. We do not use them internally, and we have received guidance from the community that the largish project that would be necessary for them to be well supported (ie not prone to the issues you are running into) is not to be prioritized yet. With the dynamic builds, the runtime instructions which, for sure could still be expanded upon, that are, for example, on our tutorials pages should be sufficient.
In terms of better docs, we have landed a bunch of relevant help info in 24.11 ~ it addresses some of the issues you've asked about in this thread, such as why the file format is not recognized.
https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/docs/usdfaq.rst#build-and-runtime-issues
Plug will search for plug infos under 'C:\OpenUSD\lib\'
Will check plugin info paths:
C:\OpenUSD\plugin\usd
C:/OpenUSD/lib/usd
C:/OpenUSD/plugin/usd
Will read plugin info C:\OpenUSD\plugin\usd/plugInfo.json
Did read plugin info C:\OpenUSD\plugin\usd/plugInfo.json
Globbing plugin info path C:/OpenUSD/plugin/usd/*/resources/
Will read plugin info C:/OpenUSD/plugin/usd/usdShaders/resources/plugInfo.json
Will read plugin info C:/OpenUSD/plugin/usd/hdStorm/resources/plugInfo.json
Will read plugin info C:/OpenUSD/plugin/usd/hioAvif/resources/plugInfo.json
Did read plugin info C:/OpenUSD/plugin/usd/usdShaders/resources/plugInfo.json
Registering shared library plugin 'usdShaders' at ''.
Unable to read library plugin 'usdShaders' at ''.
Did read plugin info C:/OpenUSD/plugin/usd/hdStorm/resources/plugInfo.json
Did read plugin info C:/OpenUSD/plugin/usd/hioAvif/resources/plugInfo.json
Will read plugin info C:/OpenUSD/plugin/usd/sdrGlslfx/resources/plugInfo.json
Registering shared library plugin 'hioAvif' at ''.
Unable to read library plugin 'hioAvif' at ''.
Registering shared library plugin 'hdStorm' at ''.
Unable to read library plugin 'hdStorm' at ''.
Did read plugin info C:/OpenUSD/plugin/usd/sdrGlslfx/resources/plugInfo.json
Registering shared library plugin 'sdrGlslfx' at ''.
Unable to read library plugin 'sdrGlslfx' at ''.
Will read plugin info C:/OpenUSD/lib/usd/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/plugInfo.json
Globbing plugin info path C:/OpenUSD/lib/usd/*/resources/
Will read plugin info C:/OpenUSD/lib/usd/usd/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/ar/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/glf/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hdGp/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hdSt/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/ar/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hdx/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hdGp/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdImagingGL/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdGeom/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/ndr/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdImagingGL/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdHydra/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdImaging/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hio/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hgiGL/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdHydra/resources/plugInfo.json
Registering shared library plugin 'ar' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usd/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hio/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/sdf/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hdx/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdGeom/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdLux/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/hd/resources/plugInfo.json
Unable to read library plugin 'ar' at ''.
Did read plugin info C:/OpenUSD/lib/usd/glf/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hd/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hdSt/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdImaging/resources/plugInfo.json
Registering shared library plugin 'usd' at ''.
Unable to read library plugin 'usd' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdVol/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/sdf/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdLux/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/ndr/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdVol/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/hgiGL/resources/plugInfo.json
Registering shared library plugin 'usdImagingGL' at ''.
Unable to read library plugin 'usdImagingGL' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdMedia/resources/plugInfo.json
Registering shared library plugin 'usdHydra' at ''.
Unable to read library plugin 'usdHydra' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdMtlx/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdPhysics/resources/plugInfo.json
Registering shared library plugin 'hio' at ''.
Unable to read library plugin 'hio' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdMedia/resources/plugInfo.json
Registering shared library plugin 'usdGeom' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdProcImaging/resources/plugInfo.json
Unable to read library plugin 'usdGeom' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdMtlx/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdProcImaging/resources/plugInfo.json
Registering shared library plugin 'hdGp' at ''.
Unable to read library plugin 'hdGp' at ''.
Registering shared library plugin 'glf' at ''.
Unable to read library plugin 'glf' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdPhysics/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdRender/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdProc/resources/plugInfo.json
Registering shared library plugin 'hd' at ''.
Unable to read library plugin 'hd' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdRiPxrImaging/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdRender/resources/plugInfo.json
Registering shared library plugin 'hdSt' at ''.
Unable to read library plugin 'hdSt' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdProc/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdRi/resources/plugInfo.json
Registering shared library plugin 'hdx' at ''.
Unable to read library plugin 'hdx' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdRiPxrImaging/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdRi/resources/plugInfo.json
Registering shared library plugin 'usdImaging' at ''.
Unable to read library plugin 'usdImaging' at ''.
Registering shared library plugin 'sdf' at ''.
Unable to read library plugin 'sdf' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdShade/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdSkel/resources/plugInfo.json
Will read plugin info C:/OpenUSD/lib/usd/usdSkelImaging/resources/plugInfo.json
Registering shared library plugin 'usdLux' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdUI/resources/plugInfo.json
Unable to read library plugin 'usdLux' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdSkelImaging/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdSkel/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdShade/resources/plugInfo.json
Did read plugin info C:/OpenUSD/lib/usd/usdUI/resources/plugInfo.json
Registering shared library plugin 'usdVol' at ''.
Unable to read library plugin 'usdVol' at ''.
Will read plugin info C:/OpenUSD/lib/usd/usdVolImaging/resources/plugInfo.json
Registering shared library plugin 'hgiGL' at ''.
Unable to read library plugin 'hgiGL' at ''.
Did read plugin info C:/OpenUSD/lib/usd/usdVolImaging/resources/plugInfo.json
Registering shared library plugin 'ndr' at ''.
Unable to read library plugin 'ndr' at ''.
Registering shared library plugin 'usdMedia' at ''.
Unable to read library plugin 'usdMedia' at ''.
Registering shared library plugin 'usdProcImaging' at ''.
Unable to read library plugin 'usdProcImaging' at ''.
Registering shared library plugin 'usdMtlx' at ''.
Unable to read library plugin 'usdMtlx' at ''.
Registering shared library plugin 'usdPhysics' at ''.
Unable to read library plugin 'usdPhysics' at ''.
Registering shared library plugin 'usdRender' at ''.
Unable to read library plugin 'usdRender' at ''.
Registering shared library plugin 'usdProc' at ''.
Unable to read library plugin 'usdProc' at ''.
Registering shared library plugin 'usdRi' at ''.
Unable to read library plugin 'usdRi' at ''.
Registering shared library plugin 'usdRiPxrImaging' at ''.
Unable to read library plugin 'usdRiPxrImaging' at ''.
Registering shared library plugin 'usdSkelImaging' at ''.
Unable to read library plugin 'usdSkelImaging' at ''.
Registering shared library plugin 'usdSkel' at ''.
Unable to read library plugin 'usdSkel' at ''.
Registering shared library plugin 'usdUI' at ''.
Unable to read library plugin 'usdUI' at ''.
Registering shared library plugin 'usdShade' at ''.
Unable to read library plugin 'usdShade' at ''.
Registering shared library plugin 'usdVolImaging' at ''.
Unable to read library plugin 'usdVolImaging' at ''.
Will read plugin info C:/OpenUSD/plugin/usd/plugInfo.json
Did read plugin info C:/OpenUSD/plugin/usd/plugInfo.json
Globbing plugin info path C:/OpenUSD/plugin/usd/*/resources/
Ignore already read plugin info C:/OpenUSD/plugin/usd/usdShaders/resources/plugInfo.json
Ignore already read plugin info C:/OpenUSD/plugin/usd/hdStorm/resources/plugInfo.json
Ignore already read plugin info C:/OpenUSD/plugin/usd/hioAvif/resources/plugInfo.json
Ignore already read plugin info C:/OpenUSD/plugin/usd/sdrGlslfx/resources/plugInfo.json
Did check plugin info paths in 0.010881 seconds
Coding Error: in _CreateNew at line 558 of C:\Users\<user>\Downloads\OpenUSD-release\pxr\usd\sdf\layer.cpp -- Failed verification: ' fileFormat '
Error: Failed to create USD stage.
Currently the PXR_PLUGINPATH_NAME
env variable is set to C:\OpenUSD\plugin\usd
Where should it be? Could I be missing plugins?
I also want to add that I simply followed the instructions said in the readme for building for windows. There are mentions that static builds are the hard and unused version. I normally work with static builds because they feel easier with most libraries but if I am making my life harder by doing so please tell me because I just want to get this working in any way, shape or form at this point.
Thanks for posting the PLUG logs.... unfortunately I don't have much experiences with USD static builds either and don't know why the library locations are detected as ''. I can only recommend trying the dynamic build at this point-- the most common build is with separate DLLs per library in OpenUSD. Apologies for this experience. If the dynamic builds work for you, I'd keep this issue open for further investigation into plugin loads for static builds.
No problem! I am very grateful I got so many people trying hard to help me. I will use the dynamic build and see if that works
Description of Issue
I have made a small helloworld application to try to get the API working in a Visual Studio 2022 project The only file is main.cpp with the following code
When trying to execute this project, the line
const pxr::UsdStageRefPtr stage = pxr::UsdStage::CreateNew(path);
fails with the following error:Coding Error: in _CreateNew at line 519 of ... \pxr\usd\sdf\layer.cpp -- Cannot create new layer '���V�': cannot use empty identifier.
Steps to Reproduce
System Information (OS, Hardware)
Windows 11 23H2 AMD Ryzen 5700X NVIDIA RTX3070 Ti
Package Versions
OpenUSD (24.08) built using the script build_usd.py
Build Flags
--no-python