#60896 closed defect (fixed)
cmake @3.18.0_1: Unable to find MacPorts zlib
Reported by: | jasonliu-- (Jason Liu) | Owned by: | michaelld (Michael Dickens) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | michaelld (Michael Dickens), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) | |
Port: | cmake openvdb |
Description
When trying to install openvdb @7.0.0
, openvdb's CMake file will call the FindZLIB
module to locate zlib. However, it's currently failing on my machine because the zlib that the cmake module is finding is the ancient macOS one located at /usr/lib/libz.dylib
(zlib version 1.2.5). Even if the MacPorts zlib is installed (version 1.2.11), the cmake module isn't seeing it. It's causing the following error to be generated:
:info:configure CMake Error at /opt/local/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message): :info:configure Could NOT find ZLIB: Found unsuitable version "1.2.5", but required is at :info:configure least "1.2.7" (found //usr/lib/libz.dylib) :info:configure Call Stack (most recent call first): :info:configure /opt/local/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:456 (_FPHSA_FAILURE_MESSAGE) :info:configure /opt/local/share/cmake-3.18/Modules/FindZLIB.cmake:115 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) :info:configure openvdb/CMakeLists.txt:80 (find_package)
My system's info:
- macOS 10.11.6 15G22010
- Xcode 8.2.1 8C1002
port installed | grep zlib
:zlib @1.2.11_0 (active)
port installed | grep cmake
:cmake @3.18.0_1 (active)
I didn't encounter this issue when installing openvdb
on a "brand new" MacPorts machine (i.e. MacPorts had just been newly installed on it a few minutes before, and thus had no previously installed ports, etc.). This new machine had macOS 10.15 Catalina and Xcode 11.5. I'm not sure whether that's because the /usr/lib/libz.dylib
is a new enough version of zlib that it's not generating the error, or something else. (I no longer have access to the 10.15 machine, so the previous sentence is just speculation on my part.)
Also, one more observation. If you take a look at the log, the messages from just before the error I quoted above show that other cmake modules are able to see MacPorts ports, and so seems to indicate that the problem appears to be specific to just zlib, and not all cmake modules.
:info:configure -- ---------------------------------------------------- :info:configure -- ------------- Configuring OpenVDBCore -------------- :info:configure -- ---------------------------------------------------- :info:configure -- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2") :info:configure -- Found IlmBase: /opt/local/include/OpenEXR (found suitable version "2.3", minimum required is "2.2") found components: Half :info:configure -- Found TBB: /opt/local/include (found suitable version "2020.3", minimum required is "2017.0") found components: tab
Attachments (1)
Change History (9)
Changed 4 years ago by jasonliu-- (Jason Liu)
comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | michaelld MarcusCalhoun-Lopez added |
---|
I don't know how these cmake Find scripts are meant to work. Certainly I wouldn't expect cmake as shipped from its developers to find things in MacPorts paths. I don't know whether or how we are patching cmake in MacPorts to do this.
I do see in /opt/local/share/cmake-3.18/Modules/FindZLIB.cmake a comment that says:
A user may set
ZLIB_ROOT
to a zlib installation root to tell this module where to look.
So maybe openvdb needs to do that.
comment:2 follow-up: 8 Changed 4 years ago by michaelld (Michael Dickens)
Owner: | set to michaelld |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:3 Changed 4 years ago by kencu (Ken)
You would hope that our MacPorts cmake installation would find our MacPorts zlib ahead of any system one, even without forcing it like this...
comment:4 Changed 4 years ago by michaelld (Michael Dickens)
One would indeed hope ... but unfortunately it doesn’t! I tested & it finds the Xcode version or nothing ... so this ‘hint’ is required ... sadly! I wonder if this could be moved into the main CMake port .... hmmmm ...
comment:5 Changed 4 years ago by jasonliu-- (Jason Liu)
I have also tested it, and can confirm that adding the ZLIB_ROOT fixes the openvdb port on my macOS 10.11 + Xcode 8.2 machine.
comment:6 Changed 4 years ago by kencu (Ken)
Yes, no doubt - but ideally our cmake would be configured to find MacPorts' newer installed libraries ahead of older system ones without explicitly doing this for each one.
I'm wondering why it isn't doing that here... ie does our cmake installation need tweaking, or is this something in openvdb that is not correctly written? If the latter, forcing it is our only option.
comment:7 Changed 4 years ago by michaelld (Michael Dickens)
comment:8 Changed 4 years ago by michaelld (Michael Dickens)
Replying to michaelld:
In c7785a9458d38c428d3ca0a589bb3b5dccddb3ad/macports-ports (master):
@kencu can you test by removing this commit & see if this port now works? It does for me now. If so, let's revert this commit since it is no longer needed.
Log file for 'port install openvdb'