Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac install update scripts #1765

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions doc/installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ We add links to some community-based work based on OpenPose. Note: We do not sup
- Option 1:
- 1. (if necessary) Install the latest version of docker (There are extra steps, but if you're on Ubuntu, the main one is `sudo apt-get install docker-ce`. Other steps can be found [here](https://phoenixnap.com/kb/how-to-install-docker-on-ubuntu-18-04) )
- 2. `docker pull exsidius/openpose` - [Guide](https://github.com/gormonn/openpose-docker/blob/master/README.md)
- 3. [more details](https://cloud.docker.com/repository/docker/exsidius/openpose/general)
- 3. [more details](https://cloud.docker.com/repository/docker/exsidius/openpose/general)
- [Link 2](https://github.com/esemeniuc/openpose-docker), it claims to also include Python support. Read and post ONLY on [issue thread #1102](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1102).
- [Link 3](https://github.com/ExSidius/openpose-docker/blob/master/Dockerfile).
- [Link 4](https://cloud.docker.com/repository/docker/exsidius/openpose/general).
Expand Down Expand Up @@ -297,15 +297,12 @@ If you only have an integrated Intel Graphics card, then it will most probably b
./build/examples/openpose/openpose.bin --num_gpu 1 --num_gpu_start 1
```

Also as a side note, if the default installation fails (i.e., the one explained above), install Caffe separately and set `BUILD_CAFFE` to false in the CMake config. Steps:
Also as a side note, if the default installation (i.e., the one explained above) fails since it `cannot find vecLib`,
or if you get a `Attempt to free invalid Pointer` runtime error, configure caffe manually to not include the `leveldb` dependency. Steps:
- Re-create the build folder: `rm -rf build; mkdir build; cd build`.
- `brew uninstall caffe` to remove the version of Caffe previously installed via cmake.
- `brew install caffe` to install Caffe separately.
- Run `cmake-gui` and make the following adjustments to the cmake config:
1. `BUILD_CAFFE` set to false.
2. `Caffe_INCLUDE_DIRS` set to `/usr/local/include/caffe`.
3. `Caffe_LIBS` set to `/usr/local/lib/libcaffe.dylib`.
4. Run `Configure` and `Generate` from CMake GUI.
- Follow the **Problem with installing Caffe from homebrew** in the [prerequisite.md](prerequisites.md#problem-with-installing-caffe-from-homebrew) file, under Mac OS Prerequisites.
- Run `cmake-gui` and click `Configure` and `Generate`.

In addition, if you face an OpenCV error during compiling time similar to `fatal error: 'opencv2/highgui/highgui.hpp' file not found`, please apply the following patch (this error has been reported in the latest OSX 10.14):
```bash
Expand Down
56 changes: 55 additions & 1 deletion doc/installation/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OpenPose - Prerequisites
### General Tips
**Very important**: New Nvidia model GPUs (e.g., Nvidia V, GTX 2080, v100, any Nvidia with Volta or Turing architecture, etc.) require (at least) CUDA 10. CUDA 8 would fail!

In addition, CMake automatically downloads all the OpenPose models. However, **some firewall or company networks block these downloads**.
In addition, CMake automatically downloads all the OpenPose models. However, **some firewall or company networks block these downloads**.

You might prefer to download them manually:
- [BODY_25 model](http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/body_25/pose_iter_584000.caffemodel): download in `models/pose/body_25/`.
Expand Down Expand Up @@ -71,6 +71,60 @@ You might prefer to download them manually:
1. If you don't have `brew`, install it by running `bash scripts/osx/install_brew.sh` on your terminal.
2. Install **CMake GUI**: Run the command `brew cask install cmake`.
3. Install **Caffe, OpenCV, and Caffe prerequisites**: Run `bash scripts/osx/install_deps.sh`.

<a name="problem-with-installing-caffe-from-homebrew"></a>
#### [Problem with installing Caffe from homebrew]:

If you have installed Caffe from homebrew, you might run into an `Attempt to free invalid pointer`. In such a case, the **leveldb** dependency of Caffe is causing an issue. There is a very simple fix.

Note: If you have not, uninstall the current Caffe bottle:
`brew uninstall caffe`

Go to the 3rd party folder and clone the caffe repo:
```
cd 3rdparty
rm -rf caffe
git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe.git
```

Now, we have to make a change to the Caffe cmake configurations:

```
vi caffe/cmake/Modules/FindvecLib.cmake
```

Out here, look for the following line:
`find_path(vecLib_INCLUDE_DIR vecLib.h`

and under that there should be a `PATH` variable.

Set the path Variable to `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/` or where ever else you have your vecLib headers. This is cruicial.

Ensure that you have `NO_DEFAULT_PATH` set.

The file should now contain this:

```
find_path(vecLib_INCLUDE_DIR vecLib.h
DOC "vecLib include directory"
PATHS /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/
NO_DEFAULT_PATH)
```
This will fix the `vecLib` not found issues when `BUILD_CAFFE` is run.
Now we have to remove the `leveldb` dependency, and build without it. The `leveldb` dependency is the library that is causing the issue of `Attempt to Free Invalid Pointer`, not the `tcmalloc`. This is a documented issue on their [github repo](https://github.com/google/leveldb/issues/634).

To do this we need to edit the `CMakeLists.txt` file for caffe.

Run `vi caffe/CMakeLists.txt`.

Look for the following line: `caffe_option(USE_LEVELDB "Build with levelDB" ON)`.
We need to set this to off:

`caffe_option(USE_LEVELDB "Build with levelDB" OFF)`

Once you are done with this, you may continue the build process as usual.
Make sure that `BUILD_CAFFE` is set to ON.

4. **Eigen prerequisite** (optional, only required for some specific extra functionality, such as extrinsic camera calibration):
- Enable the `WITH_EIGEN` flag when running CMake, and set it to `AUTOBUILD`.
- CMake will automatically download Eigen.
Expand Down
2 changes: 1 addition & 1 deletion scripts/osx/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ brew install openblas
brew install -vd snappy leveldb gflags glog szip lmdb
brew install hdf5 opencv
# with Python pycaffe needs dependencies built from source
#brew install --build-from-source --with-python -vd protobuf
#brew install --build-from-source -vd protobuf
#brew install --build-from-source -vd boost boost-python
# without Python the usual installation suffices
brew install protobuf boost
Expand Down