AcademySoftwareFoundation / openexr

The OpenEXR project provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the motion picture industry.
http://www.openexr.com/
BSD 3-Clause "New" or "Revised" License
1.62k stars 608 forks source link

Unable to build openexr with python bindings via cmake #1610

Open CGStirk opened 7 months ago

CGStirk commented 7 months ago

I'm trying to build openexr with python 3.11 bindings on windows 11 with cmake, but I am running into issues. While build files are generated and it appears to complete without failing, no exe or py files are created. I'm not experienced with cmake or building from source so this may be user-error.

I first tried this via the VS 2022 command prompt, but it tries to use PkgConfig, which is not included, so I'm using msys2 mingw64. I then built boost from source and built boost python, but cmake cannot find boost python. I'm unclear on how to show where it is. I've provided the terminal log here: msys2_terminal.txt

I'm also assuming it's looking for "libboost_python311-vc143-mt-x64-1_84.lib", which by default was built here: ..\boost_1_84_0\stage\lib.

The other approach I tried was building an x64 release of openexr in Visual Studio directly, following the instructions provided here #1374. This successfully created the exe files, but I don't know how to build the python bindings with this method if that's even possible to do. Any assistance would be most appreciated.

cary-ilm commented 7 months ago

Are you attempting to build the python bindings for OpenEXR or for Imath? The OpenEXR bindings don't use boost, so that shouldn't be a problem.

Can you include the log file of the build?

CGStirk commented 7 months ago

I'm trying to build the python bindings for openexr, not for Imath. Here is the CMakeConfigureLog.yaml file (converted to txt for uploading) CMakeConfigureLog.txt. This is the only log I see besides the terminal output I provided, but please let me know if you need something else.

cary-ilm commented 7 months ago

I'm not sure how to interpret the CMakeConfigureLog.txt, except that a step is failing to find pthread.h.

The msys2_terminal.txt log you included above is for the cmake configuration but not the build itself. If you're new to cmake, you generally run it twice: once to generating the configuration files, and second time to actually do the compilation, something like cmake --build .

I think the complaints about boost are a red herring you can ignore, although I have no experience with Windows so I'm not entirely sure what's going on.

CGStirk commented 7 months ago

Apologies. I did not realize there was an additional step to build, but that now makes sense given that I could build the exe’s in Visual Studio after the initial cmake command and I was confused as to why I had to use VS to generate them.

I also now realize I have been using the wrong flag -DPYTHON, which is for Imath, not for openexr. I believe I should be using -DOPENEXR_BUILD_PYTHON which is listed in the root CMakeCache.txt file. This did not solve the problem though.

Running cmake --build . by using a standard install of Windows CMake fails due to an issue with libdeflate.h. Here is the terminal log: cmake_log_failed.txt

I then switched to msys2’s cmake with ninja, which did not report any failures as far as I can tell. This generated exe’s in the bin folder but no python files. I don’t know whether to expect a whl file or py files. Here are the terminal logs for that: msys2_cmake_log.txt