Maine

纵有疾风起,人生不言弃

Linux 下编译 USD

环境:elementary 5.0, 基于 ubuntu18.04。Python2.7.15

安装基本依赖

PySide 安装

# 安装 pyside
pip install pyside
# 或者使用下面的命令从软件源中安装
sudo apt install python-pyside

如果你的系统没有安装 qt4 可能会报错:

Installing collected packages: pyside
  Running setup.py install for pyside ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-jLsrun/pyside/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3Ab8AY-record/install-record.txt --single-version-externally-managed --compile:
    Removing /tmp/pip-build-jLsrun/pyside/pyside_package
    running install
    running build
    Python architecture is 64bit
    qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
    Failed to query the Qt version with qmake /usr/bin/qmake

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-jLsrun/pyside/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3Ab8AY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-jLsrun/pyside/

报错的话先安装 Qt4 之后再试上面的命令:

sudo apt install qt4-* 

PyOpenGl 安装

最好手动安装 PyOpenGL,因为默认 USD 安装脚本虽然也会安装 pyopengl,但很有可能因为权限安装失败。

# 使用 pip 安装
sudo pip install pyopengl
# 或者使用软件源安装
sudo apt install python-opengl

根据需要更新一下环境变量

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages/
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages/

开始编译:

python2.7 ./USD/build_scripts/build_usd.py -v ./BUILD/USD

编译完成之后,需要的话,配置一下环境变量

将 BUILD/USD/lib/python 路径加到 PYTHONPATH 中
将 BUILD/USD/bin 路径加到 PATH 中

测试

usdview ./USD/extras/usd/tutorials/convertingLayerFormats/Sphere.usda

正常显示的话就 OK 了。

可能的报错及解决办法:

  1. CMake Error at cmake/FindGLFW.cmake:146 (message):
    Xrandr library not found – required for GLFW

解决:

sudo apt install libxrandr-dev
  1. CMake Error at cmake/FindGLFW.cmake:154 (message):
    Xcursor library not found – required for GLFW

解决:

sudo apt install libxcursor-dev
  1. CMake Error at cmake/FindGLFW.cmake:158 (message):
    Xinerama library not found – required for GLFW

解决:

sudo apt install libxinerama-dev
  1. CMake Error at cmake/FindGLFW.cmake:162 (message):
    Xi library not found – required for GLFW
sudo apt install libxi-dev
  1. CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
    Could NOT find GLEW (missing: GLEW_LIBRARY)
sudo apt install libglew-dev
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注