【问题标题】:Error to build opencv on Ubuntu 14.04 [cannot find -lstdc++]在 Ubuntu 14.04 上构建 opencv 时出错 [找不到 -lstdc++]
【发布时间】:2017-07-21 09:51:41
【问题描述】:

我是在我的 Ubuntu 14.04 上构建和安装 opencv 的新手。

我跟着pyimagesearch去做。

输入cmake命令后,遇到如下错误。 我搜索了一些解决方案并尝试重新安装一些软件包,例如:gcc。

还是不行……:(

对于/usr/bin/ld: cannot find -lstdc++的问题,有人有想法吗?

谢谢你:)

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=/home/eric/program_files/OpenCV/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..
-- The CXX compiler identification is Clang 3.4.0
-- The C compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/clang++" is not able to compile a simple test
program.

It fails with the following output:

Change Dir: 
/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec3807027872/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3807027872.dir/build.make
CMakeFiles/cmTryCompileExec3807027872.dir/build



make[1]: Entering directory
  `/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building CXX object
  CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o

  /usr/bin/clang++ -o
  CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o -c
  /home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


  Linking CXX executable cmTryCompileExec3807027872

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec3807027872.dir/link.txt --verbose=1

  /usr/bin/clang++
  CMakeFiles/cmTryCompileExec3807027872.dir/testCXXCompiler.cxx.o -o
  cmTryCompileExec3807027872 -rdynamic

  /usr/bin/ld: cannot find -lstdc++

  clang: error: linker command failed with exit code 1 (use -v to see
  invocation)

  make[1]: *** [cmTryCompileExec3807027872] Error 1

  make[1]: Leaving directory
  `/home/eric/program_files/OpenCV/opencv/build/CMakeFiles/CMakeTmp'

  make: *** [cmTryCompileExec3807027872/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:88 (project)


-- Configuring incomplete, errors occurred!

【问题讨论】:

    标签: opencv ubuntu cmake clang++


    【解决方案1】:

    尝试:

    sudo apt-get install g++
    

    或

    ln -s /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 2019-10-11
      相关资源
      最近更新 更多