Open xwlin-roy opened 3 years ago
Filed as internal issue #USD-6894
Filed as internal issue #USD-6894
any suggestion for this issue?
Hi @xwlin-roy, thanks for posting. There are some issues with static libraries because USD uses a plugin system to discover and load libraries that supply file format implementations as needed.
When linked statically into an executable, USD will look in the usd/
subdirectory in the same location as the executable for the plugin manifests (plugInfo.json files). The build typically installs these files in <inst>/lib/usd
. You can tell USD to look there by setting the environment variable PXR_PLUGINPATH_NAME=<inst>/lib/usd
before running sdfdump
.
The build system does not currently link all of the libraries needed for sdfdump to load the various file formats. Normally these libraries would be dynamically discovered and loaded at runtime by the plugin system, but in the static library case this of course isn't possible. To work around this issue, you could add usd
to the list of libraries in the CMakeLists.txt
for sdfdump
and then build.
I've confirmed sdfdump
works for me if I set the environment variable and update the CMakeLists.txt
as mentioned above.
Hello, I have a different problem when building USD as static libraries.
I get this error when trying to use a binary that was linked to usd static libraries:
Coding Error: in CreateAnonymous at line 342 of /home/poly/Libs/src/USD/pxr/usd/sdf/layer.cpp -- Cannot determine file format for anonymous SdfLayer
I am not sure if the issue is with my code(code developed and tested OK with shared usd libs - do I need to adapt it when linking to static usd libs?), the plugin detection or other issue.
Working on Ubuntu 20.04 inside WSL2. The reason for trying out static libraries is that shared ones require to be built and deployed in the same USD install folder on every target machine; we search for a simpler distribution process.
PS: is plugin registration still required when linking to static libraries, i.e. :
PlugRegistry& registry = PlugRegistry::GetInstance();
const PlugPluginPtr usd_plugin = registry.GetPluginWithName("usd");
@MikeCernea does manually adding usd to the CMakeLists.txt work around your issue?
Description of Issue
Steps to Reproduce
-DBUILD_SHARED_LIBS=OFF
./sdfdump xxx.usdz
, it will report:System Information (OS, Hardware)
Ubuntu 20.04
Package Versions
github latest commit
Build Flags
I modify the https://github.com/PixarAnimationStudios/USD/blob/7a5f8c4311fed3ef2271d5e4b51025fb0f513730/build_scripts/build_usd.py#L1356 to
-DBUILD_SHARED_LIBS=OFF