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.63k stars 615 forks source link

zlib #1369

Open sigurdle opened 1 year ago

sigurdle commented 1 year ago

Hi, Sorry for asking this, as I know it's probably been asked and answered many times, but I can't for the life of me get this to work:

I'm new to visual studio, cmake etc. I'm on windows 11, using ubuntu subsystem (not sure how this works, but that's what I'm trying)

As I try to compile openexr in Visual Studio through the cmake files, I get this error:

D:\Downloads\dev\openexr-3.1.6\out\build\x64-Debug\ninja : error : 'zlib-install/lib/zlibstaticd.lib', needed by 'bin/OpenEXRCore-3_1_d.dll', missing and no known rule to make it

Which is to be expected reading stuff online...

I've tried this in the terminal:

sudo apt-get install zlib1g-dev

But I have no idea how to fix this... any help appreciated

meshula commented 1 year ago

You're "crossing the streams" a bit there with linux and windows both in the mix. If you're begining Windows development, I wouldn't start with trying to attempt things like cross compiling from linux to windows.

I'd suggest starting here https://openexr.com/en/latest/install.html and working through the steps listed one by one, and if you bump into problems, come back here and we can answer further questions.

Vertexwahn commented 1 year ago

You can also use Bazel to build OpenEXR -> https://github.com/Vertexwahn/BazelDemos/tree/main/third_party_libraries/cpp/OpenEXR

hlu2021 commented 1 year ago

Hi sigurdle, have you fixed the zlib problem? How did you fix it? Thanks!

sigurdle commented 1 year ago

Hi, I am crossing streams, but not on purpose. I don't care about Linux, but it in many how to "install" documentaions, there just seems to be easier for linux, things being made with linux in mind, that's why I thought to try things the linux way even on windows. But I see that Visual Studio has more support for cross development with CMake. So I had to learn a bit (didn't really know what CMake was), but it seems to be the linux way, being adopted now also by Visual Studio. I never figured out how to properly do zlib, I downloaded the dev files, compiled it without problems in VisualStudio, but it didn't produce the file required by openexr. So I ended up downloading a precompiled zlib file that I found on some random github project (not a good/permanent solution)

meshula commented 1 year ago

Ah, my misunderstanding, sorry. Since you were mentioning apt-get, I thought you were attempting to do something with WSL or MinGW.

@hlu2021 recently posted steps that worked here ~ https://github.com/AcademySoftwareFoundation/openexr/issues/1374

Unfortunately zlib is causing a challenge for both of you, I think we (the OpenEXR team) need to investigate why that is, the build is supposed to take care of zlib on windows transparently.

kmilos commented 1 year ago

Btw, one can/should grab all the dependencies for Visual Studio builds via vcpkg instead of trying to jerry-rig, and I suggest OpenEXR maintainers should check (and promote) the instructions work w/ those.

meshula commented 1 year ago

Thanks for bringing up vcpkg. I would also note that the vckpg build of OpenEXR is usually reasonably up to date. https://github.com/microsoft/vcpkg/blob/7a98b9a727175eae45ff198c413e382a68468e26/ports/openexr/portfile.cmake

It seems logical that a vcpkg user would be asking vcpkg for openexr as well, as opposed to building from source.

The OpenEXR package in vcpkg has a large number of upstream dependencies. So you can encounter subtle or serious bugs when you mix your OpenEXR build with other things you are depending on that are built against the vcpkg version. The issues come from things like preprocessor macros in your local build must match vcpkg's, and you also need to be aware of differences that vcpkg introduces to cmake find_package scripts which need local patching if you want your vcpkg based build to find the OpenEXR you built, rather than the one in their cache. (for example, here is a discussion previously where we worked through conflicts with vcpkg's cmake for OpenEXR https://github.com/AcademySoftwareFoundation/openexr/issues/648)

If someone were to write instructions for building OpenEXR from source, using vcpkg as the method to get zlib, the instructions should definitely list the pitfalls, and workarounds.

I do wonder what the right place for this kind of information is. Perhaps an issue, like this one, so that people can work through it with others to resolve problems, or if maybe it needs a wiki entry or something.