【爬坑记录】error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64

爬坑记录2:error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64

CMake Error at ***/Downloads/cmake/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/opt/hisi-linux/arm-himix200-linux/bin/arm-himix200-linux-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: ***/cmake-build-tt/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_ae2e9/fast"
    /usr/bin/make -f CMakeFiles/cmTC_ae2e9.dir/build.make CMakeFiles/cmTC_ae2e9.dir/build
    make[1]: Entering directory '***/cmake-build-tt/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_ae2e9.dir/testCCompiler.c.o
    /opt/hisi-linux/arm-himix200-linux/bin/arm-himix200-linux-gcc -DSENSOR0_TYPE=SONY_IMX335_MIPI_5M_30FPS_12BIT -DSENSOR10_TYPE=SONY_IMX458_MIPI_12M_20FPS_10BIT -DSENSOR11_TYPE=PANASONIC_MN34220_LVDS_2M_30FPS_12BIT -DSENSOR12_TYPE=OMNIVISION_OS05A_MIPI_4M_30FPS_12BIT -DSENSOR1_TYPE=SONY_IMX335_MIPI_4M_30FPS_12BIT -DSENSOR2_TYPE=SONY_IMX327_MIPI_2M_30FPS_12BIT -DSENSOR3_TYPE=SONY_IMX327_2L_MIPI_2M_30FPS_12BIT -DSENSOR4_TYPE=SONY_IMX307_MIPI_2M_30FPS_12BIT -DSENSOR5_TYPE=SONY_IMX458_MIPI_1M_129FPS_10BIT -DSENSOR6_TYPE=SONY_IMX458_MIPI_2M_90FPS_10BIT -DSENSOR7_TYPE=SONY_IMX458_MIPI_4M_40FPS_10BIT -DSENSOR8_TYPE=SONY_IMX458_MIPI_4M_60FPS_10BIT -DSENSOR9_TYPE=SONY_IMX458_MIPI_8M_30FPS_10BIT  -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=softfp -fno-aggressive-loop-optimizations -ldl -ffunction-sections -fdata-sections -O2 -fstack-protector -fPIC -fPIE -pthread -lm -ldl -lstdc++ -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=softfp -fno-aggressive-loop-optimizations -ldl -ffunction-sections -fdata-sections -O2 -fstack-protector -fPIC -fPIE -pthread -lm -ldl -lstdc++    -o CMakeFiles/cmTC_ae2e9.dir/testCCompiler.c.o   -c ***/cmake-build-tt/CMakeFiles/CMakeTmp/testCCompiler.c
    /opt/hisi-linux/arm-himix200-linux/bin/arm-himix200-linux-gcc: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64
    CMakeFiles/cmTC_ae2e9.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_ae2e9.dir/testCCompiler.c.o' failed
    make[1]: *** [CMakeFiles/cmTC_ae2e9.dir/testCCompiler.c.o] Error 127
    make[1]: Leaving directory '/home/sbb/workspace/uface3/cmake-build-tt/CMakeFiles/CMakeTmp'
    Makefile:121: recipe for target 'cmTC_ae2e9/fast' failed
    make: *** [cmTC_ae2e9/fast] Error 2
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:27 (project)


-- Configuring incomplete, errors occurred!
See also "***/cmake-build-tt/CMakeFiles/CMakeOutput.log".
See also "***/cmake-build-tt/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.

背景: 一个早晨九点还能编译通过的,突然就无法编译成功了,然后报出上述错误

  • 解决方法:
    • 1:安装所需的的依赖库使用如下命令:
sudo apt-get install lib32stdc++6
  • 思路分析:
    • 1:当出现这个错误的时候,第一个想法是,我的编译依赖是不是有变化,检查了一下还是正常的;
    • 2:因为我是编译32位的库,而在编译过程中用了64位的库,所以大概率是有人把32位的库给删除了;
    • 3:或是进行的如下操作,可进行尝试:

      到包含libstdc++的目录,一般是/usr/lib/,
      使用命令:查看当前库位数
objdump -a  *.so
  • 若第三部不对,可删除后重新链接,参考:error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64

你可能感兴趣的:(爬坑记录)