dreamworksanimation / openmoonray

MoonRay is DreamWorks’ open-source, award-winning, state-of-the-art production MCRT renderer.
https://openmoonray.org/
Apache License 2.0
4.32k stars 254 forks source link

Could NOT find Python3: Found unsuitable version "3.10", but required is exact version "3.10.13" (found /buildAgent/work/4946e30737d0d252/_build/target-deps/python/include/python3.10 #141

Open disini opened 9 months ago

disini commented 9 months ago

Hi, I'm trying to compile this project on ubuntu 22.04.3, with Clion 2023.2 IDE, and there're some issues on the cmake stage:

CMake Error at /media/liusheng/Programs/Programs/jetbrains/clion/clion-2023.2/ubuntu/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3: Found unsuitable version "3.10", but required is
  exact version "3.10.13" (found
  /buildAgent/work/4946e30737d0d252/_build/target-deps/python/include/python3.10,
  )

      Reason given by package: 
          Development: Cannot find the directory "/buildAgent/work/4946e30737d0d252/_build/target-deps/python/include/python3.10"
                                                                                                                      Cannot find the library "/buildAgent/work/4946e30737d0d252/_build/target-deps/python/lib/libpython3.10.so"

Call Stack (most recent call first):
  /media/liusheng/Programs/Programs/jetbrains/clion/clion-2023.2/ubuntu/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
  /media/liusheng/Programs/Programs/jetbrains/clion/clion-2023.2/ubuntu/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindPython/Support.cmake:3766 (find_package_handle_standard_args)
  /media/liusheng/Programs/Programs/jetbrains/clion/clion-2023.2/ubuntu/bin/cmake/linux/x64/share/cmake-3.26/Modules/FindPython3.cmake:551 (include)
  /media/liusheng/Programs/Programs/libs/usd/0.23.11/linux/pxrConfig.cmake:44 (find_package)
  moonray/hydra/hdMoonray/CMakeLists.txt:42 (find_package)

"
                                                                                                                      Cannot find the library "/buildAgent/work/4946e30737d0d252/_build/target-deps/python/lib/libpython3.10.so"

I've updated the openmmonray and all dependencies code to the latest version, and I checked the lib "libpython3.10.so" mentioned above, it's exactly version 3.10.13,
but the value that the cmake read out is "3.10", so, where could I modify the numbers to "3.10.13" instead of "3.10" to fix that problem ? I mean where is the file that indicate the PYTHON VERSION in the USD lib directory?

Or any other better idea to solve this problem?

Thanks so much!

disini commented 9 months ago

I searched the files in the USD lib directory and find out this: /libs/usd/0.23.11/linux/python/include/python3.10/patchlevel.h:


/* Python version identification scheme.

   When the major or minor version changes, the VERSION variable in
   configure.ac must also be changed.

   There is also (independent) API version information in modsupport.h.
*/

/* Values for PY_RELEASE_LEVEL */
#define PY_RELEASE_LEVEL_ALPHA  0xA
#define PY_RELEASE_LEVEL_BETA   0xB
#define PY_RELEASE_LEVEL_GAMMA  0xC     /* For release candidates */
#define PY_RELEASE_LEVEL_FINAL  0xF     /* Serial should be 0 here */
                                        /* Higher for patch releases */

/* Version parsed out into numeric values */
/*--start constants--*/
#define PY_MAJOR_VERSION        3
#define PY_MINOR_VERSION        10
#define PY_MICRO_VERSION        13
#define PY_RELEASE_LEVEL        PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL       0

/* Version as a string */
#define PY_VERSION              "3.10.13"
/*--end constants--*/

/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
   Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
                        (PY_MINOR_VERSION << 16) | \
                        (PY_MICRO_VERSION <<  8) | \
                        (PY_RELEASE_LEVEL <<  4) | \
                        (PY_RELEASE_SERIAL << 0))

the PY_VERSION is definitely "3.10.13",

Found unsuitable version "3.10", but required is
  exact version "3.10.13"

but why cmake indicate that ?

it's weird。。。。

matthewlow-dwa commented 8 months ago

My guess is that it is the pxrConfig.cmake generated from the local USD build that is specifying an exact version of 3.10.13: /media/liusheng/Programs/Programs/libs/usd/0.23.11/linux/pxrConfig.cmake

find_package(Python3 "3.10.13" EXACT COMPONENTS Development REQUIRED)

This change was introduced in USD v0.23.08, however Open MoonRay has only been validated up to USD v0.22.11: https://github.com/PixarAnimationStudios/OpenUSD/pull/2093

I am unsure why CMake is finding Python with Python3_VERSION of just 3.10, which would not be an exact match for 3.10.13. Perhaps it is due to the introduction of Python Stable ABI support in CMake v3.26 (we use v3.25 internally), or some other config related to your Python install.

To work around this, you could consider modifying the pxrConfig.cmake to specify 3.10 (instead of 3.10.13), rolling back to a supported USD version or CMake v3.25, or changing the Python component to Python3 to pre-define Python3_VERSION in hdMoonray/CMakeLists.txt.

disini commented 6 months ago

My guess is that it is the pxrConfig.cmake generated from the local USD build that is specifying an exact version of 3.10.13: /media/liusheng/Programs/Programs/libs/usd/0.23.11/linux/pxrConfig.cmake

find_package(Python3 "3.10.13" EXACT COMPONENTS Development REQUIRED)

This change was introduced in USD v0.23.08, however Open MoonRay has only been validated up to USD v0.22.11: PixarAnimationStudios/OpenUSD#2093

I am unsure why CMake is finding Python with Python3_VERSION of just 3.10, which would not be an exact match for 3.10.13. Perhaps it is due to the introduction of Python Stable ABI support in CMake v3.26 (we use v3.25 internally), or some other config related to your Python install.

To work around this, you could consider modifying the pxrConfig.cmake to specify 3.10 (instead of 3.10.13), rolling back to a supported USD version or CMake v3.25, or changing the Python component to Python3 to pre-define Python3_VERSION in hdMoonray/CMakeLists.txt.

Thank you for your advice, I tried to fix this issue but there's more errors sprang out, I am considerring to find a machine with Centos or Rocky system, it's to troublesome to compile this on ubuntu..... Thanks you all the way buddy!