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

Unable to build due to error "undefined reference to `pthreadpool_destroy'" #7

Open
szm-R opened this issue Aug 28, 2017 · 5 comments

Comments

@szm-R
Copy link

szm-R commented Aug 28, 2017

Hi,
Recently I came across NNPACK and decided to try it (I've been using BVLC Caffe for more than a year), I built NNPACK with the provided instructions in https://github.com/Maratyszcza/NNPACK.git, with the only differences being:
1- I installed ninja from source as the repository package is version 1.5.1 (1.7.1 is needed for NNPACK).
2- I added -fPIC flag to cflags in build.ninja because not doing so results in relocation error (in building
Caffe).

For building this Caffe, I first merged it with BVLC Caffe via following commands:
cd caffe-nnpack
git remote add caffe https://github.com/BVLC/caffe.git
git fetch caffe
git merge -X theirs caffe/master

And then removed self_.attr("phase") = static_cast(this->phase_); from include/caffe/layers/python_layer.hpp after merging. I did this because building this branch alone resulted in "cudnnNanPropagation_t" error.

I also added set (CMAKE_CXX_STANDARD 11) to CMakeLists.txt because I got an error about nested template argument list.

After all this, I ran the following commands:
mkdir build && cd build
cmake ..
make

Which resulted in the error mentioned in the title:
../lib/libcaffe.so.1.0.0: undefined reference to `pthreadpool_destroy'

I did as suggested in https://github.com/tiny-dnn/tiny-dnn/issues/829 meaning I added FIND_LIBRARY(NNPACK_THREADPOOL_LIB NAMES pthreadpool PATHS ${NNPACK_LIB_SEARCH_PATHS}) to FindNNPACK.cmake and list(APPEND REQUIRED_LIBRARIES ${NNPACK_LIB} ${NNPACK_THREADPOOL_LIB}) to CMakeLists.txt, but it didn't solve the problem.

I also tried to build Caffe in CPU_ONLY mode (so that there would be no need for merging) but that too resulted in the same error.

Thank you in advance for your help.

@Surmeh
Copy link

Surmeh commented Aug 30, 2017

Hello,
I was getting the same error and updated the FindNNPACK.cmake with both the lines you've mentioned, i.e
FIND_LIBRARY(NNPACK_THREADPOOL_LIB NAMES pthreadpool PATHS ${NNPACK_LIB_SEARCH_PATHS}) list(APPEND REQUIRED_LIBRARIES ${NNPACK_LIB} ${NNPACK_THREADPOOL_LIB})

@szm-R
Copy link
Author

szm-R commented Aug 30, 2017

And it solved your problem? You mean you added both of these lines to FindNNPACK.cmake? I did this like the following:
FIND_PATH(NNPACK_INCLUDE_DIR NAMES nnpack.h PATHS ${NNPACK_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(NNPACK_LIB NAMES nnpack PATHS ${NNPACK_LIB_SEARCH_PATHS})
FIND_LIBRARY(NNPACK_THREADPOOL_LIB NAMES pthreadpool PATHS ${NNPACK_LIB_SEARCH_PATHS})

list(APPEND REQUIRED_LIBRARIES ${NNPACK_LIB} ${NNPACK_THREADPOOL_LIB})

Added the two lines after line 24 of the file FindNNPACK.cmake and the error still persists

@szm-R
Copy link
Author

szm-R commented Aug 30, 2017

Also in Maratyszcza/NNPACK it's mentioned that this integration of nnpack with Caffe is unmaintained and instead one should refer to Maratyszcza/caffe , but I also had trouble building that one and I get this error:
Caffe/nnpack-caffe/src/caffe/layers/nnpack_relu_layer.cpp:10:21: error: expected initializer before ‘<’ token
void NNPackReLULayer::Forward_cpu(const vector<Blob*>& bottom,

Abd there is no issue tab there to ask for advice! ...

@Surmeh
Copy link

Surmeh commented Aug 31, 2017

Yea it did solve my problem. Also I've used the new Caffe with NNPACK and it builds fine.

@szm-R
Copy link
Author

szm-R commented Aug 31, 2017 via email

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

No branches or pull requests

2 participants