PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.11k stars 1.21k forks source link

Build error with Python 3.10 #1923

Closed goetzmoritz closed 2 years ago

goetzmoritz commented 2 years ago

I try to compile on Ubuntu 22.04 LTS (GNU/Linux 5.15.0-1010-gcp x86_64) with python 3.10 with the prman-flag enabled.

This is how far I get

2022-06-27 14:43
cmake -DCMAKE_INSTALL_PREFIX="/usr/local/USD" -DCMAKE_PREFIX_PATH="/usr/local/USD" -DCMAKE_BUILD_TYPE=Release    -DPXR_PREFER_SAFETY_OVER_SPEED=ON -DPXR_ENABLE_PYTHON_SUPPORT=ON -DPXR_USE_PYTHON_3=ON -DPXR_USE_DEBUG_PYTHON=OFF -DPYTHON_EXECUTABLE="/usr/bin/python" -DPYTHON_LIBRARY="/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/libpython3.10.so" -DPYTHON_INCLUDE_DIR="/usr/include/python3.10" -DBUILD_SHARED_LIBS=ON -DTBB_USE_DEBUG_BUILD=OFF -DPXR_BUILD_DOCUMENTATION=OFF -DPXR_BUILD_TESTS=OFF -DPXR_BUILD_EXAMPLES=ON -DPXR_BUILD_TUTORIALS=ON -DPXR_BUILD_USD_TOOLS=ON -DPXR_BUILD_IMAGING=ON -DPXR_ENABLE_PTEX_SUPPORT=OFF -DPXR_ENABLE_OPENVDB_SUPPORT=OFF -DPXR_BUILD_EMBREE_PLUGIN=OFF -DPXR_BUILD_PRMAN_PLUGIN=ON -DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF -DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF -DPXR_BUILD_USD_IMAGING=ON -DPXR_BUILD_USDVIEW=ON -DPXR_BUILD_ALEMBIC_PLUGIN=OFF -DPXR_BUILD_DRACO_PLUGIN=OFF -DPXR_ENABLE_MATERIALX_SUPPORT=OFF -DBoost_NO_BOOST_CMAKE=On -DBoost_NO_SYSTEM_PATHS=True "/home/myuser/USD"
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Boost: /usr/local/USD/include (found version "1.70.0")  
-- Disabling boost-provided cmake config
-- Found PythonInterp: /usr/bin/python (found suitable version "3.10.4", minimum required is "3.0") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/libpython3.10.so (found suitable version "3.10.4", minimum required is "3.0") 
CMake Warning at /usr/share/cmake-3.22/Modules/FindBoost.cmake:2201 (message):
  No header defined for python310; skipping header check (note: header-only
  libraries have no designated component)
Call Stack (most recent call first):
  cmake/defaults/Packages.cmake:95 (find_package)
  CMakeLists.txt:23 (include)

-- Found Boost: /usr/local/USD/include (found version "1.70.0") found components: python310 
-- Found Jinja2
-- Found Boost: /usr/local/USD/include (found version "1.70.0") found components: program_options 
-- Found TBB: /usr/local/USD/include (found version "2018.0") found components: tbb 
-- Using default system allocator because PXR_MALLOC_LIBRARY is unspecified
CMake Deprecation Warning at cmake/defaults/Packages.cmake:207 (cmake_policy):
  The OLD behavior for policy CMP0072 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:23 (include)

-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found OpenSubdiv: /usr/local/USD/include (found suitable version "3.4.4", minimum required is "3") 
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found PySide2: with /usr/bin/python, will use /home/myuser/.local/bin/pyside2-uic for pyside-uic binary
-- Found PySide: True  
-- Found PyOpenGL
-- Found PyOpenGL: True  
-- Found Renderman: /opt/pixar/RenderManProServer-24.4/include  
-- C++ namespace configured to (external) pxr, (internal) pxrInternal_v0_22
-- Skipping validation of gf generated code because PXR_VALIDATE_GENERATED_CODE=OFF
-- Skipping validation of sdf generated code because PXR_VALIDATE_GENERATED_CODE=OFF
-- Skipping alembic-based usddiff tests because PXR_BUILD_ALEMBIC_PLUGIN=OFF
-- Skipping Draco-based usddiff tests because PXR_BUILD_DRACO_PLUGIN=OFF
-- Skipping hgiMetal because PXR_BUILD_GPU_SUPPORT or PXR_ENABLE_METAL_SUPPORT is OFF
-- Skipping hgiVulkan because PXR_BUILD_GPU_SUPPORT or PXR_ENABLE_VULKAN_SUPPORT is OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/USD/build/USD
2022-06-27 14:43
cmake --build . --config Release --target install -- -j12
[  0%] Generating __init__.pyc
[  1%] Copying align.h ...

...

[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/pyPtrHelpers.cpp.o
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/pyResultConversions.cpp.o
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/pySingleton.cpp.o
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/pyUtils.cpp.o
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/pyWrapContext.cpp.o
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/scriptModuleLoader.cpp.o
gmake[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/libpython3.10.so', needed by 'pxr/base/tf/libusd_tf.so'.  Stop.
gmake[2]: *** Waiting for unfinished jobs....
[ 32%] Building CXX object pxr/base/tf/CMakeFiles/tf.dir/wrapTypeHelpers.cpp.o
gmake[1]: *** [CMakeFiles/Makefile2:2339: pxr/base/tf/CMakeFiles/tf.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

I assume that might be attached to the Python 3.10 issues, however I have no idea how to fix that. However, this file /usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/libpython3.10.so is not present. libpython3.10 is present.

sunyab commented 2 years ago

Try double-checking that you have the libpython3.10 package installed along with libpython3.10-dev. According to the Ubuntu packages page, the former contains the shared libraries. If you don't have that installed, that might explain why libpython3.10.so is not present.

Also, you could try updating to a newer version of cmake. The warnings from the FindBoost module were fixed in v3.22.2 and there are possibly other CMake fixes that affect the discovery of Python 3.10.

goetzmoritz commented 2 years ago
$ cmake --version
cmake version 3.24.20220627-g80e4a15

$ sudo apt-get install libpython3.10-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libpython3.10-dev is already the newest version (3.10.4-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt-get install libpython3.10
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libpython3.10 is already the newest version (3.10.4-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

However compilation of USD is still stuck.

edit: FYI, I had to apply that little hack with _Py_fopen in the boost-library in order to compile properly.

goetzmoritz commented 2 years ago

By only using prman as a flag it works.