openpose icon indicating copy to clipboard operation
openpose copied to clipboard

M1 Mac Installation Issues: `Could NOT find HDF5`

Open ahalev opened this issue 1 year ago • 5 comments

Issue Summary

Running into

Could NOT find HDF5 (missing: HDF5_INCLUDE_DIRS) (found version "")

when running make on an M1 mac.

Executed Command (if any)

While running

make -j `sysctl -n hw.logicalcpu`

on an Apple Silicon (M1) mac, I run into the error below.

OpenPose Output (if any)

Errors (if any)

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find HDF5 (missing: HDF5_INCLUDE_DIRS) (found version "")
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.25/Modules/FindHDF5.cmake:1007 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:61 (find_package)
  CMakeLists.txt:127 (include)

Type of Issue

  • Compilation/installation error

Your System Configuration

  1. Whole console output (if errors appeared), paste the error to PasteBin and then paste the link here: https://pastebin.com/c9sjN4mH

  2. OpenPose version: Latest GitHub code? Or specific commit (e.g., d52878f)? Or specific version from Release section (e.g., 1.2.0)?

Latest GitHub code: 5e57c2d0181dca49095b0853a2421fa310b77f03

  1. General configuration:
    • Installation mode: CMake
    • Operating system: macOS Monterey
    • Operating system version: 12.6
    • Release or Debug mode?: release
    • Compiler:
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  1. Non-default settings:
    • 3-D Reconstruction module added?: no
    • Any other custom CMake configuration with respect to the default version?:

I have modified CMakeLists.txt (in the openpose base directory) to fix some compilation issues. I changed lines 427-429 to

set(GFlags_PREFIX_PATH
    "/opt/homebrew/Cellar/gflags/2.2.2/include"
    "/opt/homebrew/Cellar/gflags/2.2.2/lib"
    "/opt/homebrew/Cellar/gflags/2.2.2/bin")
list(APPEND CMAKE_PREFIX_PATH "${GFlags_PREFIX_PATH}")  
  find_package(GFlags) # For Caffe and OpenPose
set(Glog_PREFIX_PATH
    "/opt/homebrew/Cellar/glog/0.6.0/include"
    "/opt/homebrew/Cellar/glog/0.6.0/lib")
list(APPEND CMAKE_PREFIX_PATH "${Glog_PREFIX_PATH}")
find_package(Glog)
  set(Protobuf_PREFIX_PATH
    "/opt/homebrew/Cellar/protobuf/21.12/include"            
    "/opt/homebrew/Cellar/protobuf/21.12/lib"             
    "/opt/homebrew/Cellar/protobuf/21.12/bin" )
list(APPEND CMAKE_PREFIX_PATH "${Protobuf_PREFIX_PATH}")
find_package(Protobuf REQUIRED)

to fix compilation issues with Gflags, Glog, and Protobuf (e.g. Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)).

  1. 3rd-party software:
    • Caffe version: I'm not sure how to find this.
    • CMake version: cmake version 3.26.3
    • OpenCV version: also unsure how to find this.

Thank you in advance for your help!

ahalev avatar May 12 '23 18:05 ahalev

Things I have tried:

  1. Adding the following code block to CMakeLists.txt in the openpose project directory:
  set(HDF5_PREFIX_PATH
    "/opt/homebrew/Cellar/hdf5/1.14.0/include"            
    "/opt/homebrew/Cellar/hdf5/1.14.0/lib"             
    "/opt/homebrew/Cellar/hdf5/1.14.0/bin" )
list(APPEND CMAKE_PREFIX_PATH "${HDF5_PREFIX_PATH}")
find_package(HDF5)

(I think this is the wrong CMakeList.txt, but I don't want to mess with the system ones).

  1. Setting the following environment variables:
export CPATH="$CPATH:/opt/homebrew/include:/opt/homebrew/Cellar/hdf5"
export LIBRARY_PATH="/opt/homebrew/lib:/opt/homebrew/Cellar"
export HDF5_DIR="/opt/homebrew/opt/"
export BLOSC_DIR="/opt/homebrew/opt/"

ahalev avatar May 12 '23 18:05 ahalev

I have made some progress by disabling BUILD_CAFFE and setting

Caffe_INCLUDE_DIRS=/opt/homebrew/Cellar/caffe/1.0_43.reinstall/include
Caffe_LIBS=/opt/homebrew/Cellar/caffe/1.0_43.reinstall/lib

Now, however, I'm running into:

/opt/homebrew/Cellar/caffe/1.0_43.reinstall/include/caffe/util/device_alternate.hpp:34:10: fatal error: 'cublas_v2.h' file not found

Digging around, this suggests I need to have CUDA installed, which I don't think is possible on an M1 mac.

Is it possible to install openpose on an M1 mac?

ahalev avatar May 12 '23 20:05 ahalev

Hi Avishai, Did you finally manage to install OpenPose on your Mac (M1)?

GermanDavid avatar Sep 12 '23 13:09 GermanDavid

I did not. I didn't persist much further than the above.

ahalev avatar Sep 14 '23 17:09 ahalev

I also encountered the same problem

vueadmin avatar Apr 19 '24 01:04 vueadmin