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. Crash when run in Release mode?
Forum Updated to NodeBB v4.3 + New Features

Crash when run in Release mode?

Scheduled Pinned Locked Moved Solved General and Desktop
36 Posts 7 Posters 9.1k 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.
  • J.HilkJ J.Hilk

    @Mucip said in Crash when run in Release mode?:

    VS 2019

    MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?

    MucipM Offline
    MucipM Offline
    Mucip
    wrote on last edited by Mucip
    #13

    @J-Hilk ,
    It's very strange!

    When I build in RELEASE mode I got crash and can not run under Qt Creator!
    But when I run windployqt and create executable of the project than it works without any problem!
    I can connect to PostgreSQL and use LimeReport and QtZint. I mean all the DLL's work without any problem.

    Project can be compiled in the release directory but can not be run via Qt... :(

    Well, Where should be the problem?! I guess Qt must update something according to actual version of VS2019... :(

    Regards,
    Mucip:)

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #14

      I encounter this every so often. The cause is usually what JSulm suggested -- a missing library. If your project file isn't too big, I'd be interested in looking at it.

      One thing I do when I encounter this, is go to the release directory and try to run the .exe directly (outside of Creator). You'll likely get an error message telling you what's wrong (eg, which library is missing).

      MucipM 1 Reply Last reply
      1
      • mzimmersM mzimmers

        I encounter this every so often. The cause is usually what JSulm suggested -- a missing library. If your project file isn't too big, I'd be interested in looking at it.

        One thing I do when I encounter this, is go to the release directory and try to run the .exe directly (outside of Creator). You'll likely get an error message telling you what's wrong (eg, which library is missing).

        MucipM Offline
        MucipM Offline
        Mucip
        wrote on last edited by
        #15

        Hi @mzimmers ,
        If some DLL is misssing, It shouldn't be compiled. But QtCretator can compile the project.
        Am I rigt?
        By the way it shouldn't run in DEBUG mode either.

        P.S. Thanks a lot for your kind interest. Project is liitle bit long. :)

        Regards,
        Mucip:)

        mzimmersM 1 Reply Last reply
        0
        • MucipM Mucip

          Hi @mzimmers ,
          If some DLL is misssing, It shouldn't be compiled. But QtCretator can compile the project.
          Am I rigt?
          By the way it shouldn't run in DEBUG mode either.

          P.S. Thanks a lot for your kind interest. Project is liitle bit long. :)

          Regards,
          Mucip:)

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #16

          @Mucip it's not that the .dll is missing - it's just not accessible to the release image. (I'm probably not the best one to explain this.) This would be a useful experiment: go into your build directory for your debug build. Find the executable and try to run it (this should work). Then go into the build directory for your release build, and do the same thing. I'm expecting you'll get an error message from the binary; if so, please post it.

          MucipM 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @Mucip it's not that the .dll is missing - it's just not accessible to the release image. (I'm probably not the best one to explain this.) This would be a useful experiment: go into your build directory for your debug build. Find the executable and try to run it (this should work). Then go into the build directory for your release build, and do the same thing. I'm expecting you'll get an error message from the binary; if so, please post it.

            MucipM Offline
            MucipM Offline
            Mucip
            wrote on last edited by
            #17

            Dear @mzimmers ,
            Well, I tested in DEBUG directory. Clicked MriERP.exe file. Ofcourse it says LimeReport, QtZint and QtCore and etc files are missing. When I copy these files in the debug directory I can run the program in DEBUG folder.

            When I try same thing in RELEASE folder, error messages are the same. Same files are missing. I copied LimeReport, QtZint and Qt's DLL files than MriERP.exe files worked normally too.

            A quick question: If some DLL are missing It shouldn't compile the project, should it?...

            Regards,
            Mucip:)

            jsulmJ 1 Reply Last reply
            0
            • mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #18

              Thanks for running those tests. I misspoke when I said the debug version should run; I forgot that the libraries aren't available outside of Creator. Since you probably don't intend to run your debug version outside of Qt, that's not important.

              To fix your release build, you need to do (at least) two things:

              1. tell Creator which files (the ones you mentioned)you want to copy to your build directory. This can be done like this (in your .pro file):
              my_release.files = "libexpat.lib"
              my_release.path = $$OUT_PWD
              
              INSTALLS += my_release
              
              1. in your build settings, you need to add a step after make, to do a make install. This will copy the files for you.
                build.PNG

              This should not work, but might not be exactly what you want. The user can run your program out of the release directory, but if he moves the executable, it won't run. If this presents a problem, let me know, and I'll tell you how to fix this (but it will take you some time to do so).

              MucipM 1 Reply Last reply
              0
              • mzimmersM mzimmers

                Thanks for running those tests. I misspoke when I said the debug version should run; I forgot that the libraries aren't available outside of Creator. Since you probably don't intend to run your debug version outside of Qt, that's not important.

                To fix your release build, you need to do (at least) two things:

                1. tell Creator which files (the ones you mentioned)you want to copy to your build directory. This can be done like this (in your .pro file):
                my_release.files = "libexpat.lib"
                my_release.path = $$OUT_PWD
                
                INSTALLS += my_release
                
                1. in your build settings, you need to add a step after make, to do a make install. This will copy the files for you.
                  build.PNG

                This should not work, but might not be exactly what you want. The user can run your program out of the release directory, but if he moves the executable, it won't run. If this presents a problem, let me know, and I'll tell you how to fix this (but it will take you some time to do so).

                MucipM Offline
                MucipM Offline
                Mucip
                wrote on last edited by
                #19

                @mzimmers said in Crash when run in Release mode?:

                my_release.files = "libexpat.lib"
                my_release.path = $$OUT_PWD

                INSTALLS += my_release

                Hi,
                How can I put two dll files in the my_release.files? Should I add path also?

                By the way, what is changed after Qt 5.13.2? I didn't make this modification before? Why it happend in Qt 5.14.2?

                By the way if I copy LimeReport.dll and QtZint.dll to RELEASE folder, I can run the program in Qt Creator. This mean the problem was LimeReport.dll and QtZint.dll files missing!

                But why? It was working in Qt5.13.2 before???

                Regards,
                Mucip:)

                mzimmersM 1 Reply Last reply
                0
                • MucipM Mucip

                  @mzimmers said in Crash when run in Release mode?:

                  my_release.files = "libexpat.lib"
                  my_release.path = $$OUT_PWD

                  INSTALLS += my_release

                  Hi,
                  How can I put two dll files in the my_release.files? Should I add path also?

                  By the way, what is changed after Qt 5.13.2? I didn't make this modification before? Why it happend in Qt 5.14.2?

                  By the way if I copy LimeReport.dll and QtZint.dll to RELEASE folder, I can run the program in Qt Creator. This mean the problem was LimeReport.dll and QtZint.dll files missing!

                  But why? It was working in Qt5.13.2 before???

                  Regards,
                  Mucip:)

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #20

                  @Mucip

                  target.path = $$OUT_PWD
                  target.files = "LimeReport.dll" "QtZint.dll"
                  INSTALLS += target
                  

                  This link OUT_PWD will explain how it works.

                  Just make sure to add the install step to your build. Adding this stuff to the .pro files is just specifying what the install will work on.

                  I can't answer why it worked in 5.13.

                  MucipM 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    @Mucip

                    target.path = $$OUT_PWD
                    target.files = "LimeReport.dll" "QtZint.dll"
                    INSTALLS += target
                    

                    This link OUT_PWD will explain how it works.

                    Just make sure to add the install step to your build. Adding this stuff to the .pro files is just specifying what the install will work on.

                    I can't answer why it worked in 5.13.

                    MucipM Offline
                    MucipM Offline
                    Mucip
                    wrote on last edited by
                    #21

                    @mzimmers said in Crash when run in Release mode?:

                    target.path = $$OUT_PWD
                    target.files = "LimeReport.dll" "QtZint.dll"
                    INSTALLS += target

                    Hi @mzimmers,
                    I copied above lines in my pro file and add make step to build like below picture. But still same crash?!
                    I affraid I could not copy dll's to destination folder. :(
                    Where am I wrong?...

                    b37518d7-c68b-4028-b6da-38022be3400f-resim.png

                    Regards,
                    Mucip:)

                    1 Reply Last reply
                    0
                    • mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #22

                      The first thing I'd check is, did the files copy over to the release directory?

                      I was making an assumption that you had those files available in your source directory; if not, then you need to furnish the pathnames in the .pro file.

                      MucipM 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        The first thing I'd check is, did the files copy over to the release directory?

                        I was making an assumption that you had those files available in your source directory; if not, then you need to furnish the pathnames in the .pro file.

                        MucipM Offline
                        MucipM Offline
                        Mucip
                        wrote on last edited by
                        #23

                        @mzimmers ,
                        No. Files did not copied in the folder. But when I add below string than everything solved. I can run program in release mode too.

                        target.path = $$OUT_PWD
                        target.files = "D:/Belgeler/Qt/LimeReport/win64/release/lib/LimeReport.dll" "D:/Belgeler/Qt/LimeReport/win64/release/lib/QtZint.dll"
                        INSTALLS += target
                        

                        Thanks...

                        Regards,
                        Mucip:)

                        1 Reply Last reply
                        0
                        • mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #24

                          Excellent. If you like, you can create a variable in your .pro file for your directory that contains the libraries, and use that variable when specifying the target.files. Won't change the behavior; it's just a bit cleaner.

                          If you think this is resolved, please mark the topic as solves using the topic tools available in your first post in this thread.

                          MucipM 1 Reply Last reply
                          0
                          • mzimmersM mzimmers

                            Excellent. If you like, you can create a variable in your .pro file for your directory that contains the libraries, and use that variable when specifying the target.files. Won't change the behavior; it's just a bit cleaner.

                            If you think this is resolved, please mark the topic as solves using the topic tools available in your first post in this thread.

                            MucipM Offline
                            MucipM Offline
                            Mucip
                            wrote on last edited by
                            #25

                            @mzimmers
                            I already marked your post as answer... :)

                            By the way there is still one question more: What is the difference between 5.13.2 and 5.14.2?... :)

                            Regards,
                            Mucip:)

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #26

                              @Mucip That is something that you can find out in the release notes as well as in the git history.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              mzimmersM 1 Reply Last reply
                              1
                              • SGaistS SGaist

                                @Mucip That is something that you can find out in the release notes as well as in the git history.

                                mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #27

                                @SGaist said in Crash when run in Release mode?:

                                @Mucip That is something that you can find out in the release notes as well as in the git history.

                                But whatever the differences are, I seriously doubt they have anything to do with the problem you encountered. More likely, when you updated, you also created a new .user file that wiped out your build settings.

                                MucipM 2 Replies Last reply
                                1
                                • mzimmersM mzimmers

                                  @SGaist said in Crash when run in Release mode?:

                                  @Mucip That is something that you can find out in the release notes as well as in the git history.

                                  But whatever the differences are, I seriously doubt they have anything to do with the problem you encountered. More likely, when you updated, you also created a new .user file that wiped out your build settings.

                                  MucipM Offline
                                  MucipM Offline
                                  Mucip
                                  wrote on last edited by
                                  #28

                                  Hi @mzimmers ,
                                  In any case, I learned new and very usefull things. Thanks.

                                  Regards,
                                  Mucip:)

                                  1 Reply Last reply
                                  0
                                  • mzimmersM mzimmers

                                    @SGaist said in Crash when run in Release mode?:

                                    @Mucip That is something that you can find out in the release notes as well as in the git history.

                                    But whatever the differences are, I seriously doubt they have anything to do with the problem you encountered. More likely, when you updated, you also created a new .user file that wiped out your build settings.

                                    MucipM Offline
                                    MucipM Offline
                                    Mucip
                                    wrote on last edited by Mucip
                                    #29

                                    Hi @mzimmers ,
                                    Let's suppose there is report folder in the main project directory and some xml files in this report directory. I want to copy report folder and contents to the target directory too. Above information I can copy files to target but what about create folder and copy files to target directory on compile time?

                                    Regards,
                                    Mucip:)

                                    mzimmersM 1 Reply Last reply
                                    0
                                    • MucipM Mucip

                                      Hi @mzimmers ,
                                      Let's suppose there is report folder in the main project directory and some xml files in this report directory. I want to copy report folder and contents to the target directory too. Above information I can copy files to target but what about create folder and copy files to target directory on compile time?

                                      Regards,
                                      Mucip:)

                                      mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by
                                      #30

                                      @Mucip yes, you can do that. The details can be found here.

                                      MucipM 1 Reply Last reply
                                      0
                                      • mzimmersM mzimmers

                                        @Mucip yes, you can do that. The details can be found here.

                                        MucipM Offline
                                        MucipM Offline
                                        Mucip
                                        wrote on last edited by
                                        #31

                                        @mzimmers ,
                                        I got it thanks.
                                        Maybe someone has same problem. I solved like below.
                                        The code create "rapor" folder and copies contents to target build directory.

                                        target.path = $$OUT_PWD/release
                                        target.files = "D:/Belgeler/Qt/LimeReport/win64/release/lib/LimeReport.dll" "D:/Belgeler/Qt/LimeReport/win64/release/lib/QtZint.dll" $$PWD/rapor
                                        INSTALLS += target
                                        

                                        Regards,
                                        Mucip:)

                                        1 Reply Last reply
                                        1
                                        • mzimmersM Offline
                                          mzimmersM Offline
                                          mzimmers
                                          wrote on last edited by
                                          #32

                                          Looks good. Thanks for posting the solution.

                                          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