Run in release crash
-
Hello 'verybody !
I got a very common error while running in Release mod but, in spite of all the answers i found on it, i can't find a solution or just do not understand them.
My Debug works perfectly (almost... except two exception at the same spot where the release crashes that i couldn't find where they came from but they do not stop the program : "Exception at 0x7fff... execution cannot be continued" --> cannot find a clue in this message as the very beginner that i am).
Then, while i run in Release, after triggering a comboBox event, it crashes. Here is the .qml where it seems to crash :
onActivated: { //Change index of the model function of the comboBox index reader2.currentIndexReaderProvider = comboBoxReaderProvider.currentIndex reader2.buildReaderList(); //Change the model of ComboBox ReaderUnit function of the ReaderProvider comboBoxReaderUnit.model = reader2.readerStringList }
Maybe at buildReaderList where i used my library for the first time... I tried to put breakpoints in my code at different moment but it seems to go to the crash whether they are passed or not.
I tried to run the .exe in the Release and Debug folder created :
Debug doesn't do anything (i think that's kinda normal right ?)
Release shows the following messages :
--> The procedure entry point??AQStringRef@@QEBA?AVQChar@@H@Z could not be located in the dynamic link library C:\Users\Me\Documents\build-MRCFinal-Desktop_Qt_5_9_2_MSVC2013_64bit2-Release\release\Qt5Qml.dll
--> The procedure entry point ??0QDateTime@@QEAA@$$QEAV0@@Z could not [... blablabla ...] release\Qt5Network.dllThose two erros are really common but i can't find any good solutions.
I checked that Qt5Qml.dll and Qt5Network.dll come from Qt\Qt5.9.2\bin.
Just to be sure, i also tried with the 5.10 version that i downloaded before.I tried to delete the Qt5Qmld.dll (which seems to be for the Debug version)
i tried to debug it with Visual studio while Release run crashed and i had this exception :
Unhandled exception at 0x00007FFEE90FAC62 (msvcr120d.dll) in MRCFinal.exe: 0xC0000005: Access violation reading location 0x0000000000000005.static _Elem *__CLRCALL_OR_CDECL copy(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First2, _First2 + _Count) to [_First1, ...) return (_Count == 0 ? _First1 : (_Elem *)_CSTD memcpy(_First1, _First2, _Count)); //It happenned on this line }
<error reading characters of string.> on the _First2
couldnt understand it and didn't find that much information online.
I also tried to use Dependency Walker wich was advised a lot on multiple forums but i don't get how to use it and i kinda get errors everywhere whatever i open with it.
Some people thought it was linked with the .pro and it wouldn't surprised me since the two exceptions i told you about above seems to be related to the crash and started to appears when i first tried to use my library.
Also, here is my .pro (could be messy, even though i tried to clean it, that's my first program on Qt so i did a lot of experiments to learn and explore that massive amount of possibilities)
QT += quick CONFIG += c++11 QT += widgets QT += qml QT += core # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += main.cpp \ comboboxmodel.cpp \ cardinformation.cpp \ definition.cpp \ reader.cpp \ readwrite.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target HEADERS += \ comboboxmodel.h \ cardinformation.h \ header.h \ reader.h \ readwrite.h win32:CONFIG(release, debug|release): LIBS += -L$$PWD/packages/lib/x64/release/ -lliblogicalaccess -lmifarecards else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/packages/lib/x64/debug/ -lliblogicalaccess -lmifarecards INCLUDEPATH += $$PWD/packages/include DEPENDPATH += $$PWD/packages/include LIBS += -L$$PWD/packages/lib/x64/Debug/ -lliblogicalaccess -lmifarecards LIBS += -L$$PWD/packages/lib/x64/Release/ -lliblogicalaccess -lmifarecards
Thankfull for all the answers/propositions/advises from beginner/advance/godlike programmers and staying on call at every moment for any details
-
@Sillimon said in Run in release crash:
Release shows the following messages :
--> The procedure entry point??AQStringRef@@QEBA?AVQChar@@H@Z could not be located in the dynamic link library C:\Users\Me\Documents\build-MRCFinal-Desktop_Qt_5_9_2_MSVC2013_64bit2-Release\release\Qt5Qml.dll
--> The procedure entry point ??0QDateTime@@QEAA@$$QEAV0@@Z could not [... blablabla ...] release\Qt5Network.dll
Those two erros are really common but i can't find any good solutions.you are missing some dlls (at least Qt5Core) -> use the windeployqt tool to make sure the correct dlls are copied.
-
That's really usefull ! Allows to clean everything and just import what is needed !
So i did and now, the .exe in release is as the debug build .exe --> it runs but doesn't do anything... guess it's better than dependencies errors =)
I thought that it would work so i followed a deployment tutorial online (yeah... it's my first deployment and i don't know anything about it ! I just remember my first programs when i naively thought that exporting all the project would work on another PC)
In the tutorial, they advised to add a custom process step at the run so it would run windeployqt before each run (if i understood correctly)
Got a little question about that : is that process not removing the external libraries after each run ? Or is it just adding missing Qt dll and not removing anything anyway ?
Because after running it while opening the release folder, it seems that files are removed and some others (or probably the same) are added/generated.Then i tried two different things :
FIRST ONE, i followed the tutorial and i created a folder "Deployment" as a C: child.
I pasted into it the release .exe and others dll from Qt5.9.2 (bin/plugins/qml folders)
I then renamed the Qt Folder into another name so i can run the .exe inside deployment.It did run perfectly until that moment when a messageBox appears to tell me the program crashed (just as before, when i had an exception in Debug build).
I tried debugging with VS and the exception changed.
The page displays : "symbol file not loaded" - Symbol load information : "Binary was not built with debug information"
and the exception says :
Unhandled exception at 0x00007FF7C0AB45B3 in MRCFinal.exe: 0xC0000005: Access violation reading location 0x0000000000000000.I'm right now searching for a nullptr or something like that. It might be something else but forums mainly turns around a use of a nullptr and i'm playing a lot with them in my code.
i'm also triggered by that "built with debug information" as long as i'm sure that i took the good .exe in the release folder...
meantime, can someone explain me what a symbol is and, eventually, where and what it's use for ?
I also tried a SECOND THING when i saw it didn't work.
I openned the project in QtCreator and tried to run it in release now that i've done the windeployqt.exeFirst, i'd like to be sure of something. Qt Creator provides a "run" feature and a "start debugging" feature.
I read somewhere that debug build and debugger ain't related.
Wich means that there is a run with and without debugger for debug build AND for release build right ?
What i learnt about it was that "it does not attach the debugger so it doesn't hit breakpoints, doesn't show debug messages, etc..."
Isn't that exactly what a release build is supposed to do ?
It looks like whatever you take between release or debug build, using "run" or "start debugging" feature change the build mode.Also, i tried both and here is the result :
"Run" feature
-->got a C:\Users...\path\of\my\release\folder\release.QQmlApplicationEngine failed to load componentAnd a bunch of errors i had not before using windeployqt on my .qml import lines : "module QtQuick is not installed"/"module QtQuick.Window is not installed"/"module QtQml.Models is not installed"/etc etc...Then it says that my .exe exited with code -1Successfully found the qml folder in C:\Qt ;D now it works, which leads back to the question above : "Is windeployqt.exe removing any file from release folder ?"
"Start debugging" feature
--> program works fine until that fatal moment i told about above...static _Elem *__CLRCALL_OR_CDECL copy(_Elem *_First1, const _Elem *_First2, size_t _Count) { // copy [_First2, _First2 + _Count) to [_First1, ...) return (_Count == 0 ? _First1 //Exception on the line just below : (_Elem *)_CSTD memcpy(_First1, _First2, _Count)); }
I'm sorry to ask that much and i'm not expecting a full answers but this is the questions i'm asking myself or don't understand clearly so i'm open to everything you could teach me about it.
-
@Sillimon said in Run in release crash:
can someone explain me what a symbol is and, eventually, where and what it's use for ?
a symbol is basically what your application/library consists of. (Variables, classes, methods, ...)
If the symbol information is missing you wont be able to do any meaningful debugging.Wich means that there is a run with and without debugger for debug build AND for release build right ?
yes. the difference is just in once case the debugger is attached to the started application, in the other not.
'm right now searching for a nullptr or something like that. It might be something else but forums mainly turns around a use of a nullptr and i'm playing a lot with them in my code.
not necessarily a null pointer, but also an uninitialized / dangling (already deleted pointer).
But in the end we all can just guess and give tips without a code and a stacktrace of the moment the crash occured. (best in debug mode)
-
After few researches and some help from internal, it appears that my links to libraries ain't clean enough wich leads to those random behaviours.
So i'm working on making it cleaner for x32/x64 debug and release.
Thanks a lot for your help ! You made my mind way sharper !