Text-Image-Augmentation icon indicating copy to clipboard operation
Text-Image-Augmentation copied to clipboard

cmake problem

Open tnkong opened this issue 5 years ago • 6 comments

我使用的测试环境是ubuntu 16.04, 没有按照说明使用anaconda安装boost,结果可以编译,成功生成了Argument.so这个文件

但是到服务器上Centos7.4, 使用同样的办法就不行了,我想如果不是boost1.67安装出了问题,那就是cmake Error

boost 安装过程:

  1. down load boost_1_67_0.tar.gz
  2. extract file and cd it
  3. ./bootstrap.sh --with-libraries=all --with-python=/home/kongtianning/anaconda3/envs/python2712/bin/python --with-python-version=2.7 --with-python-root=/home/kongtianning/anaconda3/envs/python2712 --prefix=/home/kongtianning/myboost
  4. ./b2
  5. ./b2 install

接下来我按照你说的做, 在ubuntu上面用系统自带的python2 没问题 但是在Centos上就不行 mkdir build cd build cmake -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF .. 

在Centos下cmake 命令我是这样用的

cmake -DPYTHON_INCLUDE_DIR=/home/kongtianning/anaconda3/envs/python2712/include/python2.7 -DPYTHON_LIBRARY=/home/kongtianning/anaconda3/envs/python2712/lib/ -DPYTHON_EXECUTABLE=/home/kongtianning/anaconda3/envs/python2712/bin/python -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF ..

结果返回是 找不到 boost_python

CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message): Unable to find the requested Boost libraries.

Boost version: 1.67.0

Boost include path: /usr/local/include

Could not find the following Boost libraries:

      boost_python

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:18 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/kongtianning/PycharmProjects/HanWangProJectPython/imageAugment/build/CMakeFiles/CMakeOutput.log".

tnkong avatar Jun 13 '19 10:06 tnkong

经过反复尝试,google搜索修改方案 我对文件CMakeList.txt 做了一点修改 在文件的最顶端加了一句, 这是我安装boost的路径 set(BOOST_ROOT $(BOOST_ROOT) "/home/kongtianning/myboost")

返回结果稍微改变

-- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found PythonLibs: /home/kongtianning/anaconda3/envs/python2712/lib (found suitable version "2.7.12", minimum required is "2.7") CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message): Unable to find the requested Boost libraries.

Boost version: 1.67.0  (cmake能够识别到我安装的boost版本)

Boost include path: /home/kongtianning/myboost/include  (cmake也能找到boost路径)

Could not find the following Boost libraries:

      boost_python  (但是仍然找不到boost python)

No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:18 (find_package)

-- Found OpenCV: /usr/local (found version "3.4.4") -- Configuring incomplete, errors occurred! See also "/home/kongtianning/PycharmProjects/HanWangProJectPython/imageAugment/build/CMakeFiles/CMakeOutput.log".

tnkong avatar Jun 13 '19 10:06 tnkong

您试试把boost安装到系统里边去。这里我看到系统里边用的是OpenCV3,我这个包现在只支持OpenCV2...抱歉...我会标记为重要问题,向大家求教。

Canjie-Luo avatar Jun 13 '19 15:06 Canjie-Luo

@Canjie-Luo 问题最终得到的解决, 这个工具在ubuntu上安装容易因为可以使用apt安装,但是在Centos上安装就要碰到这个lib找不到,或者版本不对的问题,注意更新cmake的版本 yum install gtk+-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm

装boost的时候不要指定自己安装的python路径,否则会出现各种问题,使用系统自带的python2.7就可以,在安装boost的时候会少走很多弯路,不会报lib找不到的问题.

Centos下安装opencv2.14.x也会遇到各种障碍,认真阅读opencv官网的安装说明, 找不到的lib可以有替代的lib安装

另外安装opencv2的时候, cd opencv-xx.xx.xx mkir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D WITH_CUDA=OFF .. (系统如果有CUDA,编译的时候会默认使用CUDA, 但是这个会需要更多的lib,我做到这里我对这个已经非常的头疼,所以选择非CUDA支持安装,编译通过) make make install

tnkong avatar Jun 16 '19 09:06 tnkong

最终希望有懂cmake的人 把这个工具改成纯python的,不然不论使用还是安装都各种麻烦

tnkong avatar Jun 16 '19 09:06 tnkong

谢谢您的建议。实际上我也尝试过纯python版本,但是比C++慢太多了,所以放弃了。只有这个版本可以做到实时处理。

Canjie-Luo avatar Jun 16 '19 23:06 Canjie-Luo

我用python重写了这个代码,速度在14ms,有兴趣的可以支持下,https://github.com/RubanSeven/Text-Image-Augmentation-python

RubanSeven avatar Feb 08 '20 10:02 RubanSeven