在Ubuntu 14.04上构建opencv出错[找不到-lstdc ++]

时间:2017-07-21 09:51:41

标签: opencv ubuntu cmake clang++

我是新手在我的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!

1 个答案:

答案 0 :(得分:0)

尝试:

sudo apt-get install g++

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