Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a Rust project with a C++ Qt front-end. I compiled the Linux version on Mint 19 with a static version of Qt . I was informed ( https://github.com/spieglt/Cloaker/issues/2 ) that the file dialog crashes when selecting Computer in the left sidebar or typing / as a path. I found that the file dialog I see when using the static version of Qt ( https://imgur.com/a/4grBpVY ) is different from the one I see when compiling with the standard, dynamically linked version ( https://imgur.com/a/lzhOnkA ) made by the Qt installer.

The output on the user's machine was:

./Cloaker.run 
QApplication: invalid style override passed, ignoring it.
    Available styles: Windows, Fusion
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Segmentation fault (core dumped)

I tried compiling with a static version of Qt on Ubuntu. When I do that, the program doesn't crash when the broken file dialog appears, but Computer is the only item in the side and top bars not greyed out, and the output is

QPixmap::scaleWidth: Pixmap is a null pixmap QPixmap::scaleWidth: Pixmap is a null pixmap QPixmap::scaleWidth: Pixmap is a null pixmap QPixmap::scaleWidth: Pixmap is a null pixmap Case insensitive sorting unsupported in the posix collation implementation Numeric mode unsupported in the posix collation implementation QPixmap::scaleWidth: Pixmap is a null pixmap QPixmap::scaleWidth: Pixmap is a null pixmap QPixmap::scaleWidth: Pixmap is a null pixmap Case insensitive sorting unsupported in the posix collation implementation Numeric mode unsupported in the posix collation implementation Case insensitive sorting unsupported in the posix collation implementation Numeric mode unsupported in the posix collation implementation Empty filename passed to function QPainter::begin: Paint device returned engine == 0, type: 3 QPainter::setCompositionMode: Painter not active QPainter::end: Painter not active, aborted Case insensitive sorting unsupported in the posix collation implementation Numeric mode unsupported in the posix collation implementation

Original Mint configure command: ~/Qt/5.12.3/Src/configure -prefix ~/qt-static/5.12.3 -static -release -opensource -confirm-license -skip multimedia -no-compile-examples -nomake examples -no-openssl -no-libpng -skip wayland -qt-xcb

Ubuntu configure command: ~/Qt/5.13.0/Src/configure -static -release -prefix ~/qt-static/install -opensource -confirm-license -no-compile-examples -nomake examples -no-openssl -no-libpng -fontconfig

File dialog code:

    if (mode == Encrypt) { // encrypt, append extension
        inFile += QString::fromUtf8(FILE_EXTENSION);
        return QFileDialog::getSaveFileName(nullptr, "Save encrypted file", inFile, "", nullptr, QFileDialog::DontConfirmOverwrite);
    } else { // decrypt, chop off extension if there, otherwise prepend decrypted.
        if (inFile.endsWith(FILE_EXTENSION, Qt::CaseInsensitive)) {
            inFile = inFile.left(inFile.length() - strlen(FILE_EXTENSION));
        } else {
            inFile += QString::fromUtf8("_decrypted");
        // save as dialog, return path
        return QFileDialog::getSaveFileName(nullptr, "Save decrypted file", inFile, "", nullptr, QFileDialog::DontConfirmOverwrite);

I would like to, if possible, get the normal GNOME file dialog when linking Qt statically. If this isn't possible, will AppImage have the same problem?

Turns out I had just built the static version of Qt incorrectly. To build a static Qt with working file dialogs (Qt Widgets, QFileDialog-style; not GTK-style) on Mint:

$ mkdir ~/qt-static && cd ~/qt-static
$ mkdir build install; cd build
$ ~/Qt/5.12.3/Src/configure -prefix ~/qt-static/install -static -release -opensource -confirm-license -skip multimedia -skip webengine -skip wayland -no-compile-examples -nomake examples -no-openssl -ico -gtk -gif -qt-xcb
$ make -j8

Ubuntu is the same except without -qt-xcb and with -fontconfig.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.