Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. App crashes when using jpegs
Forum Updated to NodeBB v4.3 + New Features

App crashes when using jpegs

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 4 Posters 892 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #1

    My application always crashes when using jpegs in release mode, no matter on which linux distro (I have tested ubuntu, manjaro and fedora). Even if I just use:

    QImage test("/home/creapermann/Downloads/pexels-photo-551628-907132679.jpg", "jpeg");
    

    It crashes in release mode, but it works just fine in debug mode though.

    sierdzioS 1 Reply Last reply
    0
    • C Creaperdown

      My application always crashes when using jpegs in release mode, no matter on which linux distro (I have tested ubuntu, manjaro and fedora). Even if I just use:

      QImage test("/home/creapermann/Downloads/pexels-photo-551628-907132679.jpg", "jpeg");
      

      It crashes in release mode, but it works just fine in debug mode though.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @Creaperdown try without the `"jpeg" argument:

      QImage test("/home/creapermann/Downloads/pexels-photo-551628-907132679.jpg");
      

      (Z(:^

      C 1 Reply Last reply
      0
      • sierdzioS sierdzio

        @Creaperdown try without the `"jpeg" argument:

        QImage test("/home/creapermann/Downloads/pexels-photo-551628-907132679.jpg");
        
        C Offline
        C Offline
        Creaperdown
        wrote on last edited by
        #3

        @sierdzio It still crashes

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Creaperdown
          wrote on last edited by
          #4

          Ah, I have just seen this message right before it crashesc81737cf-659a-4fda-8358-475b4a73e886-image.png

          sierdzioS 1 Reply Last reply
          0
          • C Creaperdown

            Ah, I have just seen this message right before it crashesc81737cf-659a-4fda-8358-475b4a73e886-image.png

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @Creaperdown your jpg library is too new, it seems. Install an older version or compile Qt with built-in jpg library.

            (Z(:^

            C 1 Reply Last reply
            1
            • sierdzioS sierdzio

              @Creaperdown your jpg library is too new, it seems. Install an older version or compile Qt with built-in jpg library.

              C Offline
              C Offline
              Creaperdown
              wrote on last edited by
              #6

              @sierdzio I get this error even on fresh installs when installing my application via flatpak or from the AUR. I can not recompile the Qt versions or downgrade the jpeg libraries on my clients' PCs.

              sierdzioS 1 Reply Last reply
              0
              • C Creaperdown

                @sierdzio I get this error even on fresh installs when installing my application via flatpak or from the AUR. I can not recompile the Qt versions or downgrade the jpeg libraries on my clients' PCs.

                sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                @Creaperdown oh so this is a flatpak? Then you absolutely can ship your own Qt with it, if I understand it well (which I don't; I've got more experience with AppImage).

                Anyway, I don't see another way to be honest. Except maybe if you shipped your own JPG lib and linked to it with rpath, but that it a hacky solution.

                (Z(:^

                C 2 Replies Last reply
                0
                • sierdzioS sierdzio

                  @Creaperdown oh so this is a flatpak? Then you absolutely can ship your own Qt with it, if I understand it well (which I don't; I've got more experience with AppImage).

                  Anyway, I don't see another way to be honest. Except maybe if you shipped your own JPG lib and linked to it with rpath, but that it a hacky solution.

                  C Offline
                  C Offline
                  Creaperdown
                  wrote on last edited by
                  #8

                  @sierdzio Its not just flatpak, we are distributing the application through multiple repositories, for example: flatpak, snap, the AUR, ... Non of these work with jpegs.

                  Also, the jpegs actually used in the application are downloaded from the internet, so I can not pre-download them.

                  1 Reply Last reply
                  0
                  • sierdzioS sierdzio

                    @Creaperdown oh so this is a flatpak? Then you absolutely can ship your own Qt with it, if I understand it well (which I don't; I've got more experience with AppImage).

                    Anyway, I don't see another way to be honest. Except maybe if you shipped your own JPG lib and linked to it with rpath, but that it a hacky solution.

                    C Offline
                    C Offline
                    Creaperdown
                    wrote on last edited by
                    #9

                    @sierdzio ok, I think I found something. Looking at the output that valgrind gives me, it seems like Qt uses the libjpeg version of a dependency of my project:

                    9392e854-5db5-4730-b763-d2496f0ed6d3-image.png

                    This would explain the library version mismatch. Do you have an idea on how I could tell Qt what library to use?

                    sierdzioS 1 Reply Last reply
                    0
                    • C Creaperdown

                      @sierdzio ok, I think I found something. Looking at the output that valgrind gives me, it seems like Qt uses the libjpeg version of a dependency of my project:

                      9392e854-5db5-4730-b763-d2496f0ed6d3-image.png

                      This would explain the library version mismatch. Do you have an idea on how I could tell Qt what library to use?

                      sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      @Creaperdown Point it to the right place with rpath or LD_LIRARY_PATH if you are using a launch script of some sort.

                      (Z(:^

                      C 1 Reply Last reply
                      0
                      • sierdzioS sierdzio

                        @Creaperdown Point it to the right place with rpath or LD_LIRARY_PATH if you are using a launch script of some sort.

                        C Offline
                        C Offline
                        Creaperdown
                        wrote on last edited by
                        #11

                        @sierdzio both the correct libjpeg and the libmupdf shared libraries are in the same folder, so setting LD_LIRARY_PATH to that folder doesn't fix it.

                        sierdzioS 1 Reply Last reply
                        0
                        • C Creaperdown

                          @sierdzio both the correct libjpeg and the libmupdf shared libraries are in the same folder, so setting LD_LIRARY_PATH to that folder doesn't fix it.

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          @Creaperdown rpath then. But the proper solution would be to sort out your dependencies so that all libs use only one version of the jpg library.

                          (Z(:^

                          C 1 Reply Last reply
                          0
                          • sierdzioS sierdzio

                            @Creaperdown rpath then. But the proper solution would be to sort out your dependencies so that all libs use only one version of the jpg library.

                            C Offline
                            C Offline
                            Creaperdown
                            wrote on last edited by
                            #13

                            @sierdzio well, a dependency of my project builds a specific libjpeg version itself, and I do not have any control over that. Qt needs a newer version but it seems to choose the libjpeg that is built by the library and not the one available on the system.

                            JonBJ 1 Reply Last reply
                            0
                            • C Creaperdown

                              @sierdzio well, a dependency of my project builds a specific libjpeg version itself, and I do not have any control over that. Qt needs a newer version but it seems to choose the libjpeg that is built by the library and not the one available on the system.

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #14

                              @Creaperdown
                              That choice ought to depend on some mixture of that library's location relative to Qt's libraries, LD_LIRARY_PATH and/or rpath.

                              You might get a clue where it is looking when by running your app under strace. I don't know if there is a better tool to diagnose this.

                              C 1 Reply Last reply
                              0
                              • JonBJ JonB

                                @Creaperdown
                                That choice ought to depend on some mixture of that library's location relative to Qt's libraries, LD_LIRARY_PATH and/or rpath.

                                You might get a clue where it is looking when by running your app under strace. I don't know if there is a better tool to diagnose this.

                                C Offline
                                C Offline
                                Creaperdown
                                wrote on last edited by
                                #15

                                @JonB This problem only occurs when trying to deploy my application using flatpak. Building it on my machine normally works just fine. I would prefer not to hard code an rpath into my application since I suppose that this will just lead to issues and LD_LIRARY_PATH didn't help me either. Also, I do not understand how strace could help me with my problem. I tried it non-the less but didn't manage to get any valuable information from it.

                                JoeCFDJ 1 Reply Last reply
                                0
                                • C Creaperdown

                                  @JonB This problem only occurs when trying to deploy my application using flatpak. Building it on my machine normally works just fine. I would prefer not to hard code an rpath into my application since I suppose that this will just lead to issues and LD_LIRARY_PATH didn't help me either. Also, I do not understand how strace could help me with my problem. I tried it non-the less but didn't manage to get any valuable information from it.

                                  JoeCFDJ Offline
                                  JoeCFDJ Offline
                                  JoeCFD
                                  wrote on last edited by JoeCFD
                                  #16

                                  @Creaperdown you may have to wrap the right lib with or statically link it to your app in this case.

                                  rpath will lead your app to look for the linked libs first in a specified dir if your know exactly where the libs are located.

                                  LD_LIRARY_PATH will not work if your app is launched when os starts. But you can start your app as:
                                  env LD_LIRARY_PATH=... your app.

                                  ldd your app
                                  to make sure your app is linked to the right lib.

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved