Open hlu2021 opened 1 year ago
Take a look at the CI instructions to see how OpenEXR is built using CMake.
Thank you Vertexwahn for your kind reply. I've installed Bazel and tried 'bazel run //:Demo '. But lots of errors that I don't understand. I also checked the CI instructions, but due to my limited knowledge on code compile, I don't understand how to use the content in the work flow either. Is there a step by step instruction on how to use cmake to build opener? Thanks.
you should be able to do this:
cd myProjectDir
git clone https://github.com/AcademySoftwareFoundation/openexr
mkdir openexr-build
cd openexr-build
cmake ../openexr -DCMAKE_INSTALL_PREFIX=./install
then build the using the generated build system files. You'll want to pick the "INSTALL" target to build. When it's done, the install directory will have the typical bin, lib, include, and so on.
Once you're comfortable with that, then you should think about where you really want to install to, and do the above process again, changing the install prefix as needed.
In general, you shouldn't see the error about Imath, because OpenEXR automatically installs Imath if it can't find it. To diagnose those sorts of problems, we'd need to know more, like what OS you are on, what tool chain you are using, and so on. But I'd definitely try to get an out of the box build going before working on anything like that.
I would also want to verify that you are building a current version of OpenEXR, not something in the OpenEXR 2 series - the "2" series requires a lot more build knowledge and skills than the 3 series.
Hi Meshula, I'm able to build without error after rebuilding the zlib in visual studio. But the generated file only consist of a 'bin' folder, no lib, include folder. Do you have any idea what could be wrong? Thanks
Even though it complains during configuration that Imath wasn't found, it will download it automatically when you build. Our messages should be better, instead of reporting an error, it should report that it couldn't find Imath, and it should then say something like "Imath will be downloaded automatically when you build". But it doesn't say that. Anyway,
I just verified things work here, on a clean windows 2022 machine.
So, maybe try again, in a clean directory?
these steps succeeded for me just now.
on second thought, your error messages show a problem with zlib symbols not being found. I do wonder if maybe cmake is finding the wrong zlib on your system somehow?
Could you attach your CMakeCache.txt file please? That might have some clues in it.
Hi Meshula, you are right. After rebuilding the zlib in visual studio, I'm able to build without error. The CMakeCache file after the build is attached above. The problem right now is the generated file only consist of a 'bin' folder, no lib, include folder. Do you have any idea what could be wrong? Thanks
Hi Meshula, thank you very much! I tried your solution above, and it works. The install folder now has bin, include, lib, and share. Thank you so much for your generous help.
Great! Glad it's working for you now. If there's any improvement you can think of for our build instructions that would have made the experience better for you, we'd be happy to modify the instructions.
Hi Meshula, I think the 5 steps you have above works good for me. Also, the Workflow in the link below helps to me identify which error message to ignore and the library I need is clang and zlib. https://github.com/AcademySoftwareFoundation/openexr/actions/runs/4571082241/jobs/8069046804
Besides, since I don't have much experience with library build, I struggled with clang and zlib installation a little bit. I summarized below a full list of what works for me. Hope it can be helpful for others to use openexr in windows.
Hi Meshula, now It seems that I have built the openexr without error. But I'm not sure how can I use the function in the library. I have two more question regarding using openexr.
I would recommend reading the source code for the various tools in src/bin, or the examples in src/examples.
For python, OpenImageIO might be a good place to explore. It will open more than just OpenEXR files. OpenEXR itself hasn't got an official Python bindings otherwise, although there are unofficial bindings here https://pypi.org/project/OpenEXR/
And thanks for your build notes, much appreciated!
@hlu2021 I added some notes how to setup it here: https://github.com/Vertexwahn/BazelDemos/tree/main/third_party_libraries/cpp/OpenEXR
@meshula @hlu2021
Thanks for refining the build instructions - was having trouble getting a build to work on Windows w/ Visual Studio yesterday, before finally finding your solution.
I'm not sure if it was a struggle because of my unfamiliarity with VS / Cmake (common knowledge?), but I think the outlined steps could be a good addition to the install instructions.
I'm using the command 'cmake ..' to build in windows 10 and get a error message below, It seems that the openexr hasn't been properly installed. Anyone can help recommend what command I should try? Thanks
By not providing "FindImath.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Imath", but CMake did not find one.
Could not find a package configuration file provided by "Imath" (requested version 3.1) with any of the following names:
Add the installation prefix of "Imath" to CMAKE_PREFIX_PATH or set "Imath_DIR" to a directory containing one of the above files. If "Imath" provides a separate development package or SDK, be sure it has been installed.