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

using Cmake-GUI to build openpose in Ubuntu #373

Closed
huangjiancong1 opened this issue Jan 15, 2018 · 23 comments
Closed

using Cmake-GUI to build openpose in Ubuntu #373

huangjiancong1 opened this issue Jan 15, 2018 · 23 comments

Comments

@huangjiancong1
Copy link

huangjiancong1 commented Jan 15, 2018

Issue Summary

In terminal, i used
make -j4

to building the OpenPose after created the /build under the /openpose ,and the terminal output:

[ 84%] [ 85%] make[2]: *** No rule to make target caffe/lib/libcaffe.so', needed by src/openpose/libopenpose.so.1.1.0'. Stop.
make[2]: *** Waiting for unfinished jobs....
Building CXX object src/openpose/CMakeFiles/openpose.dir/utilities/errorAndLog.cpp.o
[ 85%] Building CXX object src/openpose/CMakeFiles/openpose.dir/utilities/cuda.cpp.o
Building CXX object src/openpose/CMakeFiles/openpose.dir/utilities/keypoint.cpp.o
make[1]: *** [src/openpose/CMakeFiles/openpose.dir/all] Error 2
make: *** [all]

reference: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation_cmake.md#custom-caffe

Executed Command (if any)

bash ./ubuntu/install_cmake.sh
sudo apt-get install cmake-qt-gui
cd build/
make -j4

OpenPose Output (if any)

Type of Issue

You might select multiple topics, delete the rest:

Your System Configuration

Operating system (lsb_release -a in Ubuntu):

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Installation mode: CMake OpenCV caffe CUDA CUDNN

CUDA version (cat /usr/local/cuda/version.txt in most cases):CUDA Version 8.0.61

cuDNN version:

#define CUDNN_MAJOR 5
#define CUDNN_MINOR 1
#define CUDNN_PATCHLEVEL 10
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

GPU model (nvidia-smi in Ubuntu): nvidia-390.12 and NVIDIA GTX1050
Caffe version: Default from OpenPose
OpenCV version: pre-compiled apt-get install libopencv-dev (only Ubuntu);

@huangjiancong1
Copy link
Author

use the other method , Installation - Script Compilation meanwhile
to compile caffe,
after running:
make all -j4 && make distribute -j4

output:

AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status

@huangjiancong1
Copy link
Author

I can compile caffe which download from https://github.com/BVLC/caffe.git and test the caffe success.
Can i use this caffe to run Openpose?
After , i compile the /openpose package, some issue output:

CXX src/openpose/utilities/openCv.cpp
CXX src/openpose/utilities/errorAndLog.cpp
CXX src/openpose/utilities/keypoint.cpp
CXX src/openpose/utilities/cuda.cpp
NVCC src/openpose/pose/bodyPartConnectorBase.cu
nvcc fatal : redefinition of argument 'std'
make: *** [.build_release/cuda/src/openpose/pose/bodyPartConnectorBase.o] Error 1
make: *** Waiting for unfinished jobs....

@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Jan 16, 2018

Please, try removing OpenPose. Re-downloading the latest version, and performing the installation steps again. It seems like some step was missing, as every time is a different error.

@gineshidalgo99 gineshidalgo99 added the help wanted/question Extra attention is needed label Jan 16, 2018
@huangjiancong1
Copy link
Author

After Re-downloading the latest version and compiled the caffe, there are some issue in compile openpose:

src/openpose/pose/bodyPartConnectorCaffe.cpp:2:30: fatal error: caffe/blob.hpp: No such file or directory
#include <caffe/blob.hpp>
^
compilation terminated.
make: *** [.build_release/src/openpose/pose/bodyPartConnectorCaffe.o] Error 1
make: *** Waiting for unfinished jobs....
src/openpose/pose/poseExtractorCaffe.cpp:2:30: fatal error: caffe/blob.hpp: No such file or directory
#include <caffe/blob.hpp>
^

@gineshidalgo99
Copy link
Member

It's not finding Caffe. Are you sure Caffe is in 3rdparty/caffe?

@huangjiancong1
Copy link
Author

Sure and i can make runtest under /3rdparty/caffe success, i think there have something error about my cuda, i can not test cuda 8.0, my nvidia driver is nvidia-390.

@huangjiancong1
Copy link
Author

huangjiancong1 commented Jan 17, 2018

makefile in the /openpose 

> ## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#	You should not set this flag if you will be reading LMDBs with any
#	possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
		-gencode arch=compute_35,code=sm_35 \
		-gencode arch=compute_50,code=sm_50 \
		-gencode arch=compute_52,code=sm_52 \
		-gencode arch=compute_60,code=sm_60 \
		-gencode arch=compute_61,code=sm_61 \
		-gencode arch=compute_61,code=compute_61
# Deprecated
# CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
# 		-gencode arch=compute_20,code=sm_21 \
# 		-gencode arch=compute_30,code=sm_30 \
# 		-gencode arch=compute_35,code=sm_35 \
# 		-gencode arch=compute_50,code=sm_50 \
# 		-gencode arch=compute_52,code=sm_52 \
# 		-gencode arch=compute_60,code=sm_60 \
# 		-gencode arch=compute_61,code=sm_61 \
# 		-gencode arch=compute_61,code=compute_61

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app

# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
		/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
		# $(ANACONDA_HOME)/include/python2.7 \
		# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include

# Uncomment to use Python 3 (default is Python 2)
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
#                 /usr/lib/python3.5/dist-packages/numpy/core/include

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib /usr/local/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib

# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)
# WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := 1

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := /3rdparty/caffe/distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0

# enable pretty build (comment to see full commands)
Q ?= @

@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Jan 17, 2018

I'm confused, I thought you were using CMake, as you specify in your first message, not Makefile. Please, follow the exact steps from the installer in CMake, do not mix them with the old installer. (And again, I'd recommend re-downloading OpenPose to avoid mixing 2 installers)

@huangjiancong1
Copy link
Author

I see, and i use cmake like my first message, caffe compile success, but openpose compile output error at last,

[100%] Building CXX object examples/tutorial_wrapper/CMakeFiles/2_user_synchronous.bin.dir/2_user_synchronous.cpp.o
Linking CXX executable 4_user_input_processing_output_and_datum.bin
Linking CXX executable 1_custom_post_processing.bin
/usr/bin/ld: CMakeFiles/4_user_input_processing_output_and_datum.bin.dir/4_user_input_processing_output_and_datum.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [examples/tutorial_thread/4_user_input_processing_output_and_datum.bin] Error 1
make[1]: *** [examples/tutorial_thread/CMakeFiles/4_user_input_processing_output_and_datum.bin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/1_custom_post_processing.bin.dir/1_custom_post_processing.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [examples/tutorial_add_module/1_custom_post_processing.bin] Error 1
make[1]: *** [examples/tutorial_add_module/CMakeFiles/1_custom_post_processing.bin.dir/all] Error 2
Linking CXX executable 1_user_asynchronous_output.bin
/usr/bin/ld: CMakeFiles/1_user_asynchronous_output.bin.dir/1_user_asynchronous_output.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [examples/tutorial_wrapper/1_user_asynchronous_output.bin] Error 1
make[1]: *** [examples/tutorial_wrapper/CMakeFiles/1_user_asynchronous_output.bin.dir/all] Error 2
Linking CXX executable 2_user_synchronous.bin
/usr/bin/ld: CMakeFiles/2_user_synchronous.bin.dir/2_user_synchronous.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [examples/tutorial_wrapper/2_user_synchronous.bin] Error 1
make[1]: *** [examples/tutorial_wrapper/CMakeFiles/2_user_synchronous.bin.dir/all] Error 2
make: *** [all] Error 2

And i will reinstall the system to reinstall everything again.

@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Jan 17, 2018

I have seen that error in some old Ubuntu 14. Usually updating the system helps a lot with these kind of compiler errors (and rebooting after executing this command, which basically updates all the software and libraries):
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove

@huangjiancong1
Copy link
Author

which version of gcc g++、cmake-gui、nvidia-* driver and opencv are good for ubuntu14 and cuda 8.0

@atasoglou
Copy link

atasoglou commented Jan 17, 2018

I am compiling fine under a clean Ubuntu 14, so I don't think it is OpenPose related.
Could that be OpenCV related? Cause I see in caffe in the Makefile you are using Version 3. In cmake, this is being detected automatically. So for example, is cmake detecting it? Is OpenCV installed correctly? etc.

Or could it be that you are using any updated/downgraded lib in your system?

This also sometimes helps: sudo ldconfig when the OS cannot find libraries.

@huangjiancong1
Copy link
Author

huangjiancong1 commented Jan 17, 2018

I use the opencv by type sudo apt-get install libopencv-dev,issue output.... and i change to use opencv 3.3.0(test success), issue output....

Which opencv version you using?

Can you share your ubuntu14.iso ?
Do you use sudo apt-get update to fresh the ubuntu 14 or update some software in setting?
I don't know what wrong with my computer, it is the newest computer.

@atasoglou
Copy link

libopencv-dev is version 2.4.8, if I am not wrong. In my case, I am using OpenCV 3. I haven't tested it with version 2 to be honest. I installed it manually.

@huangjiancong1
Copy link
Author

huangjiancong1 commented Jan 18, 2018

A clean system

A clean ubuntu 14.04.5, after sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove all success except :

(gtk-update-icon-cache-3.0:23741): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

Fetched 3,763 kB in 6s (622 kB/s)
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/main/binary-i386/Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.

Install step

Install opencv3.3.0
git clone openpose
bash ./ubuntu/install_cmake.sh
sudo apt-get install cmake-qt-gui
open cmake-gui
configure

Issue 1
bash ./install_cmake.sh output:

Setting up libboost-all-dev (1.54.0.1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.14) ...
/sbin/ldconfig.real: /usr/lib/nvidia-384/libEGL.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib32/nvidia-384/libEGL.so.1 is not a symbolic link

sudo mv /usr/lib/nvidia-384/libEGL.so.1 /usr/lib/nvidia-375/libEGL.so.1.org
sudo mv /usr/lib32/nvidia-384/libEGL.so.1 /usr/lib32/nvidia-384/libEGL.so.1.org
sudo ln -s /usr/lib/nvidia-384/libEGL.so.384.39 /usr/lib/nvidia-384/libEGL.so.1
sudo ln -s /usr/lib32/nvidia-384/libEGL.so.384.39 /usr/lib32/nvidia-384/libEGL.so.1

bash ./install_cmake.sh success and ouput:

Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libleveldb-dev is already the newest version.
libprotobuf-dev is already the newest version.
libsnappy-dev is already the newest version.
protobuf-compiler is already the newest version.
libatlas-base-dev is already the newest version.
libhdf5-serial-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libboost-all-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgflags-dev is already the newest version.
libgoogle-glog-dev is already the newest version.
liblmdb-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo: pip: command not found
jiancong@jiancong-Inspiron-7577:~/openpose/ubuntu$

Issue 2
After click configure in cmake-gui , output in cmake-gui windows:

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_VERSION_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_VERSION_COMPILER
CMake Error: Could not find cmake module file: /home/jiancong/openpose/build/CMakeFiles/2.8.12.2/CMakeVERSIONCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_1.2.1_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_1.2.1_COMPILER
CMake Error: Could not find cmake module file: /home/jiancong/openpose/build/CMakeFiles/2.8.12.2/CMake1.2.1Compiler.cmake
CMake Error: Could not find cmake module file: CMakeVERSIONInformation.cmake
CMake Error: Could not find cmake module file: CMake1.2.1Information.cmake
CMake Error: CMAKE_VERSION_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_1.2.1_COMPILER not set, after EnableLanguage
Could NOT find CUDA (missing: CUDA_CUDART_LIBRARY) (found version "8.0")
cuDNN not found
Could NOT find GFlags (missing: GFLAGS_LIBRARY)
Could NOT find Glog (missing: GLOG_LIBRARY)
Found OpenCV: /usr/local (found version "3.3.0")
CUDA not found.
CMake Error at CMakeLists.txt:174 (message):
Install CUDA using the above commands.

Configuring incomplete, errors occurred!
See also "/home/jiancong/openpose/build/CMakeFiles/CMakeOutput.log".

output in terminal:

jiancong@jiancong-Inspiron-7577:~$ cmake-gui
ubuntu_version="$(lsb_release -r)"
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
if [[ $ubuntu_version == "14." ]]; then
wget -c "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb"
sudo dpkg --install cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb
elif [[ $ubuntu_version == "16." ]]; then
wget -c "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb"
sudo dpkg --install cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
fi
sudo apt-get update
sudo apt-get install cuda

and I run the command output in terminal, and finish install CUDA

click configure again, the same error output.

@gineshidalgo99
Copy link
Member

I've just seen the error says: src/openpose/libopenpose.so.1.1.0. Please, download the latest version, old versions might have old bugs. Otherwise, compile Caffe by your own, and then tell OpenPose where your Caffe is located with CMake-GUI

@gineshidalgo99 gineshidalgo99 added installation and removed help wanted/question Extra attention is needed labels Jan 18, 2018
@huangjiancong1
Copy link
Author

Dose it mean that everything it installed?

2018-01-21 15:37:31 (1021 KB/s) - ‘hand/pose_iter_102000.caffemodel’ saved [147344024/147344024]

Models downloaded
------------------------- OpenPose Models Downloaded -------------------------

------------------------- OpenPose Installed -------------------------

------------------------- Caffe and OpenPose Installed -------------------------

huang@huang-Inspiron-7577:~/openpose$ ls

@gineshidalgo99
Copy link
Member

Yes it does, but I thought you were using the CMake installer rather than the sh script. If you wanna import it to Qt, I think you prefer to install it with CMake.

@KevinQian97
Copy link

Hi I am also encountered with such problem.
Seems openpose can't detect cuda correctly.
It keeps telling me that it can't find cuda which I have already installed.

@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Sep 7, 2018

@KevinQian97 You can manually introduce it (the location) with Qt-gui

@KevinQian97
Copy link

@gineshidalgo99
Thanks for your immediate reply!
I am using the sever without desktop. So i use CMake Command Line for configuration.
I am not sure if i could at that into the CMake.txt?

@KevinQian97
Copy link

In fact I tried to change the commend
form
cmake ..
to
cmake .. -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so
But it still doesn't work

@KevinQian97
Copy link

Sorry
I am so silly that I forgot to delete the folder build.......
Sorry for bothering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants