how to build kate with cmake? - c++

Dear stackoverflow users,
I'm trying to compile kate from source but I'm getting an error with a not declared variable.
So far these are the commands I'm using:
#! /bin/bash
cmake \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_INSTALL_PREFIX=~/kde/usr \
-D KDE_INSTALL_USE_QT_SYS_PATHS:BOOL=ON \
-D TARGET_include_directories:PATH="/usr/include/x86_64-linux-gnu/qt5/" \
-D Qt5_INCLUDE_DIRS:PATH="/usr/include/x86_64-linux-gnu/qt5/" \
-D Qt5_LIBRARY_DIRS:PATH="/usr/lib/x86_64-linux-gnu/qt5/" \
../kate/
make
make install
Please find below the error during compiling: I think it has to be related with not including some path file that should be there which declares the variable QWidgetAction, however I'm not sure why, since I installed all required packages as per the website.
(qtbase5-dev qtscript5-dev extra-cmake-modules plasma-framework-dev libkf5crash-dev libkf5config-dev libkf5activities-dev kinit-dev kdoctools-dev libkf5i18n-dev libkf5parts-dev libkf5guiaddons-dev libkf5iconthemes-dev libkf5jobwidgets-dev kio-dev libkf5texteditor-dev libkf5windowsystem-dev libkf5xmlgui-dev libgit2-dev).
The reason I'm compiling it is because I messed up with my original installed kate and I just can't load back all plugins, since my /.config kate folder is gone. Please any help is appreciated.
[ 69%] Automatic moc for target katecloseexceptplugin [ 69%] Built
target katecloseexceptplugin_automoc [ 71%] Built target
katecloseexceptplugin [ 71%] Automatic moc for target
katesqlplugin [ 71%] Built target katesqlplugin_automoc [
71%] Building CXX object addons/katesql/CMakeFiles/katesqlplugin.dir
/katesqlview.cpp.o
/home/pablo/kde/kate/addons/katesql/katesqlview.cpp: In member
function ‘void KateSQLView::setupActions()’:
/home/pablo/kde/kate/addons/katesql/katesqlview.cpp:141:3: error:
‘QWidgetAction’ was not declared in this scope QWidgetAction
*wa = new QWidgetAction(this); ^ /home/pablo/kde/kate/addons/katesql/katesqlview.cpp:141:18: error:
‘wa’ was not declared in this scope QWidgetAction *wa =
new QWidgetAction(this);
^ /home/pablo/kde/kate/addons/katesql/katesqlview.cpp:141:27: error:
expected type-specifier before ‘QWidgetAction’
QWidgetAction wa = new QWidgetAction(this);
^ addons/katesql/CMakeFiles/katesqlplugin.dir/build.make:96: recipe for
target
'addons/katesql/CMakeFiles/katesqlplugin.dir/katesqlview.cpp.o' failed
make[2]:
[addons/katesql/CMakeFiles/katesqlplugin.dir/katesqlview.cpp.o]
Error 1 CMakeFiles/Makefile2:2439: recipe for target
'addons/katesql/CMakeFiles /katesqlplugin.dir/all' failed
make[1]: * [addons/katesql/CMakeFiles/katesqlplugin.dir/all] Error 2
Makefile:138: recipe for target 'all' failed make: *** [all]
Error 2

QWidgetAction is a part of Qt. Have you got the Qt libraries and headers properly in your path?
Header: #include

Related

macOS Monterey --> fatal error: 'opencv2/videoio.hpp' file not found

I am trying to build opencv on macOS for a CPP capstone project but when I try to compile like so:
cmake -D CMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=OFF -D BUILD_opencv_objdetect=OFF -D BUILD_opencv_video=OFF -D BUILD_opencv_videoio=OFF -D BUILD_opencv_features2d=OFF -D BUILD_opencv_flann=OFF -D BUILD_opencv_highgui=OFF -D BUILD_opencv_ml=OFF -D BUILD_opencv_photo=OFF -D BUILD_opencv_python=OFF -D BUILD_opencv_shape=OFF -D BUILD_opencv_stitching=OFF -D BUILD_opencv_superres=OFF -D BUILD_opencv_ts=OFF -D BUILD_opencv_videostab=OFF ..
make -j8
I am getting the following error:
[ 98%] Built target opencv_model_diagnostics
make[2]: *** No rule to make target `zlib', needed by `lib/python3/cv2.cpython-39-darwin.so'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 98%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
In file included from /Users/username/Projects/opencv/opencv/modules/python/src2/cv2.cpp:11:
In file included from /Users/username/Projects/opencv/opencv/build/modules/python_bindings_generator/pyopencv_generated_include.h:50:
/Users/username/Projects/opencv/opencv/modules/gapi/include/opencv2/gapi/streaming/cap.hpp:26:10: fatal error: 'opencv2/videoio.hpp' file not found
#include "opencv2/videoio.hpp"
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make: *** [all] Error 2
I did follow at first the instruction from opencv but make step fails at:
[ 36%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/int8layers/layers_common.avx512_skx.cpp.o
[ 36%] Linking CXX shared library ../../lib/libopencv_dnn.dylib
[ 36%] Built target opencv_dnn
make: *** [all] Error 2
Any help is highly appreciated.

Building OpenCV using makefile throwing error?

I was trying to setup OpenCV environment using MingW64 and visual studio code,
Work done so far
Installed and set environment CMake
Installed OpenCV 4.5.2
OpenCV Makefile generation
using CMake Build from source(openCV directory)
specified the generator for the project
configured the compiler type and makefile type
Enabled precompiled header
Confusing part
when I entered the command mingw32-make for compilation in directory where the makefile is generated
It worked until 67% after that:
[ 67%] Built target pch_Generate_opencv_test_dnn
Scanning dependencies of target opencv_test_dnn
[ 67%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/npy_blob.cpp.obj
In file included from <command-line>:0:0:
D:/opencv/build/modules/dnn/test_precomp.hpp:50:10: fatal error: test_common.hpp: No such file or directory
#include "test_common.hpp"
^~~~~~~~~~~~~~~~~
compilation terminated.
mingw32-make[2]: *** [modules\dnn\CMakeFiles\opencv_test_dnn.dir\build.make:82: modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/npy_blob.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:3429: modules/dnn/CMakeFiles/opencv_test_dnn.dir/all] Error 2
mingw32-make: *** [Makefile:181: all] Error 2
thank you

cmake error when i have tried to build a compilining?

i have tried to compline a repository via "https://github.com/giglio0/DRAGON-G4-LaBr3.git" but while the compiling, i have taken a error. I don't Know why it is? i am not a coder. Just i want to build this repository and run the simulation with changing some parameters. The error output is;
Scanning dependencies of target LaBr3_v4
[ 9%] Building CXX object CMakeFiles/LaBr3_v4.dir/LaBr3_v4.cc.o
[ 18%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorConstruction.cc.o
[ 27%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorMessenger.cc.o
[ 36%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/EventAction.cc.o
[ 45%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o
/home/cancan/Gatev9/example_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory
29 | #include <TH1D.h>
| ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LaBr3_v4.dir/build.make:134: CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3_v4.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
can anybody help me?
Apparently you need to install the ROOT library, see: https://root.cern.ch/doc/master/classTH1.html
BTW, the READ.me of the application you want to compile, DRAGON-G4-LaBr3, is awful.
After your advice, i install root-6.22.06 again with use this command;
cmake -DCMAKE_INSTALL_PREFIX=/home/cancan/Gatev9/root-6.22.06-install /home/cancan/Gatev9/root-6.22.06 -Dall=ON
i learned from somewhere if i use "-Dall=ON", i can install all libraries of root but it has not still worked.

No rule to make target 'TBB_ENV_LIB_DEBUG-NOTFOUND', needed by 'lib/libopencv_core.so.3.2.0

I'm trying to build opencv with the following CMAKE options:
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/home/luca/Dropbox/SURFSPM/opencvInstall -D OPENCV_EXTRA_MODULES_PATH=/home/luca/ParallelOpenCV/opencv_contrib/modules -D WITH_TBB=ON -D WITH_OPENMP=ON -D ENABLE_PROFILING=ON ..
Notice that in RELEASE mode OpenCV is correctly compiled with all the other options. However, at 43% it returns this error:
[ 42%] Built target pch_Generate_opencv_perf_optflow
[ 42%] Built target pch_Generate_opencv_test_optflow
[ 43%] Generating precomp.hpp.gch/opencv_structured_light_DEBUG.gch
Scanning dependencies of target opencv_core
[ 43%] Built target pch_Generate_opencv_test_phase_unwrapping
make[2]: *** No rule to make target 'TBB_ENV_LIB_DEBUG-NOTFOUND', needed by 'lib/libopencv_core.so.3.2.0'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 43%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
cc1plus: warning: /home/luca/ParallelOpenCV/opencv/build/modules/core/precomp.hpp.gch/opencv_core_Release.gch: created with -gnone, but used with -gdwarf-2
[ 43%] Built target pch_Generate_opencv_test_stitching
[ 43%] Built target pch_Generate_opencv_phase_unwrapping
[ 43%] Built target pch_Generate_opencv_test_structured_light
[ 43%] Built target pch_Generate_opencv_perf_stitching
[ 43%] Built target pch_Generate_opencv_stitching
[ 43%] Built target pch_Generate_opencv_structured_light
CMakeFiles/Makefile2:2161: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I think that this is Intel TBB related, but I've installed it (in fact it works with the RELEASE version and I don't know how to solve this.
Like #Tsyvarev's comment hints, indeed the configuration phase fails to pickup a debug library version.
I've gotten success setting the original setting:
TBB_ENV_LIB_DEBUG:FILEPATH=TBB_ENV_LIB_DEBUG-NOTFOUND
To the same value as TBB_ENV_LIB:FILEPATH
//Path to a library.
TBB_ENV_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so
//Path to a library.
TBB_ENV_LIB_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so

Error while building OpenCV 3.1.0 with extra modules on OS X Mavericks

I am a beginner in OpenCV, using OpenCV 3.1.0 (downloaded from OpenCV.org) with Mac OS X 10.9.5.
I was trying to run a code which needs contrib.hpp, then I found the extra modules from Github. There is a command from the page:
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5
Everything was successful before I did make, it shows an error of no matching function for call to 'calibrateCamera' :
[ 92%] Building CXX object modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o
/Users/Youko/downloads/opencv_contrib-master/modules/aruco/src/aruco.cpp:1583:12: error:
no matching function for call to 'calibrateCamera'
return calibrateCamera(processedObjectPoints, processedImagePoints, ...
^~~~~~~~~~~~~~~
/Users/Youko/downloads/opencv-3.1.0/modules/calib3d/include/opencv2/calib3d.hpp:844:21: note:
candidate function not viable: requires at most 9 arguments, but 12 were
provided
CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
^
1 error generated.
make[2]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/src/aruco.cpp.o] Error 1
make[1]: *** [modules/aruco/CMakeFiles/opencv_aruco.dir/all] Error 2
make: *** [all] Error 2
In the case of I wanna keep the version of Mac OSX, I was thinking of change the version of OpenCV, so I've downloaded OpenCV from Github, and tried to install the OpenCV with following command (it was the same way as how I've installed OpenCV 3.1.0 successfully):
$ cd <opencv_source_directory>
$ mkdir release
$ cd release
$ cmake -G "Unix Makefiles" ..
$ make
$ sudo make install
But there is another problem when I tried make:
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
[ 44%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_avfoundation_mac.mm.o
[ 44%] Linking CXX shared library ../../lib/libopencv_videoio.dylib
ld: framework not found CoreImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_videoio.3.1.0.dylib] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
I thought maybe there was something wrong with cmake, so I tried the following command as well but the same error occurred with make:
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
I've googled for the problem and it seems like I must need the QuartzCore, but most of people said it should be included in the Xcode (I am using Xcode 6.2 btw). I tried both ways to figure it out but I still have no idea why I can't build the extra modules. (I think the most weird problem is that I cannot install OpenCV cloned from Github, but I just wanna show I tried this way but it wasn't successful FYI.)
I'd be most grateful for any help and suggestions!