Results 1 to 13 of 13

Thread: A difference between debug build with gcc and vc++

  1. #1
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default A difference between debug build with gcc and vc++

    I'm building using both gcc and vc++.
    When building formextractor example in debug mode gcc executable is 1 114 050 bytes and vc++ one is 75 776 bytes. When running, gcc executable runs ok but vc++ one gives error about not being able to find msvcr90d.dll file. It looks like gcc links with this statically whereas vc++ links dynamically.

    How can I configure both builds in creator to have the same behavior in respect to linking to run-time libraries?

  2. #2
    Join Date
    Jul 2009
    Posts
    13
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: A difference between debug build with gcc and vc++

    If your static libraries are not kept in the same directory as your dynamic libraries, modify your project file LIBS variable with -L and -l

    win32 {
    LIBS += -LC:\path\to\lib\dir -llibname
    } else {
    LIBS += -L/path/to/lib/dir -llibname
    }

  3. #3
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A difference between debug build with gcc and vc++

    I think it has nothing to do with neither -L nor -l parameter. If it was something wrong with these two parameters then I couldn't have compiled project in the first place. Don't you think?

    Quote Originally Posted by tjm View Post
    (...)modify your project file LIBS variable with -L and -l
    Can I do it from within creator?
    Last edited by piotr.dobrogost; 19th July 2009 at 18:34.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A difference between debug build with gcc and vc++

    Can you show us some of the compiler commands being ran? Especially the linking part (but one example of object compilation is also needed).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A difference between debug build with gcc and vc++

    Quote Originally Posted by wysota View Post
    Can you show us some of the compiler commands being ran? Especially the linking part (but one example of object compilation is also needed).
    Qt Code:
    1. Running build steps for project formextractor...
    2. Configuration unchanged, skipping QMake step.
    3. Starting: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/BIN/nmake.exe
    4. "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" -f Makefile.Debug
    5. c:\Qt\4.5.2-vc\bin\uic.exe ..\formextractor.ui -o ui_formextractor.h
    6. C:\Qt\4.5.2-vc\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.5.2-vc\include\QtCore" -I"c:\Qt\4.5.2-vc\include\QtGui" -I"c:\Qt\4.5.2-vc\include\QtWebKit" -I"c:\Qt\4.5.2-vc\include" -I"c:\Qt\4.5.2-vc\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-vc\mkspecs\win32-msvc2008" -D_MSC_VER=1500 -DWIN32 ..\formextractor.h -o debug\moc_formextractor.cpp
    7.  
    8. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    9. Copyright (C) Microsoft Corporation. All rights reserved.
    10.  
    11.  
    12. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    13. Copyright (C) Microsoft Corporation. All rights reserved.
    14.  
    15. C:\Qt\4.5.2-vc\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.5.2-vc\include\QtCore" -I"c:\Qt\4.5.2-vc\include\QtGui" -I"c:\Qt\4.5.2-vc\include\QtWebKit" -I"c:\Qt\4.5.2-vc\include" -I"c:\Qt\4.5.2-vc\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-vc\mkspecs\win32-msvc2008" -D_MSC_VER=1500 -DWIN32 ..\mainwindow.h -o debug\moc_mainwindow.cpp
    16. c:\Qt\4.5.2-vc\bin\rcc.exe -name formextractor ..\formextractor.qrc -o debug\qrc_formextractor.cpp
    17. cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.5.2-vc\include\QtCore" -I"c:\Qt\4.5.2-vc\include\QtGui" -I"c:\Qt\4.5.2-vc\include\QtWebKit" -I"c:\Qt\4.5.2-vc\include" -I"c:\Qt\4.5.2-vc\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-vc\mkspecs\win32-msvc2008" -Fodebug\ @.\nm6F60.tmp
    18. main.cpp
    19. formextractor.cpp
    20. mainwindow.cpp
    21. Generating Code...
    22. cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.5.2-vc\include\QtCore" -I"c:\Qt\4.5.2-vc\include\QtGui" -I"c:\Qt\4.5.2-vc\include\QtWebKit" -I"c:\Qt\4.5.2-vc\include" -I"c:\Qt\4.5.2-vc\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-vc\mkspecs\win32-msvc2008" -Fodebug\ @.\nm85A9.tmp
    23. moc_formextractor.cpp
    24. moc_mainwindow.cpp
    25. qrc_formextractor.cpp
    26. Generating Code...
    27. link /LIBPATH:"c:\Qt\4.5.2-vc\lib" /NOLOGO /DEBUG /MANIFEST /MANIFESTFILE:"debug\formExtractor.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:debug\formExtractor.exe @.\nm91BF.tmp
    28. mt.exe -nologo -manifest "debug\formExtractor.intermediate.manifest" -outputresource:debug\formExtractor.exe;1
    29. 'mt.exe' is not recognized as an internal or external command,
    30. operable program or batch file.
    31. NMAKE : fatal error U1077: 'mt.exe' : return code '0x1'
    32. Stop.
    33. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
    34. Stop.
    35. Exited with code 2.
    36. Error while building project formextractor
    37. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    That's strange but when I hit a build button for the second time I don't get above error and the build succeeds...

    Qt Code:
    1. Running build steps for project formextractor...
    2. Configuration unchanged, skipping QMake step.
    3. Starting: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/BIN/nmake.exe
    4. "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" -f Makefile.Debug
    5.  
    6. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    7. Copyright (C) Microsoft Corporation. All rights reserved.
    8.  
    9.  
    10. Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
    11. Copyright (C) Microsoft Corporation. All rights reserved.
    12.  
    13. Exited with code 0.
    To copy to clipboard, switch view to plain text mode 

    I think my problem is due to this error with mt.exe which is used to embed information about used libraries from manifest file (which is indeed generated as you can see in compiler's output) into the executable...

    When I'm inspecting the executable with Dependency Walker I see that Qt uses other version of msvcr90d.dll than the one in the manifest.
    Why during compilation of qt itself a different version of crt library was linked than the one that gets linked during compilation of an example in creator?

    The most strange thing is that both versions of these dlls are present in the c:\windows\winsxs folder...

    Any ideas?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A difference between debug build with gcc and vc++

    I think you should direct those questions to Microsoft, not to us

    I can only confirm the above built is dynamic. If you show us the respective lines from gcc, I'll be able to say what causes the size difference.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A difference between debug build with gcc and vc++

    Output of gcc as requested.

    Qt Code:
    1. Running build steps for project formextractor...
    2. Starting: C:/qt/4.5.2-gcc4/bin/qmake.exe D:/projects/qt-test/formextractor.pro -spec C:/Qt/4.5.2-gcc4/mkspecs/win32-g++ -r
    3. Exited with code 0.
    4. Starting: C:/mingw/4.4.0/bin/mingw32-make.exe -w
    5. mingw32-make: Entering directory `D:/projects/qt-test/gcc'
    6. C:/mingw/4.4.0/bin/mingw32-make -f Makefile.Debug
    7. mingw32-make[1]: Entering directory `D:/projects/qt-test/gcc'
    8. c:\Qt\4.5.2-gcc4\bin\uic.exe ..\formextractor.ui -o ui_formextractor.h
    9. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\main.o ..\main.cpp
    10. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\formextractor.o ..\formextractor.cpp
    11. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\mainwindow.o ..\mainwindow.cpp
    12. C:/Qt/4.5.2-gcc4/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\formextractor.h -o debug\moc_formextractor.cpp
    13. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\moc_formextractor.o debug\moc_formextractor.cpp
    14. C:/Qt/4.5.2-gcc4/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\mainwindow.h -o debug\moc_mainwindow.cpp
    15. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp
    16. c:\Qt\4.5.2-gcc4\bin\rcc.exe -name formextractor ..\formextractor.qrc -o debug\qrc_formextractor.cpp
    17. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.5.2-gcc4\include\QtCore" -I"c:\Qt\4.5.2-gcc4\include\QtGui" -I"c:\Qt\4.5.2-gcc4\include\QtWebKit" -I"c:\Qt\4.5.2-gcc4\include" -I"c:\Qt\4.5.2-gcc4\include\ActiveQt" -I"debug" -I"." -I"..\..\qt-test" -I"." -I"c:\Qt\4.5.2-gcc4\mkspecs\win32-g++" -o debug\qrc_formextractor.o debug\qrc_formextractor.cpp
    18. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\formExtractor.exe debug/main.o debug/formextractor.o debug/mainwindow.o debug/moc_formextractor.o debug/moc_mainwindow.o debug/qrc_formextractor.o -L"c:\Qt\4.5.2-gcc4\lib" -lmingw32 -lqtmaind -lQtWebKitd4 -lQtGuid4 -lQtCored4
    19. mingw32-make[1]: Leaving directory `D:/projects/qt-test/gcc'
    20. mingw32-make: Leaving directory `D:/projects/qt-test/gcc'
    21. Exited with code 0.
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A difference between debug build with gcc and vc++

    It's also dynamic. It's built in debug mode meaning that you have lots of symbol definitions included which bloats the code. The VC build was probably a release build (despite being built into debug directory), there is no chance a debug mode application that actually does something useful can have 75kB.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: A difference between debug build with gcc and vc++

    Quote Originally Posted by piotr.dobrogost View Post
    I'm building using both gcc and vc++.
    When building formextractor example in debug mode gcc executable is 1 114 050 bytes and vc++ one is 75 776 bytes. When running, gcc executable runs ok but vc++ one gives error about not being able to find msvcr90d.dll file. It looks like gcc links with this statically whereas vc++ links dynamically.

    How can I configure both builds in creator to have the same behavior in respect to linking to run-time libraries?
    Hi,

    Possibly it is not related to libraries. By default, vc++ does NOT include debug info in the executable but in an external <appname>.pdb file. This probably accounts for (the major part of) the difference in size.

    The error about msvcr90.dll is probably another matter; I may be wrong, but I don't think that gcc needs this library at all; that's why it does not complain. On the other hand, vc++ does need it and you may not have it in your path.

    The compiler option for statically linking the runtime library is /MT (/MTd for debug version), while the option for using DLL is /MD (/MDd for debug version).

    Hope it helps.

    Miwarre

  10. The following user says thank you to miwarre for this useful post:

    piotr.dobrogost (21st July 2009)

  11. #10
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: A difference between debug build with gcc and vc++

    Hi,

    A second thought: the issue with msvcr DLL may (MAY) be due to a Side-by-side (SxS) issue.

    You are probably familiar with SxS: it is a way MS devised to allow multiple versions of the same DLL to co-exist and the app (or the system) to choose the best match. Many (me included) think it is not worth the hassle, but it is there and we have to cope with it.

    To let the system know about app's preferences about SxS-ed DLL's, the app needs to include a "manifest".

    Now, msvcrXX.dll are SzS-ed DLL's and you had an error with the mt.exe tool, which is precisely the tool embedding a manifest in the app (the error seems to be intermittent, but it is a hint of possible mis-configuration anyway).

    If you have a hex editor, look in the app .exe file for the string "manifestVersion"; if the app is manifest-ed correctly you should locate a text chunk like this:

    Qt Code:
    1. <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
    2. <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
    3. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    4. <security>
    5. <requestedPrivileges>
    6. <requestedExecutionLevel level='asInvoker' uiAccess='false' />
    7. </requestedPrivileges>
    8. </security>
    9. </trustInfo>
    10. <dependency>
    11. <dependentAssembly>
    12. <assemblyIdentity type='win32' name='Microsoft.VC90.DebugCRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    13. </dependentAssembly>
    14. </dependency>
    15. [possibly most <dependency>...</dependency> tags following]
    16. </assembly>
    To copy to clipboard, switch view to plain text mode 

    If there is no embedded manifest in the app, or the manifest does not reference the 'right' SxS (which the 'right SxS is, it is not always clear), your app will not find the DLL, no matter of PATH's and other settings.

    I have noticed that sometime mt.exe does not do the right job and embeds an empty manifest; often by re-running it, things go better...

    Just in case: the SxS-ed DLL's reside in the "<WindowsMainFolder>\WinSxS" folder; each has its own sub-folder (looking like "\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0 .21022.8_x-ww_597c3456\"); each also needs some registry settings (simply adding the sub-folder is not enough) and I never understood which.

    If all of this simply looks like a mess... I agree with you.

    Ciao,

    Miwarre

  12. The following user says thank you to miwarre for this useful post:

    piotr.dobrogost (21st July 2009)

  13. #11
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A difference between debug build with gcc and vc++

    Quote Originally Posted by miwarre View Post
    Possibly it is not related to libraries. By default, vc++ does NOT include debug info in the executable but in an external <appname>.pdb file. This probably accounts for (the major part of) the difference in size.
    I agree. There is <appname>.pdb file of 2M size.
    The strange thing is there's no DEBUG defined when calling cl from the makefile.
    VC++ can generate debug symbols even in release mode (http://stackoverflow.com/questions/218226).
    I'm afraid this might be the case.
    What do you think?

    Quote Originally Posted by miwarre View Post
    The error about msvcr90.dll is probably another matter; I may be wrong, but I don't think that gcc needs this library at all; that's why it does not complain. On the other hand, vc++ does need it and you may not have it in your path.
    I think every executable that uses dynamic crt needs some version of msvc... library.
    I checked both versions for dynamic libraries dependencies with Dependency Walker. Here are the results

    gcc version:

    KERNEL32.DLL, MINGWM10.DLL, MSVCRT.DLL, MSVCRT.DLL, QTCORED4.DLL, QTGUID4.DLL, QTWEBKITD4.DLL

    vc version:

    KERNEL32.DLL, MSVCR90D.DLL, QTCORED4.DLL, QTGUID4.DLL, QTWEBKITD4.DLL


    When I enable showing paths in DW it finds
    MSVCRT.DLL file (in gcc case) in
    c:\windows\syswow64\MSVCRT.DLL (I'm running Vista x64 so that's why there's syswow64 subfolder here)
    and it finds MSVCR90D.DLL file (in case of vc) in
    c:\windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8 b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\MSV CR90D.DLL

    I think msvcrt.dll is a kind of interface to specific version of msvc* crt library that happens to be installed in the system.
    It's thought as a single entry point for all applications using msvc* crt libraries so that they don't have to worry about ensuring the specific version of dynamic crt is isntalled in the system.

    Quote Originally Posted by miwarre View Post
    The compiler option for statically linking the runtime library is /MT (/MTd for debug version), while the option for using DLL is /MD (/MDd for debug version).
    I know this but thanks for stating this for completeness.

  14. #12
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: A difference between debug build with gcc and vc++

    Quote Originally Posted by miwarre View Post
    A second thought: the issue with msvcr DLL may (MAY) be due to a Side-by-side (SxS) issue.
    You are right. You can find whole story here.

  15. #13
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: A difference between debug build with gcc and vc++

    Quote Originally Posted by piotr.dobrogost View Post
    [CODE]Running build steps for project formextractor... {...}

    Any ideas?
    This usually happens when you have certain virus scanners 'active'. The linker writes the exe, Windows blatantly lies that writing it was successful
    while in practice it was held by a malware scanner. Before that finished,
    mt.exe is called, does not find the fresh exe, and bails out.

    In the second try, the virus scanner finished in the mean time, and the exe has been written to disk, and mt.exe is happily embedding

    There is not much you can do about that given that choice of operating system.

Similar Threads

  1. Build Qt under cygwin with gcc
    By lixo1 in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd June 2009, 12:37
  2. Unable to build Qt 4.4.0 debug libs with MinGW (pch error)
    By AlGaN in forum Installation and Deployment
    Replies: 2
    Last Post: 7th June 2008, 15:24
  3. How to build in debug mode?
    By Weilor in forum Newbie
    Replies: 5
    Last Post: 15th February 2006, 15:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.