fast-rcnn icon indicating copy to clipboard operation
fast-rcnn copied to clipboard

Build Fail with WITH_PYTHON_LAYER := 1 in Makefile.config

Open CyrusChiu opened this issue 8 years ago • 23 comments

WITH_PYTHON_LAYER := 1 in makefile.config

If use WITH_PYTHON_LAYER := 0 in Makefile.config, then build without error. If use WITH_PYTHON_LAYER := 1 in Makefile.config, then it will build fail with command "make -j8 " The error message will pop out:

CXX/LD -o .build_release/examples/siamese/convert_mnist_siamese_data.bin
.build_release/lib/libcaffe.so: undefined reference to「boost::re_detail::raise_runtime_error(std::runtime_error const&)」
.build_release/lib/libcaffe.so: undefined reference to「boost::re_detail::put_mem_block(void*)」
.build_release/lib/libcaffe.so: undefined reference to「boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, st
d::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >::maybe_assign(boost::match_results<_
_gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*
, std::string> > > > const&)」
..... 

The following is my step:

  1. Clone the Fast R-CNN repository and build the Cython modules.
  2. I build caffe using WITH_PYTHON_LAYER := 0 without any error and I can successfully run the demo.
  3. I want to train FRCN on my own dataset. So I change WITH_PYTHON_LAYER from 0 to 1 in Makefile.config.
  4. Then I execute "make clean" after change the variable WITH_PYTHON_LAYER.
  5. Build caffe again, execute "make -j8", then I got those error message.

I have search from the Internet, it seems related to libboost_regex link problem. But I am not familar with Makefile now, could you provide some hint?

CyrusChiu avatar Sep 03 '15 14:09 CyrusChiu

You can refer to this link for help: https://groups.google.com/forum/#!topic/caffe-users/cI1omAfHxNw, and Have you install libboost-python-dev and python-dev?

awayhome113 avatar Sep 18 '15 03:09 awayhome113

I have this problem too. I solve it by add boost_regex to LIBRARIES in Makefile 263 LIBRARIES += boost_thread stdc++ boost_regex

ethanhe42 avatar Aug 18 '16 16:08 ethanhe42

brother yihui's solution can sovle my problem ,thank you.

andeyeluguo avatar Nov 24 '17 08:11 andeyeluguo

@andeyeluguo I met the same question with you, how did you resolve it on boost_regex? thank you and wait for you relay.....

YIFanH avatar Dec 19 '17 05:12 YIFanH

I solve it by add boost_regex to LIBRARIES in Makefile just like this 263 LIBRARIES += boost_thread stdc++ boost_regex maybe you miss the boost_regex

andeyeluguo avatar Dec 19 '17 06:12 andeyeluguo

@andeyeluguo I add boost_regex in Makefile,but can not solve question

YIFanH avatar Dec 19 '17 06:12 YIFanH

then I have no idea,sorry

andeyeluguo avatar Dec 19 '17 06:12 andeyeluguo

@andeyeluguo which your version of boost ?

YIFanH avatar Dec 19 '17 06:12 YIFanH

I solve this question with boost version of 1.62.0 and modify the Makefile with add boost_regex

YIFanH avatar Dec 19 '17 07:12 YIFanH

I am compiling the repository from https://github.com/weiliu89/caffe/tree/ssd ...the same issue, nevertheless @yihui-he advice solved my problem. I have compiled the repository but when I run make test -j8 I got a reference error: .build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation::transform_primary(char const*, char const*) const' Could someone help me?

EnriqueSolarte avatar Jan 02 '18 01:01 EnriqueSolarte

where did you add the boost_regex to solve this problem @YIFanH

haoxuhao avatar Jan 02 '18 09:01 haoxuhao

@haoxuhao 265 line in Makefile; LIBRARIES += boost_thread stdc++ changed to LIBRARIES += boost_thread stdc++ boost_regex

YIFanH avatar Jan 02 '18 12:01 YIFanH

I'm facing the same problem (while compiling ssd caffe; caffe and py-faster-rcnn I already succesfully compiled), but unfortunately adding boost_regex to the LIBRARIES doesn't help. My boost version is also 1.62.0 and I use g++-5.

@YIFanH what version of ubuntu are you using?

I would be very happy about any other ideas how to solve this problem.

Gesalat avatar Jan 03 '18 16:01 Gesalat

@Gesalat Hi, my linux is centos and g++ -version is 4.8.4

YIFanH avatar Jan 04 '18 04:01 YIFanH

@Gesalat I ran into this error with same boost and g++ version, did you solve it?

WUhailing avatar Mar 21 '18 18:03 WUhailing

@WUhailing yes I solved it by compiling ssd caffe on a clean ubuntu 17.04 and also on a 17.10 machine with gcc-6 and cuda 9.1(if you do sudo apt install nvidia-cuda-toolkit you will get cuda 8 and this could be one problem)

further details:

  • boost 1.62 installed with sudo apt install libboost-dev (some symlinks were missing and added by hand)
  • all other caffe dependencies installed with sudo apt install <...> except cuda
  • on ubuntu 17.10 the standard compiler is gcc-7 so I had to install gcc-6 and change some symlinks to make it work
  • in cudas common_functions.h I had to uncomment a line to get caffe ssd compiled

I hope this helps :-) I think next time I would choose ubuntu 16.04, there might be less version troubles.

Gesalat avatar Mar 23 '18 15:03 Gesalat

I've solved my problem by the way provided by yihui. Some differences are here: The error message I met was: boost::program_options::xxxxx undefined so I added boost_program_options to LIBRARIES in Makefile like this: 265 LIBRARIES += boost_thread stdc++ boost_program_options and no more error message was shown. I guess that the correct library should be added.

JiangStein avatar Apr 17 '18 12:04 JiangStein

@YIFanH I add boost_regex in Makefile,but can not solve question

Azure-Sky-L avatar Jul 16 '18 09:07 Azure-Sky-L

how to do it with CMAKE ? MakeFile not contain "LIBRARES += ...." to append it "boost_thread stdc++ boost_regex"

Yrij-Zhavoronkov avatar Jul 29 '18 14:07 Yrij-Zhavoronkov

.build_release/lib/libcaffe.so: undefined reference to cblas_sgemv' .build_release/lib/libcaffe.so: undefined reference to cblas_dgemm' .build_release/lib/libcaffe.so: undefined reference to cblas_sscal' .build_release/lib/libcaffe.so: undefined reference to cblas_dgemv' .build_release/lib/libcaffe.so: undefined reference to cblas_saxpy' .build_release/lib/libcaffe.so: undefined reference to cblas_ddot' .build_release/lib/libcaffe.so: undefined reference to cblas_dasum' .build_release/lib/libcaffe.so: undefined reference to cblas_sgemm' .build_release/lib/libcaffe.so: undefined reference to cblas_dscal' .build_release/lib/libcaffe.so: undefined reference to cblas_scopy' .build_release/lib/libcaffe.so: undefined reference to cblas_sasum' .build_release/lib/libcaffe.so: undefined reference to cblas_daxpy' .build_release/lib/libcaffe.so: undefined reference to cblas_dcopy' .build_release/lib/libcaffe.so: undefined reference to cblas_sdot' collect2: error: ld returned 1 exit status make: *** [.build_release/tools/caffe.bin] Error 1

lunana123 avatar Aug 22 '18 08:08 lunana123

I am compiling the repository from https://github.com/weiliu89/caffe/tree/ssd ...the same issue, nevertheless @yihui-he advice solved my problem. I have compiled the repository but when I run make test -j8 I got a reference error: .build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation::transform_primary(char const*, char const*) const' Could someone help me? 可能是装了多个boost版本,你可以查看/usr/local/lib/和/usr/lib/ 下boost是否安装了不同版本,如果是删掉一个就可以了,比如删除/usr/local/include/下的boost 和/usr/local/lib/下boost相关的文件,然后make clean,make all 就好了

lironghua318 avatar Dec 07 '18 03:12 lironghua318

I have this problem too. I solve it by add boost_regex to LIBRARIES in Makefile 263 LIBRARIES += boost_thread stdc++ boost_regex

谢谢,我的环境是少了regex

leaf918 avatar Mar 29 '19 04:03 leaf918

I am compiling the repository from https://github.com/weiliu89/caffe/tree/ssd ...the same issue, nevertheless @yihui-he advice solved my problem. I have compiled the repository but when I run make test -j8 I got a reference error: .build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation::transform_primary(char const*, char const*) const' Could someone help me? 可能是装了多个boost版本,你可以查看/usr/local/lib/和/usr/lib/ 下boost是否安装了不同版本,如果是删掉一个就可以了,比如删除/usr/local/include/下的boost 和/usr/local/lib/下boost相关的文件,然后make clean,make all 就好了

this solved my problem

BirdeeChen avatar Sep 06 '19 06:09 BirdeeChen