Skip to content
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

Coding Error: in _GetPluginForType at line 147 of F:\xxxxxx -- Failed to find plugin for ArDefaultResolver #1788

Closed
gunjo7 opened this issue Feb 28, 2022 · 7 comments

Comments

@gunjo7
Copy link

gunjo7 commented Feb 28, 2022

Description of Issue

when i use
auto stage = pxr::UsdStage::Open(xxx.usda);
in my project.
it occurs Coding Error: in _GetPluginForType at line 147 of F:\000USDFINALSTANDARD\USD22\SOURCE\USD-release\pxr\usd\ar\resolver_v2.cpp -- Failed to find plugin for ArDefaultResolver.

Steps to Reproduce

System Information (OS, Hardware)

WINDOWS10

Package Versions

USD22

Build Flags

@jilliene
Copy link

Filed as internal issue #USD-7246

@hadi-rahimi
Copy link

I get the same error in Windows 10, but only when the DLLs/plugins are in non-ASCII path.

@yosmo78
Copy link

yosmo78 commented Jun 29, 2022

Just want to leave repo steps that I found (i created my install in a folder called USD-install)

  1. download: lastest repo to C:\USD and create a USD-install folder inside of it
  2. run: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
  3. run: py C:\USD\build_scripts\build_usd.py C:\USD\USD-install --no-docs --no-embree --no-python --no-debug-python --no-draco --no-prman --no-materialx --no-alembic --no-hdf5 --no-opencolorio --no-openimageio --no-usdview --no-openvdb --no-ptex --no-imaging
  4. I am compiling a windows program from the command line, so I created a new cpp project
  5. copied over the bin, include, and lib folder.
  6. moved tbb.dll, usd_ar.dll, usd_arch.dll, usd_gf.dll, usd_js.dll, usd_js.dll, usd_kind.dll, usd_pcp.dll, usd_plug.dll, usd_sdf.dll, usd_tf.dll, usd_trace.dll, usd_usd.dll, usd_vt.dll, and usd_work.dll all to the level where my .exe will be generated and run from
  7. In usd/pcp/types.h on line 119 change the numeric_limits<size_t>::max() to SIZE_MAX and in base/gf/ilmbase_halfLimits.h comment out the min and max functions on line 66 and 67
  8. I then linked against lib/tbb.lib lib/usd_tf.lib lib/usd_sdf.lib lib/usd_vt.lib lib/usd_usd.lib
  • here was my build command:
if not defined DevEnvDir (
	call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
)

set FILES=MinimalUSD.cpp

set LIBS=kernel32.lib user32.lib gdi32.lib shlwapi.lib dbghelp.lib
set DLLLIBS=lib/tbb.lib lib/usd_tf.lib lib/usd_sdf.lib lib/usd_vt.lib lib/usd_usd.lib

cl /nologo /std:c++17 /W3 /Z7 /GS- /DEBUG:none /Gs999999 /MT /EHsc /O2  %FILES% -FeMinimalUSD.exe %LIBS% /I.\include /link %DLLLIBS% /incremental:no /opt:icf /opt:ref /subsystem:console

and here is the program (MinimalUSD.cpp):

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN             
#endif

#define NOMINMAX
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>       
#include <stdint.h>

#include "pxr/usd/usd/notice.h"
#include "pxr/usd/usd/stage.h"
#include "pxr/usd/usd/prim.h"

// Unsigned Integers
typedef     uint8_t             u8;
typedef     uint16_t            u16;
typedef     uint32_t            u32;

// Signed Integer
typedef     int8_t              s8;
typedef     int16_t             s16;
typedef     int32_t             s32;

typedef     uint64_t            u64;
typedef     int64_t             s64;

typedef     intptr_t            sptr;
typedef     uintptr_t           uptr;

// Floating Point 
typedef     int16_t             f16;
typedef     float               f32;
typedef     double              f64;

int main()
{
   const char *fileName = ".\\test.usda";
   bool bIsSupported = PXR_NS::UsdStage::IsSupportedFile(fileName);
   if( bIsSupported )
   {
      printf("it is supported!\n");
      PXR_NS::UsdStageRefPtr loadedStage = PXR_NS::UsdStage::Open(fileName);
      if( loadedStage )
      {
         PXR_NS::UsdPrim pseudoRoot = loadedStage->GetPseudoRoot();
         printf("Pseudo root path: %s\n", pseudoRoot.GetPath().GetString().c_str());
         for (PXR_NS::UsdPrim const& c : pseudoRoot.GetChildren())
         {
             printf("\tChild path: %s\n", c.GetPath().GetString().c_str());
         }
      }
   }
   return 0;
}

if you run the program you see:

Coding Error: in _GetPluginForType at line 147 of C:\USD\pxr\usd\ar\resolver_v2.cpp -- Failed to find plugin for ArDefaultResolver

@yosmo78
Copy link

yosmo78 commented Jun 29, 2022

turns out I was missing all the plugins, in the USD-install folder /plugin/usd i copied that plugInfo.json to a new resources folder i put at the .exe level

and then in the lib folder there is an internal /lib/usd folder, which i copied up /lib/usd up to the .exe level (so that at the usd folder is at the .exe level) and then it all worked

@xahon
Copy link

xahon commented Jan 19, 2023

@yosmo78 it doesn't work

UPD
I was copying wrong "plugins" directory. When I copy "usd" directory from "<installation_dir>/lib/" it works

@meshula
Copy link
Member

meshula commented Jan 19, 2023

It sounds like this issue is well explored and several resolutions discussed. Please feel free to open a new issue if necessary.

@meshula meshula closed this as completed Jan 19, 2023
pixar-oss added a commit that referenced this issue Feb 7, 2023
Fixes #1788

(Internal change: 2261655)
@IshanshLal-Vigaet
Copy link

Please fix version string, and
How do i fix
(#1788) issue

Previously in output dir folder

\usd
	\plugInfo.json
	\ar
	    \resources
	        \plugInfo.json
	\ndr
	    \resources
	        \plugInfo.json
	\sdf
	    \resources
	        \plugInfo.json
	\usd
	    \resources
	        \generatedSchema.usda
	        \plugInfo.json
	        \codegenTemplates
	            \api.h
	            \plugInfo.json
	            \schemaClass.cpp
	            \schemaClass.h
	            \tokens.cpp
	            \tokens.h
	            \wrapSchemaClass.cpp
	            \wrapTokens.cpp
	        \usd
	            \schema.usda
	\usdGeom
	    \resources
	        \generatedSchema.usda
	        \plugInfo.json
	        \usdGeom\schema.usda
	...
\tbb.dll
\test.exe
\usd_ar.dll
\usd_arch.dll
\usd_gf.dll
\usd_js.dll 
...

this was how it worked, however it seems
patching it with

foreach(PLUGINFO ${PLUGINFO_FILES} ${PLUGINFO_FILES_DEBUG})
    file_replace_regex(${PLUGINFO} [=["LibraryPath": "../../([a-zA-Z0-9_]+).dll"]=] [=["LibraryPath": "../../../bin/\1.dll"]=])
endforeach()

so the directory structure should change.
Can anyone help me with this, many thanks ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@meshula @hadi-rahimi @xahon @yosmo78 @jilliene @gunjo7 @IshanshLal-Vigaet and others