Tag Archives: cmake

[Solved] target_link_libraries error: a missing vtable usually means the first non-inline virtual member function has no definition.

target_link_libraries error:

When compiling a project with cmake, the following appears:

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

Cmake:

target_link_libraries(target target1 target2)

In this way, Target1 and target2 libraries need to be used when linking target. However, if Target1 also uses target2, you need to add additional:

target_link_libraries(target1 target2)

Otherwise, when the link generates Target1, you can’t find anything in target2. If target uses Target1 link again, it will definitely report an error.

Ubuntu install and compile OpenCV3.4.0 fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nv

Problems encountered

fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nvcuvid.h>

Solution
Add: -dbuild_opencv_cudacodec=OFF

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -DBUILD_opencv_cudacodec=OFF ..

sudo make -j12
sudo make install

Problems encountered

[ WARN:0] cvCreateFileCaptureWithPreference: backend FFMPEG doesn't support legacy API anymore.

Solution

install opencv3.4.0 

It must be 3.4.0, others 3.4 X is wrong
3.4.0 download address https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/3.4.0
Then install the extension package of OpenCV 3.4.0, download address, https://codeload.github.com/opencv/opencv_contrib/tar.gz/refs/tags/3.4.0

launch file Run Error: Resourcenotfound: XXX [How to Solve]

launch File run Error:

Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 308, in main
    p.start()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
    self._start_infrastructure()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
    self._load_config()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default
    loader.load(f, config, verbose=verbose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 750, in load
    self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 722, in _load_launch
    self._recurse_load(ros_config, launch.childNodes, self.root_context, None, is_core, verbose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 686, in _recurse_load
    val = self._include_tag(tag, context, ros_config, default_machine, is_core, verbose)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 95, in call
    return f(*args, **kwds)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 589, in _include_tag
    inc_filename = self.resolve_args(tag.attributes['file'].value, context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 183, in resolve_args
    return substitution_args.resolve_args(args, context=context.resolve_dict, resolve_anon=self.resolve_anon)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 370, in resolve_args
    resolved = _resolve_args(resolved, context, resolve_anon, commands)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 383, in _resolve_args
    resolved = commands[command](resolved, a, args, context)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 151, in _find
    source_path_to_packages=source_path_to_packages)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 197, in _find_executable
    full_path = _get_executable_path(rp.get_path(args[0]), path)
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 207, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)
ResourceNotFound: lslidar_c16_decoder
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/lskk/lego_loam_ws/src
ROS path [2]=/opt/ros/kinetic/share

 

 

Solution:
For ResourceNotFound: xxx class issues. If it is an installation package, perform the corresponding installation; for this error, the file is not found, check the lslidar_c16_decoder item in launch and modify it.

 

[Solved] ubuntu makefile Cross-compilation error: file not recognized: file format not recognized

When compiling netkit-ftp on linux ubuntu an error is reported: file not recognized: file format not recognized

[root@ubuntu /arnold_test/20211219_ftpCrossCompile/netkit-ftp-0.17]24# make
(cd  ftp && make)
make[1]: Entering directory '/arnold_test/20211219_ftpCrossCompile/netkit-ftp-0.17/ftp'
arm-linux-gnueabihf-gcc -O2 -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline  glob.c -c
arm-linux-gnueabihf-gcc -O2 -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline  main.c -c
arm-linux-gnueabihf-gcc -O2 -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline  ruserpass.c -c
arm-linux-gnueabihf-gcc  cmds.o cmdtab.o domacro.o ftp.o glob.o main.o ruserpass.o  -o ftp
cmds.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'ftp' failed
make[1]: *** [ftp] Error 1
make[1]: Leaving directory '/arnold_test/20211219_ftpCrossCompile/netkit-ftp-0.17/ftp'
Makefile:7: recipe for target 'ftp.build' failed
make: *** [ftp.build] Error 2

Solution: make clean

Or manually delete the files generated by the previous compilation

[Solved] QT cmak Compile Error: CMake Error: The source.. does not match the soused

**Cmake error: the source… Does not match the used to generate cache Re-run cmake…

Solution:
Delete the CMakeLists.txt.user file in the project.

problem is solved. Later, it is found that the file is also a cache file, which contains the compilation status information of the project before, such as the debug directory. In cmake, if there is this file, the compiler will use the relevant cache information in this file, so various errors will occur:

delete the file and restart cmake, A new file is regenerated.

JOM error 2 problem when qtcreator uses cmake to build a project

When qtcreator uses the MSVC compilation environment to build a project, a JOM: C: /… /… [cmtc_fe41e \ fast] error 2 error will occur due to incorrect configuration. Here are my solutions and understanding of this problem. I hope it can help small partners who encounter the same problem.

Error screenshot

Error reason

When qtcreator uses cmake to build a project, it will first test the environment configuration. If you have used cmake GUI or the command line to generate the corresponding project file (vs. vcxproj or Makefile, etc.) through cmakelists.txt, you will understand this process. Cmake uses the – g parameter to see which specific projects are supported, called cmake generators.

Cmake command line generates makefiles:
MD build
CD build
cmake – G “nmake makefiles JOM”…
#[[
… Indicates that cmakelists.txt is placed in the upper level directory. In this step, cmake will automatically detect the environment. If an error occurs, you cannot generate project files or makefiles
#]]
nmake

Cmake GUI: after setting, click Configure to generate if there is no problem

so the JOM error above is that cmake detects that the environment configuration is incorrect. At this time, you will see that qtcreator will not load the source file at all. Only one cmakelists.txt

open cmake’s error log file, and you will find that some tools needed in the construction process cannot be found:

“D:\Program Files (x86)\CMake\bin\cmake.exe” -E vs_ link_ exe
–intdir=CMakeFiles\cmTC_ 5b162.dir
–rc=rc
–mt=CMAKE_ MT-NOTFOUND
–manifests
– D:\PROGRA1\MICROS1.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\cmTC_ 5b162.dir\objects1.rsp @C:\Users\ADMINI~1\AppData\Local\Temp\cmTC_ 5b162.exe.9516.577.jom

RC pass 1: command “RC/fo cmakefiles \ cmtc_5b162. Dir/manifest. Res cmakefiles \ cmtc_5b162. Dir/manifest. RC” failed (exit code 0) with the following output:
the system cannot find the specified file. jom: C:\Users\Administrator\AppData\Local\Temp\QtCreator-liCfaX\qtc-cmake-pToFXfXx\CMakeFiles\CMakeTmp\CMakeFiles\cmTC_ 5b162.dir\build.make [cmTC_5b162.exe] Error 2

jom: C:\Users\Administrator\AppData\Local\Temp\QtCreator-liCfaX\qtc-cmake-pToFXfXx\CMakeFiles\CMakeTmp\Makefile [cmTC_5b162\fast] Error 2

RC is rc.exe, and the resource compiler
MT is mt.exe

resolvent

It’s easy to know the cause of the error

First, add the path of jom.exe to the environment variable path
${QT installation directory} \ tools \ qtcreator \ bin

Then add the paths of rc.exe and mt.exe to the environment variable path
C: \ program files (x86) \ windows kits \ 10 \ bin \ 10.0.17763.0 \ x86
depending on the system version and 32-bit/64 bit, find out for yourself

When there are no problems, you can build the project

[Solved] Mac Cmake Complie openmp Error: fatal error: ‘omp.h‘ file not found

Mac OS 11.5.2, cmake default compiler appleclang 12.0.5

Make keeps reporting errors after compiling

fatal error: 'omp.h' file not found
#include<omp.h>

The reason is that a.cpp file introduces OpenMP, OMP.H

It can be compiled successfully through G + +, but the make default clang compilation in MAcc is not successful. In other words, it cannot be compiled through cmake on Mac

Try to resolve:

Adding before the project line of cmake has no effect

SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")

On the command line, the export cxx = “usr/bin/G + +” variable also has no effect

Solution

Brew install libomp

brew install libomp

Change the path corresponding to OMP. H where. CPP introduces OMP. H

#include</usr/local/opt/libomp/include/omp.h>

[Solved] CMake Error: Could not create named generator Visual Studio 16 2019

Cmake error: could not create named generator visual studio 16 2019

When running the demo in openvino, this bug is always prompted. According to the suggestions of stackoverflow and official documents, use cmake - G "Visual Studio 16 2019" - a x64 this command to compile, which is also invalid. Later, after troubleshooting, I thought it might be the problem of cmake version. Because the old version of cmake (before 3.14) may not find the latest visual studio, I went to the official website to download it, Run the. Bat file in the demo to solve the problem


How to Solve Msys2/mingw64 Run cmake GUI Error

August 24, 2021
It has been updated to the latest version.

MINGW64 ~
$ cmake-gui –version
cmake version 3.21.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).

But still error as below:

$ cmake-gui
C:/msys64/mingw64/bin/cmake-gui.exe: error while loading shared libraries: zlib1.dll: cannot open shared object file: No such file or directory

Finally found that the installation of qt5 can be solved

pacman -S mingw-w64-x86_64-qt5
resolving dependencies…
looking for conflicting packages…
Packages (16) mingw-w64-x86_64-assimp-5.0.1-11  mingw-w64-x86_64-dbus-1.12.20-3  mingw-w64-x86_64-double-conversion-3.1.5-1  mingw-w64-x86_64-icu-debug-libs-68.2-3  mingw-w64-x86_64-libgcrypt-1.9.2-2
mingw-w64-x86_64-libgpg-error-1.42-1  mingw-w64-x86_64-libmng-2.0.3-4  mingw-w64-x86_64-libmysofa-1.2-1  mingw-w64-x86_64-libxslt-1.1.34-4  mingw-w64-x86_64-minizip-git-1.2.445.e67b996-2  mingw-w64-x86_64-openal-1.21.1-2
mingw-w64-x86_64-pcre2-10.36-1  mingw-w64-x86_64-qtbinpatcher-2.2.0-4  mingw-w64-x86_64-xpm-nox-4.2.0-6  mingw-w64-x86_64-z3-4.8.9-2  mingw-w64-x86_64-qt5-5.15.2-10
Total Download Size:   223.16 MiB
Total Installed Size:  873.75 MiB
…………………………

then re-run:

cmake-gui

You will be able to value the dialog box of the gui pop-up!

[Solved] OpenGL PowerVR SDK Compiling Error: Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)

Project scenario:

Compiling powervr SDK

Problem Description:

In the process of cmake powervr SDK, the error message is as follows:

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindX11.cmake:366 (find_package_handle_standard_args)
  framework/PVRShell/CMakeLists.txt:92 (find_package)


-- Configuring incomplete, errors occurred!
See also "/mnt/f/CG21S/Native_SDK-R21.1-v5.7/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/f/CG21S/Native_SDK-R21.1-v5.7/build/CMakeFiles/CMakeError.log

Cause analysis:

Search for could not find X11 (missing: X11)_ X11_ INCLUDE_ PATH X11_ X11_ The following blog posts were obtained:
in this study, we found that https://blog.csdn.net/quantum7/article/details/93484972
Indicates that xtest. H is missing

Solution:

After testing, the following codes are valid:

sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev