Ich versuche, OpenCV zu kompilieren. Ich habe den Master-Zweig (der derzeit auf Commit dc9602e ist) und version/tag 3.1.0 ausprobiert. Ich verwende Fedora 24, ich habe es zuerst mit gcc aus Fedora (gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2)) versucht. Ich habe es auch mit GCC 6.2.0 probiert, auf meinem Rechner kompiliert.
Ich verwende cmake mit folgenden Parametern:
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_NEW_PYTHON_SUPPORT=ON -DINSTALL_PYTHON_EXAMPLES=ON -DWITH_TBB=ON -DWITH_V4L=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DWITH_QT=ON -DWITH_OPENGL=ON -DWITH_OPENCL=ON -DWITH_EIGEN=ON -DWITH_OPENEXR=ON
cmake
läuft gut und dann führe ich make
aus. Die Kombination von OpenCV-Version und gcc-Version spielt keine Rolle, das Ergebnis ist dasselbe:
In file included from /usr/local/include/c++/6.2.0/bits/stl_algo.h:59:0,
from /usr/local/include/c++/6.2.0/algorithm:62,
from /home/dmelo/proj2/opencv/modules/core/include/opencv2/core/base.hpp:55,
from /home/dmelo/proj2/opencv/modules/core/include/opencv2/core.hpp:54,
from /home/dmelo/proj2/opencv/modules/highgui/include/opencv2/highgui.hpp:46,
from /home/dmelo/proj2/opencv/build/modules/highgui/precomp.hpp:45:
/usr/local/include/c++/6.2.0/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^
compilation terminated.
Hat jemand anderes dies erlebt? Wie kann ich dieses Problem lösen?
Versuchen Sie, indem Sie vorkompilierte Header deaktivieren, entweder von cmake-gui oder mit dem Befehlszeilenparameter
-DENABLE_PRECOMPILED_HEADERS=OFF
Das Kompilieren aus dem Zip-Paket (opencv-2.4.11) hat für mich nicht funktioniert, aber die neueste Version * von github repo hat mir einen erfolgreichen Aufbau auf Ubuntu 17.04 ermöglicht
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir mybin
cd mybin
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_FFMPEG=OFF ..
make
Sudo make install
Update: Möglicherweise möchten Sie git checkout 3.4
nach git clone
ausführen, da der Master-Zweig viele neue Änderungen vorgenommen hat, seit ich dies geschrieben habe
Hinweis: ffmpeg ist veraltet und optional, daher habe ich WITH_FFMPEG=OFF
flag verwendet
Update: Ich konnte mit ffmpeg am 18.04 bauen, verwendete WITH_FFMPEG=ON
-Flag. Das neueste ffmpeg sollte auch mit 17.04 funktionieren. Kommentieren Sie, wenn Sie erfolgreich waren!
* OpenCV-Commit-ID cca99bf8249387da9f79be8d549b2d49e39a0289
Zusatzinfo: Abhängigkeiten, die ich vor dem Kompilieren installiert habe
build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libtbb2 libtbb-dev
Hoffe das hilft jemand in Zukunft!
Für mich das:
[ 33%] Building CXX object
/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32-g++ @CMakeFiles/Transform360.dir/includes_CXX.rsp -std=c++11 -O3 -DNDEBUG -o CMakeFiles/Transform360.dir/Library/VideoFrameTransform.cpp.obj -c /home/rdp/ffmpeg-windows-build-helpers/sandbox/win64/transform360_git/Transform360/Library/VideoFrameTransform.cppCMakeFiles/Transform360.dir/Library/VideoFrameTransform.cpp.obj
In file included from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/ext/string_conversions.h:41,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/bits/basic_string.h:6391,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/string:52,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/stdexcept:39,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/array:39,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/Tuple:39,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/bits/stl_map.h:63,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/map:61,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/win64/transform360_git/Transform360/Library/VideoFrameTransform.h:18,
from /home/rdp/ffmpeg-windows-build-helpers/sandbox/win64/transform360_git/Transform360/Library/VideoFrameTransform.cpp:14:
/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
bedeutet "CMakeFiles/Transform360.dir/includes_CXX.rsp bearbeiten und -isystem durch -I ersetzen" -Hinweis aus hier