在Raspberry PI上安装基于C的python库OpenCV2时,如何处理内部编译器错误cc1plus:gimplify?

如何解决在Raspberry PI上安装基于C的python库OpenCV2时,如何处理内部编译器错误cc1plus:gimplify?

我一直在尝试在Raspberry PI 3B上安装适用于Python 3的OpenCV2库。我通过通过apt安装Python 3并使用pip3安装OpenCV来开始此过程。但是,该过程相当缓慢,并且有时会因安装而挂断。通常,它会在几个小时后释放自己,但是在取得更多进展后,它将引发并出现安装错误。昨天我发现一个bash脚本声称可以在Raspberry PI上安装OpenCV。我复制了脚本,对其进行了调试,然后运行了它。在到达脚本的CMake构建部分之前,它似乎工作正常。它以15%的速度将构建挂起了几个小时,释放了自己并继续构建,直到遇到内部编译器错误,此时编译器中止了安装。下面是我用来安装OpenCV和窗口输出的bash脚本。我不知道从哪里开始调试它,所以任何方向都将不胜感激。

安装Bash脚本

# installOpenCV.sh
echo "OpenCV installation by learnOpenCV.com"

cvVersion="master"

# Clean build directories
rm -rf opencv/build
rm -rf opencv_contrib/build

# Create directory for installation
mkdir installation
mkdir installation/OpenCV-"$cvVersion"

# Save current working directory
cwd=$(pwd)

sudo apt -y update
sudo apt -y upgrade

sudo apt -y remove x264 libx264-dev

## Install dependencies
sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libjasper-dev libpng12-dev

sudo apt -y install libtiff5-dev

sudo apt -y install libtiff-dev

sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd $cwd

sudo apt -y install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default
sudo apt -y install libatlas-base-dev
sudo apt -y install libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev libx264-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt -y install libavresample-dev
sudo apt -y install x264 v4l-utils

# Optional dependencies
# sudo apt -y install libprotobuf-dev protobuf-compiler
# sudo apt -y install libgoogle-glog-dev libgflags-dev
# sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

# Install python
sudo apt -y install python3-dev python3-pip
sudo -H pip3 install -U pip numpy
sudo apt -y install python3-testresources

cd $cwd
# Install virtual environment
python3 -m venv OpenCV-"$cvVersion"-py3
echo "# Vitual Environment Wrapper" >> ~/.bashrc
echo "alias workoncv-$cvVersion=\source $cwd/OpenCv-$cvVersion-py3/bin/activate" >> ~/.bashrc
source "$cwd"/OpenCV-"$cvVersion"-py3/bin/activate

################### For Python 3 ########################
Now install python libararies wihin this virtaul environment\
sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=1024/g' /etc/dpyhs-swapfile
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
pip install numpy dlib
 quit vitual environment
deactivate

git clone https://github.com/opencv/opencv.git
cd opencv
git checkout $cvVersion
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout $cvVersion

echo $cwd

cd $cwd/opencv
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D BUIL_opencv_python3=yes \
    -D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D WITH_TBB=ON \
    -D WITH_V4L=ON \
    -D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages \
    -D WITH_QT=ON \
    -D WITH_OPENGL=ON \
    -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..

make -j$(nproc)
make install

终端输出

Scanning dependencies of target opencv_test_core
[ 59%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_arithm.cpp.o
[ 59%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_channels.cpp.o
[ 59%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_dft.cpp.o
during GIMPLE pass: dom
In file included from /home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts.hpp:125,from /home/pi/Documents/OpenCVInstaller/opencv/modules/core/test/ocl/../test_precomp.hpp:7,from /home/pi/Documents/OpenCVInstaller/opencv/modules/core/test/ocl/test_arithm.cpp:42:
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ts_gtest.h: In member function ‘bool testing::internal::CartesianProductGenerator4<T1,T2,T3,T4>::Iterator::AtEnd() const [with T1 = std::pair<perf::{anonymous}::MatDepth,perf::{anonymous}::MatDepth>; T2 = cvtest::ocl::Channels; T3 = int; T4 = bool]’:
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ts_gtest.h:16171:10: internal compiler error: Illegal instruction
     bool AtEnd() const {
          ^~~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/build.make:63: modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_arithm.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
during GIMPLE pass: slp
during GIMPLE pass: ivopts
In member function ‘virtual void opencv_test::ocl::Dft_Mat_Test::Body()’:
cc1plus: internal compiler error: in gimplify_expr,at gimplify.c:11391
In static member function ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator,_InputIterator,_ForwardIterator) [with _InputIterator = const testing::internal::linked_ptr<testing::internal::ParameterizedTestCaseInfo<opencv_test::ocl::ExtractChannel>::TestInfo>*; _ForwardIterator = testing::internal::linked_ptr<testing::internal::ParameterizedTestCaseInfo<opencv_test::ocl::ExtractChannel>::TestInfo>*; bool _TrivialValueTypes = false]’:
cc1plus: internal compiler error: in gimplify_expr,at gimplify.c:11391
during GIMPLE pass: ifcombine
In static member function ‘static cv::GMetaArgs cv::detail::MetaHelper<K,std::tuple<_Elements ...>,Out>::getOutMeta(const GMetaArgs&,const GArgs&) [with K = cv::gapi::core::GDivRC; Ins = {cv::GScalar,cv::GMat,double,int}; Out = cv::GMat]’:
cc1plus: internal compiler error: in gimplify_expr,at gimplify.c:11391
0x76a43717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
0x76a41717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
0x76a88717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/build.make:89: modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_dft.cpp.o] Error 1
[ 59%] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/ocl/goclkernel.cpp.o
[ 59%] Building CXX object modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/ocl/goclimgproc.cpp.o
make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/build.make:76: modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_channels.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2784: modules/core/CMakeFiles/opencv_test_core.dir/all] Error 2
make[2]: *** [modules/gapi/CMakeFiles/opencv_gapi.dir/build.make:674: modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/fluid/gfluidcore.cpp.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[2]: *** Waiting for unfinished jobs....
/home/pi/Documents/OpenCVInstaller/opencv/modules/gapi/src/backends/ocl/goclkernel.cpp: In member function ‘const cv::UMat& cv::GOCLContext::inMat(int)’:
/home/pi/Documents/OpenCVInstaller/opencv/modules/gapi/src/backends/ocl/goclkernel.cpp:14:34: internal compiler error: in gimplify_expr,at gimplify.c:11391
     return (inArg<cv::UMat>(input));
                                  ^
0x76b34717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
make[2]: *** [modules/gapi/CMakeFiles/opencv_gapi.dir/build.make:700: modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/ocl/goclkernel.cpp.o] Error 1
/home/pi/Documents/OpenCVInstaller/opencv/modules/gapi/src/backends/ocl/goclimgproc.cpp: In function ‘cv::gapi::GKernelPackage cv::gapi::imgproc::ocl::kernels()’:
/home/pi/Documents/OpenCVInstaller/opencv/modules/gapi/src/backends/ocl/goclimgproc.cpp:295:11: internal compiler error: in gimplify_expr,at gimplify.c:11391
         >();
           ^
0x76acd717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
make[2]: *** [modules/gapi/CMakeFiles/opencv_gapi.dir/build.make:713: modules/gapi/CMakeFiles/opencv_gapi.dir/src/backends/ocl/goclimgproc.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:17223: modules/gapi/CMakeFiles/opencv_gapi.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
[  4%] Built target libwebp
[  5%] Built target libopenjp2
[  8%] Built target IlmImf
[ 10%] Built target libprotobuf
[ 11%] Built target quirc
[ 11%] Built target ittnotify
[ 12%] Built target ade
[ 12%] Built target opencv_videoio_plugins
[ 15%] Built target opencv_core
[ 17%] Built target opencv_imgproc
[ 18%] Built target opencv_imgcodecs
[ 19%] Built target opencv_videoio
[ 20%] Built target opencv_highgui
[ 21%] Built target opencv_ts
[ 21%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_arithm.cpp.o
In file included from /home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts.hpp:18,from /home/pi/Documents/OpenCVInstaller/opencv/modules/core/test/ocl/test_arithm.cpp:42:
/home/pi/Documents/OpenCVInstaller/opencv/modules/core/test/ocl/test_arithm.cpp: In member function ‘virtual void opencv_test::ocl::Lut_Mat_Test::TestBody()’:
/home/pi/Documents/OpenCVInstaller/opencv/modules/core/include/opencv2/core/utils/trace.hpp:164:82: internal compiler error: in gimplify_expr,at gimplify.c:11391
     const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
                                                                                  ^
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ts_ext.hpp:37:8: note: in expansion of macro ‘CV__TRACE_APP_FUNCTION_NAME’
        CV__TRACE_APP_FUNCTION_NAME(name); \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ts_ext.hpp:158:72: note: in expansion of macro ‘CV__TEST_BODY_IMPL’
     void GTEST_TEST_CLASS_NAME_(test_case_name,test_name)::TestBody() BODY_IMPL( #test_case_name "_" #test_name ) \
                                                                        ^~~~~~~~~
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ts_ext.hpp:162:43: note: in expansion of macro ‘CV__TEST_P’
 #define TEST_P(test_case_name,test_name) CV__TEST_P(test_case_name,test_name,Body,CV__TEST_BODY_IMPL)
                                           ^~~~~~~~~~
/home/pi/Documents/OpenCVInstaller/opencv/modules/ts/include/opencv2/ts/ocl_test.hpp:367:20: note: in expansion of macro ‘TEST_P’
 #define OCL_TEST_P TEST_P
                    ^~~~~~
/home/pi/Documents/OpenCVInstaller/opencv/modules/core/test/ocl/test_arithm.cpp:99:1: note: in expansion of macro ‘OCL_TEST_P’
 OCL_TEST_P(Lut,Mat)
 ^~~~~~~~~~
0x76b2f717 __libc_start_main
    /build/glibc-FUvrFr/glibc-2.28/csu/libc-start.c:308
Please submit a full bug report,with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/build.make:63: modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_arithm.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2784: modules/core/CMakeFiles/opencv_test_core.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
pi@raspberrypi:~/Documents/OpenCVInstaller $ 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-