I am fighting with a problem while installing opencv for Code Blocks.
I have installed MinGW with all necessary compilers and I'm trying to build binaries using CMake. I am setting code blocks MinGW makefiles as generator, and I am specyfing c and c++ compilers as x86_64-w64-mingw32-g++ and gcc. Yet I'm getting an error:
CMake Error: Error SetGlobalGenerator called with null
The CXX compiler identification is unknown
The C compiler identification is unknown
Check for working CXX compiler: C:/mingw-w64/mingw64/bin/x86_64-w64-mingw32-g++.exe
Check for working CXX compiler: C:/mingw-w64/mingw64/bin/x86_64-w64-mingw32-g++.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler "C:/mingw-w64/mingw64/bin/x86_64-w64-mingw32-g++.exe" is
not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/openCV/new_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe"
"cmTC_2867a.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2016-10-12 14:20:38.
Project "C:\openCV\new_build\CMakeFiles\CMakeTmp\cmTC_2867a.vcxproj" on
node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_2867a.dir\Debug\".
Creating directory "C:\openCV\new_build\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_2867a.dir\Debug\cmTC_2867a.tlog\".
InitializeBuildStatus:
Creating "cmTC_2867a.dir\Debug\cmTC_2867a.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
CL.exe /c /W1 /WX- /O2 /Oy- /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_2867a.dir\Debug\\" /Fd"cmTC_2867a.dir\Debug\vc140.pdb" /Gd /TP /analyze- /errorReport:queue C:\openCV\new_build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
TRACKER : error TRK0005: Failed to locate: "CL.exe". Nie mo�na odnale��
okre�lonego pliku.
[C:\openCV\new_build\CMakeFiles\CMakeTmp\cmTC_2867a.vcxproj]
Done Building Project
"C:\openCV\new_build\CMakeFiles\CMakeTmp\cmTC_2867a.vcxproj" (default
targets) -- FAILED.
Build FAILED.
"C:\openCV\new_build\CMakeFiles\CMakeTmp\cmTC_2867a.vcxproj" (default
target) (1) ->
(ClCompile target) ->
TRACKER : error TRK0005: Failed to locate: "CL.exe". Nie mo�na odnale�� okre�lonego pliku. [C:\openCV\new_build\CMakeFiles\CMakeTmp\cmTC_2867a.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.11
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:93 (project)
Configuring incomplete, errors occurred!
See also "C:/openCV/new_build/CMakeFiles/CMakeOutput.log".
See also "C:/openCV/new_build/CMakeFiles/CMakeError.log".
I have path for MinGW bin folder created, yet there's a problem with compiler. I installed windows JDK8.1 (previously in error window it was said that I need to install it).
Related
QUESTION 1 (TEMPORARLY SOLVED USING Vcpkg)
I have read through all similar/related Questions but I'm at a loss here - I used Cmake to build the VS2019 project files for the ComputeCpp samples according to the Guide (https://developer.codeplay.com/products/computecpp/ce/guides).
I'm not incredibly familiar with Cmake but I've managed to generate them using the Cmake GUI rather than the command line, setting all flags, such as the OpenMP support (but it doesn't seem like thats relevant) - anyways
1>Building ComputeCpp integration header file D:/Google Drive/IM/Semester_4/ModalSynth_GPU/computecpp-sdk-master/computecpp-sdk-master/build/tests/vptr/basic_basic.cc.sycl
1>In file included from D:/Google Drive/IM/Semester_4/ModalSynth_GPU/computecpp-sdk-master/computecpp-sdk-master/tests/vptr/basic.cc:30:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\CL/sycl.hpp:1:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\CL/../SYCL/sycl.hpp:20:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\SYCL/sycl_builtins.h:27:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\SYCL/cpp_to_cl_cast.h:12:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\SYCL/deduce.h:25:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\SYCL/cl_types.h:23:
1>In file included from C:/Program Files/Codeplay/ComputeCpp/include\SYCL/common.h:21:
1>C:/Program Files/Codeplay/ComputeCpp/include\SYCL/include_opencl.h:27:10: fatal error: 'CL/cl.h' file not found
1>#include <CL/cl.h>
1> ^~~~~~~~~
1>1 error generated.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): error MSB6006: "cmd.exe" wurde mit dem Code 1 beendet.
1>Die Erstellung des Projekts "basic.vcxproj" ist abgeschlossen -- FEHLER.
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========
I have added the OpenCl headers to the Additional Include Dirs in the Project Settings. See Screenshots below. I've added the compiler flag for using ptx (compute++ -sycl -sycl-target ptx64 ) - I'm on a Nvidia GTX 1650.
Why does it throw the
C:/Program Files/Codeplay/ComputeCpp/include\SYCL/include_opencl.h:27:10: fatal error: 'CL/cl.h' file not found
error - with the cmd exit code 1
error MSB6006: "cmd.exe" wurde mit dem Code 1 beendet.
?
==============
TEMPORAL SOLUTION and QUESTION 2
I've installed the headers using Vcpkg with the vcpkg install opencl:x64-windows command - I however have 4 new errors that I am unable to deal with at the moment:
Something seems to be messed up regarding this path - I'm not exactly sure whats happening - what is the c1xx file good for?
Seems like the path D:\Google Drive\IM\Semester_4\ModalSynth_GPU\computecpp-sdk-master\computecpp-sdk-master\build\tests\vptr\basic.cc is split up
into
D:\Google
and
Drive\IM\Semester_4\ModalSynth_GPU\computecpp-sdk-master\computecpp-sdk-master\build\tests\vptr\basic.cc
Wtf? Thanks.
Here is my computecpp_info output for reference:
********************************************************************************
ComputeCpp Info (CE 2.0.0)
SYCL 1.2.1 revision 3
********************************************************************************
Device Info:
Discovered 1 devices matching:
platform : <any>
device type : <any>
--------------------------------------------------------------------------------
Device 0:
Device is supported : UNTESTED - Vendor not tested on this OS
Bitcode targets : ptx64
CL_DEVICE_NAME : GeForce GTX 1650
CL_DEVICE_VENDOR : NVIDIA Corporation
CL_DRIVER_VERSION : 451.22
CL_DEVICE_TYPE : CL_DEVICE_TYPE_GPU
Apparently SYCL didn't like the Space ' ' in the path
D:\Google Drive\IM\Semester_4\ModalSynth_GPU\computecpp-sdk-master\computecpp-sdk-master\build\tests\vptr\basic.cc
I replaced it with an underscore and it now works.
I am trying to compile OpenCV with Cuda support using Microsoft Visual Studio 2013 and get the following compilation error message:
22> CMake Error at cuda_compile_generated_pyrlk.cu.obj.cmake:264 (message):
22> Error generating file
22> F:/Nir/dev/opencv/build/visualStudioA/modules/cudaoptflow/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_pyrlk.cu.obj
22>
22>
22>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.
Is there a way to get more information about the error?
Increasing log verbosity, or getting the nvcc command that failed could be useful
Cuda compile verbosity can be enabled at CMakeCache.txt file:
//Print out the commands run while compiling the CUDA source file.
// With the Makefile generator this defaults to VERBOSE variable
// specified on the command line, but can be forced on with this
// option.
CUDA_VERBOSE_BUILD:BOOL=ON
I have a problem I am unable to understand.
I am trying to code a project using openCV 3.1. I want to code inside the QT Creator Environment, because I'm used to that. I do not necessarily need any QT specific features at the moment, I'm working with Ubuntu 14.04.
The problem is, that whenever I try to build inside the QT Creator, it does not build with the following error, but it works if I build from the command line.
10:57:36: Starting: "/usr/bin/cmake" --build . --target all
Linking CXX executable arucoTest
CMakeFiles/arucoTest.dir/PoseEstimator.cpp.o: In function `PoseEstimator::generateMarkers(std::string, int)':
PoseEstimator.cpp:(.text+0x56): undefined reference to `cv::aruco::getPredefinedDictionary(cv::aruco::PREDEFINED_DICTIONARY_NAME)'
PoseEstimator.cpp:(.text+0xb7): undefined reference to `cv::aruco::drawMarker(cv::Ptr<cv::aruco::Dictionary>&, int, int, cv::_OutputArray const&, int)'
PoseEstimator.cpp:(.text+0x1a9): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
CMakeFiles/arucoTest.dir/PoseEstimator.cpp.o: In function `cv::String::~String()':
PoseEstimator.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
CMakeFiles/arucoTest.dir/PoseEstimator.cpp.o: In function `cv::String::String(std::string const&)':
PoseEstimator.cpp:(.text._ZN2cv6StringC2ERKSs[_ZN2cv6StringC5ERKSs]+0x69): undefined reference to `cv::String::allocate(unsigned long)'
collect2: error: ld returned 1 exit status
make[2]: *** [arucoTest] Error 1
make[1]: *** [CMakeFiles/arucoTest.dir/all] Error 2
make: *** [all] Error 2
10:57:36: The process "/usr/bin/cmake" exited with code 2.
So it is some kind of linker error. When I inspect my cmake file and output, I see this:
Running "/usr/bin/cmake /XYZ/arucoTest '-GCodeBlocks - Unix Makefiles'" in /XYZ/arucoTest/testbuild.
-- OpenCV library status:
-- version: 2.4.8
-- libraries: opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_ocl;opencv_objdetect;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d
-- include path: /usr/include/opencv;/usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /XYZ/arucoTest/testbuild
As you can see, it only finds openCV 2.4.8, which I still need because of old ROS Indigo projects. However, if I execute the exact same cmake file and build from the commandline, it works perfectly:
username#pc:/XYZ/arucoTest/build$ cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- OpenCV library status:
-- version: 3.1.0
-- libraries: opencv_xphoto;opencv_xobjdetect;opencv_ximgproc;opencv_xfeatures2d;opencv_tracking;opencv_text;opencv_surface_matching;opencv_structured_light;opencv_stereo;opencv_saliency;opencv_rgbd;opencv_reg;opencv_plot;opencv_optflow;opencv_line_descriptor;opencv_fuzzy;opencv_face;opencv_dpm;opencv_dnn;opencv_datasets;opencv_ccalib;opencv_bioinspired;opencv_bgsegm;opencv_aruco;opencv_viz;opencv_videostab;opencv_videoio;opencv_video;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_core;opencv_calib3d
-- include path: /usr/local/include/opencv;/usr/local/include
-- Configuring done
-- Generating done
-- Build files have been written to: /XYZ/arucoTest/build
veith#roethlinLT:/XYZ/arucoTest/build$ make
Scanning dependencies of target arucoTest
[100%] Building CXX object CMakeFiles/arucoTest.dir/PoseEstimator.cpp.o
Linking CXX executable arucoTest
[100%] Built target arucoTest
As you can see I'm building in 2 different folders, because I found that if I cmake in the same folder, it does not work, even if I remove everything in that folder and cmake again from the command line. Also notice, that it finds 2 different include paths depending on where I start the cmake from.
My makefile looks like this (not very crazy), I'm using this exact same file for both cases.
project(arucoTest)
cmake_minimum_required(VERSION 2.8)
find_package(OpenCV REQUIRED)
message(STATUS "OpenCV library status:")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
set(HEADER_LIST PoseEstimator.h)
set(SRC_LIST PoseEstimator.cpp)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
Using ccmake and the QT build in inspection window, I see that the OpenCV_DIR variable is set to 2 different things: On command line:
OpenCV_DIR /usr/local/share/OpenCV
In QT Creator:
OpenCV_DIR /ust/share/OpenCV
How do I set this to automatically select the right folder inside QT Creator as well? I really have no idea what could cause this!
Thanks!
Cache variable OpenCV_DIR is set by searching with command find_package (in config mode). While search mechanism is fully deterministic (it is described in the doc), it uses some envorinment variables which may differ under your shell and in QT Creator.
Just a guess, QT Creator may set CMAKE_PREFIX_PATH environment variable to contain /usr directory, so it finds an installation under /usr before one under /usr/local.
For choose specific OpenCV installation, just set OpenCV_DIR cache variable accordingly and rerun configuration process.
I am trying to build a project from git.Getting following error:
CMake Warning at cmake/OpenCVDetectCXXCompiler.cmake:95 (message):
GCC version not detected!
Call Stack (most recent call first):
CMakeLists.txt:116 (include)
-- Detected version of GNU GCC: 00 (0)
-- Check if the system is big endian
-- Searching 16 bit integer
CMake Error at /usr/share/cmake-3.2/Modules/TestBigEndian.cmake:51 (message):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:529 (test_big_endian)
-- Configuring incomplete, errors occurred!
Not able to understand the error. Any help appreciated
In the project 3. Build Android OpenCV SDK with extra modules for Android when I am trying to sh ./scripts/cmake_android_arm.sh I am getting the above error.
I was getting the same error: TestBigEndian: no suitable type found.
However, deleting the CMakeCache.txt file under build_android_arm directory resolved this issue.
I am trying to build OpenCV for WinRT by following the instruction here
Opened Visual Studio 2013 developer command prompt, navigated to
cd path/opencv/platforms/winrt
then run the command
setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" -b
But which ended up with the following error,
INFO> Directory: E:\Software\OpenCV\opencv_winrt\opencv-master\bin\WP\8.0\x
6
INFO> Platform: WindowsPhone
INFO> Version: 8.0
INFO> Architecture: x86
INFO> Generator: Visual Studio 12 2013
INFO> Install Directory: E:\Software\OpenCV\opencv_winrt\opencv-master\bin\
nstall\WP\8.0\x86
Directory: E:\Software\OpenCV\opencv_winrt\opencv-master\bin\WP\8.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 17-Feb-16 11:36 PM x86
INFO> Generating project:
INFO> cmake -G Visual Studio 12 2013 -DCMAKE_SYSTEM_NAME:String=WindowsPhone -D
MAKE_SYSTEM_VERSION:String=8.0 -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 -DCMAK
_INSTALL_PREFIX:PATH=E:\Software\OpenCV\opencv_winrt\opencv-master\bin\install\
P\8.0\x86 E:\Software\OpenCV\opencv_winrt\opencv-master
CMake Error at CMakeLists.txt:88 (project):
A Windows Phone component with CMake requires both the Windows Desktop SDK
as well as the Windows Phone '8.0' SDK. Please make sure that you have
both installed
-- Configuring incomplete, errors occurred!
See also "E:/Software/OpenCV/opencv_winrt/opencv-master/bin/WP/8.0/x86/CMakeFil
s/CMakeOutput.log".
INFO> -----------------------------------------------
INFO> Building and installing project:
INFO> Executing: msbuild OpenCV.sln /p:Configuration='Debug' /m
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.34014]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: OpenCV.sln
INFO> Error: Failure executing command: msbuild OpenCV.sln /p:Configuration='De
ug' /m
I have confirmed the Windows SDK installed or not by looking at
C:\Program Files (x86)\Microsoft SDKs\Windows
and I can see following directories there,
v7.0A, v7.1A, v8.0, v8.0A, v8.1, v8.1A
What could be the issue here?