Vtk charts break in QT, "no override found for 'vtkContextDevice2D" - c++

I can't use any type of vtk 2D chart in QT without getting the error:
"Generic Warning: In vtkContextDevice2D.cxx, line 31 Error: no override found for 'vtkContextDevice2D".
There is limited discussion on this with almost all suggestions being to upgrade qt/vtk, but theses are year old and I am on the newest versions.
This doesn't help either:
include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);
Info: Win64 on 64bit machine, vtk8.2.0, Qt5.13.0, compiled/built in MCVS2017(Release x64) with cmake3.15.0
(Everything else works fine, even 3D renderings with vtk)
Code:
view->SetInteractor(this->qvtkWidgetRight->GetInteractor());
this->qvtkWidgetRight->SetRenderWindow(view->GetRenderWindow());
What the error produces

I had a similar problem when I run this example:QtBarChart, and I fixed this issue with linking with these vtk libraries:
find_package(VTK COMPONENTS
vtkChartsCore
vtkCommonCore
vtkCommonDataModel
vtkInteractionStyle
vtkRenderingContext2D
vtkRenderingContextOpenGL2
vtkRenderingCore
vtkRenderingFreeType
vtkRenderingGL2PSOpenGL2
vtkRenderingOpenGL2
vtkViewsContext2D
QUIET
It seems I missed some libraries.

Related

CMake error: Could not find the VTK package with the following required components:GUISupportQt, ViewsQt

I compiled VTK in my RedHat 8.3 machine, and now when I want to compile an example in the /GUI/Qt/SimpleView with cmake I get the following error message when configuring:
CMake Warning at CMakeLists.txt:4 (find_package):
Found package configuration file:
home/user/Downloads/VTK-9.1.0/build/lib64/cmake/vtk-9.1/vtk-config.cmake
but it set VTK_FOUND to FALSE so package “VTK” is considered to be NOT FOUND.
Reason given by package:
Could not find the VTK package with the following required components:
GUISupportQt, ViewsQt.
Has anyone encountered this problem before ?
Thank you for your help.
This looks like you did not set the VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES" when running configure in CMake.
Note: the abovementioned option names are only applicable for VTK >= 9; for VTK < 9, they are called Module_vtkGUISupportQt and Module_vtkViewsQt (and you might also need to enable Module_vtkGUISupportQtOpenGL and Module_vtkRenderingQt).
These options are not enabled by default, but they seem to be required by the example that you're trying to compile.
Don't worry, you shouldn't have to re-do everything now. To fix:
Open the CMake GUI.
Enter the folder where you built VTK in "Where to build the binaries".
If it's not checked, set the "Advanced" checkbox (the required options are not visible otherwise).
Set VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES"
Press "Configure", and wait for it to finish
During Configuring, you might get an error, if CMake doesn't know how to find Qt; if so, enter the Qt5_DIR / Qt6_DIR, and press configure again.
Press "Generate", and wait for it to finish
Start the vtk build again (depends on what build tool you choose...)
Try configuring the example again, now you should not see the error message anymore.

What are the requirements to use EGL?

I'd like to try out to redner images into files on server side without a real windowing system. Following this article, EGL should be able to do that.
I have access to an Ubuntu server, where the following packages are installed: freeglu3, freeglut3-dev, libegl1-mesa-dev, and libglew-dev. This allows compiling, linking and running sample apps. Running nvidia-smi says the driver is above version 460, which is higher than the 3xx mentioned in the article.
When I try to execute the simple sample program, eglInitialize returns false, and eglGetError() is set to EGL_NOT_INITIALIZED.
EGLDisplay eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
EGLint major, minor;
eglInitialize(eglDpy, &major, &minor);
The blog post and other SO answers say that I should link libOpenGL.so. But I'm not linking by hand, I'm using the cmake code provided in that article:
find_package(OpenGL REQUIRED COMPONENTS OpenGL EGL)
add_executable(your_binary_name main.c)
target_link_libraries(your_binary_name PRIVATE OpenGL::OpenGL OpenGL::EGL)
And idneed, looking at the generated cmake files that .so file is used:
your_binary_name: /usr/lib/x86_64-linux-gnu/libOpenGL.so
your_binary_name: /usr/lib/x86_64-linux-gnu/libEGL.so
your_binary_name: /usr/lib/x86_64-linux-gnu/libGLU.so
your_binary_name: /usr/lib/x86_64-linux-gnu/libGLEW.so
your_binary_name: /usr/lib/x86_64-linux-gnu/libGLX.so
What am I missing? I can't find any other required dependencies to set up EGL and headless rendering.

How to fix "SDL_Init failed -1" in buildroot Raspberry image?

I'm trying to compile Navit for Raspberry Pi 3 with Buildroot image (WPE Framework included). There is only WPE Framework running on startup (no x server) therefore I would like to display Navit using framebuffer directly. I know there is support for this feature. I have configured Navit as follow:
https://i.stack.imgur.com/cDZ3O.png
but I'm not able to run it anyway. There is following error:
error:graphics_sdl:graphics_sdl_new:SDL_Init failed -1
I've installed SDL from buildroot. How to fix it or make SDL more verbose to find out what is the reason of this -1 error (missing dependencies, incompatible lib version, Navit configration problems, missing system variables pointing to specified dependencies)?
It turned out that Navit is very quiet about SDL error messages. -1 Error is just very general information... I had to recompile Navit sources and add SDL_GetError() function to code to find out what is a real reason.
The problem was missing mouse. I don't need it so I had to set up:
export SDL_NOMOUSE=1

QT Quick (QML) assemble mac-.bundle -> not a dynamic library error when using macdeployqt

I struggle with this for weeks now and hope someone finds this useful or knows an answer.
- I use QT 5.7 and QT 5.8 and the error occurs on both versions.
I have a QT Quick 2.0 application which I build as a dynamically linked .bundle application on a Mac using macdeployqt.
I call macdeployqt with the following parameters:
%{buildDir}/imageDatabase.app -qmldir=%{buildDir}/../UserInterface/ -always-overwrite -verbose=2
The working directory is $QTDIR/bin because macdeploy needs to be run from inside the QT-Installation directory as I learned here: https://forum.qt.io/topic/59030/solved-macdeployqt-problem/6
The following error occurs when I try to run the application:
Double-click: The app opens and the icon appears in the bar on the bottom but besides that nothing happens
Starting the app from Terminal:
Output
Machine:MacOS MyName$ ./tool
QQmlApplicationEngine failed to load component qrc:/main.qml:1 plugin cannot be
loaded for module "QtQuick": '/Users/thorstenbux/DAQRI/gitHub/artoolkit6/Source/Utilities/ImageDBSerialiser/build-ui/imageDatabase.app/Contents/PlugIns/quick/libqtquick2plugin.dylib'
is not a valid Mach-O binary (not a dynamic library)
Calling file on the library in question reveals the following
Machine:MacOS MyName$ file /Users/myname/client/gitHub/tool/SDK/Applications/tool.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib
/Users/myname/client/gitHub/tool/SDK/Applications/tool.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib: Mach-O 64-bit dSYM companion file x86_64
looks like it is loading the debug libraries.
macdeployqt error message is the following:
ERROR: Could not parse otool output: "/Users/myname/DAQRI/gitHub/tool/Source/Utilities/tool/build-tool-Desktop_Qt_5_8_0_clang_64bit-Release/tool.app/Contents/PlugIns/quick/libqtquick2plugin.dylib:\n"
Any ideas?
I finally found a solution in the QT forums. It looks like the macdeployqt has a severe bug: https://bugreports.qt.io/browse/QTBUG-57265
You need to call macdeployqt without the -always-overwrite option.
Many thanks to Andy Shaw who posted that here:
https://bugreports.qt.io/browse/QTBUG-57265?focusedCommentId=346168&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-346168

Error cross-compiling qt5 project with mxe using function introduce in Qt5

I've tried to cross-compile a Qt5 project using mxe, which seems to work as long as I'm not using any functions introduced with the Qt5.
I'm using Ubuntu, the following steps lead to my problem:
1.
I followed the mxe-tutorial found here: http://mxe.cc/#tutorial to build qt5.
2.
I cross-compiled a small test project, which worked excellent up to the point where I used the function QTime:: int msecsSinceStartOfDay() const
I get the following error when running the make command:
main.cpp:10:57: error: 'class QTime' has no member named 'msecsSinceStartOfDay' QString msSinceStartOfDay = QString ("%1").arg(time.msecsSinceStartOfDay())
I can't figure out the problem, I think using a function introduced in Qt5 should work, because I'm using the qmake of Qt5.
Any help would be much appreciated.
Thank you for your time David