OmixVisualization / qtjambi

QtJambi is a wrapper for using Qt in Java.
http://www.qtjambi.io
Other
360 stars 42 forks source link

[BUG] qtjambi-native-linux-x64 crash on ubuntu 24.04 #203

Closed long76 closed 2 weeks ago

long76 commented 3 months ago

Describe the bug crash start up on ubuntu 24.04

To Reproduce Steps to reproduce the behavior:

  1. run qtjambi app well work on Ubuntu 22.04 in Ubuntu 24.04
  2. See error
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007bee64766ca1, pid=2660, tid=2661
    #
    # JRE version: OpenJDK Runtime Environment (11.0.23+9) (build 11.0.23+9-post-Ubuntu-1ubuntu1)
    # Java VM: OpenJDK 64-Bit Server VM (11.0.23+9-post-Ubuntu-1ubuntu1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
    # Problematic frame:
    # C  [libQt5Core.so.5.15.13+0x166ca1]  operator==(QString const&, QString const&)+0x11
    #
    # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/user/MyProgram/core.2660)
    #
    # An error report file with more information is saved as:
    # /home/user/MyProgram/hs_err_pid2660.log
    #
    # If you would like to submit a bug report, please visit:
    #   https://bugs.launchpad.net/ubuntu/+source/openjdk-lts
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #

    hs_err_pid2660.log

Expected behavior start app without errors

System (please complete the following information):

Additional context hs_err_pid2660.log

wolfseifert commented 3 months ago

You are using /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.13, installed by the Kubuntu package manager. QtJambi is built against the Qt-online-installed version (see https://doc.qt.io/qt-5/gettingstarted.html). You should try this version and see if it still dumps. Unfortunately there is no 5.15.13, only 5.15.0, 5.15.1 and 5.15.2. So probably Kubuntus 5.15.13 causes the problem and this has changed with the upgrade from 22.04.

omix commented 3 months ago

@wolfseifert thank you for your comment. You are right. However, the stack trace indicates it is not because of incompatibility. During application startup Qt tries to load style plugins. Here, an access violation takes place in Qt independent from QtJambi. Is there an env variable QT_QUICK_CONTROLS_CONF set? Otherwise, Qt searches in a directory called :/. In QtJambi, this directory includes the Java classpath. Maybe there is the error because a string coming from Java classpath is invalid.

You could try to run the application with setting QT_QUICK_CONTROLS_CONF to any existing directory. Additionally, I suggest to print the :/ directory prior to app initialization:

QDir dir = new QDir(":/");
QStringList entries = dir.entryList(new QStringList(), QDir.Filter.Dirs, QDir.Filter.NoDotAndDotDot);
for(String file : entries){
    // check if file string is valid
}
long76 commented 3 months ago

@wolfseifert thank you for your comment. You are right. However, the stack trace indicates it is not because of incompatibility. During application startup Qt tries to load style plugins. Here, an access violation takes place in Qt independent from QtJambi. Is there an env variable QT_QUICK_CONTROLS_CONF set? Otherwise, Qt searches in a directory called :/. In QtJambi, this directory includes the Java classpath. Maybe there is the error because a string coming from Java classpath is invalid.

You could try to run the application with setting QT_QUICK_CONTROLS_CONF to any existing directory. Additionally, I suggest to print the :/ directory prior to app initialization:

QDir dir = new QDir(":/");
QStringList entries = dir.entryList(new QStringList(), QDir.Filter.Dirs, QDir.Filter.NoDotAndDotDot);
for(String file : entries){
    // check if file string is valid
}

Thanks, adding env QT_QUICK_CONTROLS_CONF to empty exists dir helps, log on startup

MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen

QDir dir = new QDir(":/"); crash app this the same error even if QT_QUICK_CONTROLS_CONF is specifed

App try to run

package org.example;

import io.qt.core.QCoreApplication;
import io.qt.core.QDir;
import io.qt.core.QSettings;
import io.qt.core.QStringList;
import io.qt.widgets.QApplication;
import io.qt.widgets.QMainWindow;

import static java.lang.System.exit;

public class QtApp {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        QSettings.setDefaultFormat(QSettings.Format.IniFormat);
        QCoreApplication.setOrganizationName("QtApp");
        QCoreApplication.setApplicationName("QtApp");
        QCoreApplication.setOrganizationDomain("example.org");
        QApplication.initialize(args);
        //// IF COMMENT
        QDir dir = new QDir(":/");
        QStringList entries = dir.entryList(new QStringList(), QDir.Filter.Dirs, QDir.Filter.NoDotAndDotDot);
        for(String file : entries){
            // check if file string is valid
            System.out.println(file);
        }
        //// THEN RUN
        QMainWindow mainWindow = new QMainWindow();
        mainWindow.show();
        exit(QApplication.exec());
    }
}
omix commented 3 months ago

Fantastic. Could you attach the hs_err_pid file from the QDir(":/") crash? Also did it print at least some of the entries or did it crash immediately? Could you also please try the same with QDir("classpath:/")?

wolfseifert commented 3 months ago

I ran QtApp now on Kubuntu 24.04 and got exactly the same error (crash) as you. Running QtApp with -Djava.library.path=~/qt/5.15.2/gcc_64/lib (i.e. the Qt-online-installed version) solved the issue (no crash).

long76 commented 3 months ago

I ran QtApp now on Kubuntu 24.04 and got exactly the same error (crash) as you. Running QtApp with -Djava.library.path=~/qt/5.15.2/gcc_64/lib (i.e. the Qt-online-installed version) solved the issue (no crash).

yes, i know, if use portable Qt version all works) but if system have qt already why i must use portable version?)

omix commented 3 months ago

Fantastic. Could you attach the hs_err_pid file from the QDir(":/") crash? Also did it print at least some of the entries or did it crash immediately? Could you also please try the same with QDir("classpath:/")?

It would help if you would reply to my questions above.

long76 commented 3 months ago

Fantastic. Could you attach the hs_err_pid file from the QDir(":/") crash? Also did it print at least some of the entries or did it crash immediately? Could you also please try the same with QDir("classpath:/")?

crash immediately on create QDir

Hello world!
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000070080d166ca1, pid=4112, tid=4113
#
# JRE version: OpenJDK Runtime Environment (11.0.23+9) (build 11.0.23+9-post-Ubuntu-1ubuntu1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.23+9-post-Ubuntu-1ubuntu1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libQt5Core.so.5.15.13+0x166ca1]  operator==(QString const&, QString const&)+0x11
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/user/QtApp/core.4112)
#
# An error report file with more information is saved as:
# /home/user/QtApp/hs_err_pid4112.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-lts
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

hs_err_pid4112.log

with classpath:/ crash too

Hello world!
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007df763b66ca1, pid=5599, tid=5600
#
# JRE version: OpenJDK Runtime Environment (11.0.23+9) (build 11.0.23+9-post-Ubuntu-1ubuntu1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.23+9-post-Ubuntu-1ubuntu1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libQt5Core.so.5.15.13+0x166ca1]  operator==(QString const&, QString const&)+0x11
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/user/QtApp/core.5599)
#
# An error report file with more information is saved as:
# /home/user/QtApp/hs_err_pid5599.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-lts
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

hs_err_pid5599.log

P.S. QT_QUICK_CONTROLS_CONF is set

omix commented 3 months ago

Yes, QT_QUICK_CONTROLS_CONF avoids QtQuick library from checking directory :/. :/ represents the entire Qt resource path including Java class path classpath:/ represents Java classpath only The error necessarily is in QtJambi because it crashes for classpath:/. I will need to setup a VM with Kubuntu and try to find the reason.

wolfseifert commented 3 months ago

I built now QtJambi (master) successfully from sources against Kubuntu 24.04 Qt libs. Using the generated jars QtApp runs without problems (also without online-installed-Qt). The build QTDIR for Kubuntu 24.04 looks like this:

qtdir$ ls -l
bin -> /usr/lib/x86_64-linux-gnu/qt5/bin
include -> /usr/include/x86_64-linux-gnu/qt5/
lib -> /usr/lib/x86_64-linux-gnu/
libexec -> /usr/lib/x86_64-linux-gnu/qt5/libexec/
mkspecs -> /usr/lib/x86_64-linux-gnu/qt5/mkspecs
plugins -> /usr/lib/x86_64-linux-gnu/qt5/plugins
qml -> /usr/lib/x86_64-linux-gnu/qt5/qml

Of course all needed Qt packages must be installed using the Kubuntu installer.

long76 commented 2 months ago

I built now QtJambi (master) successfully from sources against Kubuntu 24.04 Qt libs. Using the generated jars QtApp runs without problems (also without online-installed-Qt). The build QTDIR for Kubuntu 24.04 looks like this:

qtdir$ ls -l bin -> /usr/lib/x86_64-linux-gnu/qt5/bin include -> /usr/include/x86_64-linux-gnu/qt5/ lib -> /usr/lib/x86_64-linux-gnu/ libexec -> /usr/lib/x86_64-linux-gnu/qt5/libexec/ mkspecs -> /usr/lib/x86_64-linux-gnu/qt5/mkspecs plugins -> /usr/lib/x86_64-linux-gnu/qt5/plugins qml -> /usr/lib/x86_64-linux-gnu/qt5/qml Of course all needed Qt packages must be installed using the Kubuntu installer.

you can upload artifact in somewhere? i try it on old ubuntu if it will work then solution is just set build env to last ubuntu lts

P.S. maybe problem in kubuntu 22.04, we can wait release kubuntu 22.04.1 and maybe it will be fixed

wolfseifert commented 2 months ago

No, I deleted Kubuntu 24.04 already.

You have two options now:

  1. Build QtJambi from sources against Kubuntu 24.04 yourself and use the generated artifacts.
  2. Use the artifacts from maven central and use the "online-installed-Qt" at runtime.
long76 commented 2 weeks ago

Thank you very much! All works!