Building USDImporter for Linux

Hi,

I’ve opened hell in trying to compile USD for Linux, as only USD in Windows is currently bundled within Unreal Engine.
I came pretty far with building the library using the BuildUsd.sh script from the UsdImporter/Source/ThirdParty/Linux/build folder.

I had to:

  • rebuild the engine with bUseRTTI = true
  • delete the XMPP plugin as this was not compatible with RTTI
  • comment out LinuxToolChain.cs: CompileEnvironment.bHideSymbolsByDefault

Rebuild:

  • boost
  • tbb
  • python with openssl
  • usd

So far so good. Everything works and unreal starts up. But when trying to import Usd in the python console I get weird errors about loading in the build usd libraries. This should not happen - the library has just been build correctly within unreal engine environment.

Also trying to import usd in the terminal using the built python version fails with the same errors, seen below:



/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/localpython$ export PYTHONPATH=/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/InstalledUSD/lib/python
/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/localpython$ python
>>> from pxr import Usd

Warning: in Tf_PyLoadScriptModule at line 121 of /opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/USD/pxr/base/lib/tf/pyUtils.cpp -- Import failed for module 'pxr.Tf'!
Traceback (most recent call last):
  File "/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/InstalledUSD/lib/python/pxr/Tf/__init__.py", line 85, in <module>
    from . import _tf
TypeError: No Python class registered for C++ class pxrInternal_v0_19__pxrReserved__::TfType


… these continue for mostly all USD libraries until here …



Warning: in Tf_PyLoadScriptModule at line 121 of /opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/USD/pxr/base/lib/tf/pyUtils.cpp -- Import failed for module 'pxr.Pcp'!
Traceback (most recent call last):
  File "/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/InstalledUSD/lib/python/pxr/Pcp/__init__.py", line 24, in <module>
    import _pcp
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/build/unrealengine/4.23/Engine/Plugins/Importers/USDImporter/Source/ThirdParty/Linux/build/InstalledUSD/lib/python/pxr/Usd/__init__.py", line 24, in <module>
    import _usd
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases


Do you have any idea what this error could be and how it can be solved? I feel like I’m 99% finished with implementing the USD into UE4 Linux …
Can anybody please help me?

Kind regards