在Raspberry Pi上制作OpenCV期间,构建失败,并出现“ cc1plus”引起的“分段错误”

时间:2019-07-11 17:11:34

标签: opencv cmake raspberry-pi raspberry-pi3

我试图在Raspberry Pi 3B +上构建OpenCV 4.0.0,并继续遇到此问题:

[ 83%] Building CXX object modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o

c++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
modules/stitching/CMakeFiles/opencv_perf_stitching.dir/build.make:62: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o' failed
make[2]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/perf/opencl/perf_stitch.cpp.o] Error 4
CMakeFiles/Makefile2:23142: recipe for target 'modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all' failed
make[1]: *** [modules/stitching/CMakeFiles/opencv_perf_stitching.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

这是我正在运行的脚本的make / build部分:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D PYTHON_EXECUTABLE=~/.virtualenvs/py3cv4/bin/python \
    -D WITH_GSTREAMER=ON \
    -D WITH_FFMPEG=ON \
    -D WITH_OPENMP=ON \
    -D BUILD_EXAMPLES=ON ..

echo ""
echo "======================="
echo "Building OpenCV..."
make -j4
sudo make install
sudo ldconfig

我读到某处应该更改make -j4命令以不使用所有四个内核,因为我的内存不足。我尝试了make -j1,但在同一位置仍然遇到相同的错误。我将仅使用普通的make再试一次,但是删除其中所有的预构建内容,然后从头开始,看看是否有帮助。

1 个答案:

答案 0 :(得分:0)

结果是,我需要完全删除自己创建的构建,并使用一个核心而不是全部四个来重建它,因为它占用了太多内存。我删除了const R = require('ramda'); const {Future} = require('ramda-fantasy'); const read = () => Future((reject, resolve) => resolve('hello')); const write = (data) => Future((reject, resolve) => { console.log(data) resolve(data); }); const process = (data) => Future((reject, resolve) => { return setTimeout(() => resolve(data), 0); }); read.chain(process) .chain(write) .fork(console.warn, console.log); 目录,然后执行了/opencv/build/,但没有使用make命令,它运行正常。花费了很长时间(5个多小时),但它确实成功完成了。现在我只需要弄清楚为什么我不能-j ...