From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26332 invoked by alias); 12 Jun 2009 16:09:32 -0000 Received: (qmail 26320 invoked by uid 22791); 12 Jun 2009 16:09:30 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail-ew0-f228.google.com (HELO mail-ew0-f228.google.com) (209.85.219.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 12 Jun 2009 16:09:21 +0000 Received: by ewy28 with SMTP id 28so2709918ewy.24 for ; Fri, 12 Jun 2009 09:09:18 -0700 (PDT) Received: by 10.210.68.17 with SMTP id q17mr4578520eba.34.1244822958247; Fri, 12 Jun 2009 09:09:18 -0700 (PDT) Received: from ?192.168.1.105? (AMontsouris-553-1-24-51.w92-151.abo.wanadoo.fr [92.151.143.51]) by mx.google.com with ESMTPS id 28sm1118730eyg.4.2009.06.12.09.09.16 (version=SSLv3 cipher=RC4-MD5); Fri, 12 Jun 2009 09:09:17 -0700 (PDT) Subject: Re: working release test failed in debug mode From: Geoff McLane To: Diego Ruiz Cc: pthreads-win32@sourceware.org In-Reply-To: References: <58344da04430a2f0b57d52a9e514b98d.squirrel@mmp.sipr-dc.ucl.ac.be> Content-Type: text/plain; charset=utf-8 Date: Fri, 12 Jun 2009 16:09:00 -0000 Message-Id: <1244822956.6459.6.camel@DELL02> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2009/txt/msg00029.txt.bz2 Hi Diego, >> any help or idea Not sure if any of this will help, but... (a) It is 'normal' that sometimes 'Release' will appear to run, while 'Debug' crashes. There are MORE runtime checks done in 'Debug', mode, that will sometime pass in 'Release' mode, but that does NOT mean the problem is not present in BOTH! (b) This may NOT be a pthread DLL problem at all! It may be in QuserEx.dll!! or APSHook.dll... or others loaded... (c) The error you showed, R6034, is an attempt to load a DLL without using a manifest. Check out this error number in the MSVC8 HELP. For example, certainly, the steps you showed to build the pthread DLL/LIB, did NOT appear to include running the 'mt' manifest tool - - nmake clean VCE-inlined You need to check that the 'Makefile' DOES include embedding the manifest inside the DLL.. that is runs the 'mt' tool with a resource ID 2. Again see the HELP information for details... Some 'older' Makefiles MISSED this step, only required after circa 2003! This manifest embedding would have been automatically done by MSVC8 (2005) when you build the 'Hello' application, using the MSVC8 IDE, but manifest MUST also be embedded in ALL the DLL's loaded as well... This would include the QuserEx.dll, and the APSHook.dll, the last being loaded before the runtime error... (d) I built your 'hello' applications, and had no such problem, but I DID NOT include 'quserex.lib' in the link... maybe try excluding this, to narrow down the problem... There is nothing shown in your 'test' application, as shown, that requires this DLL! (e) Some other difference noted when I ran my debug 'Hello.exe' in MSVC8 to what you showed in your email - (i) Mine only loaded - C:\WINDOWS\system32\ws2_32.dll but I note your output _ALSO_ included C:\WINDOWS\system32\wsock32.dll You should only have ONE or the OTHER of these loaded... ws2 is just version 2 of the windows sockets DLL, and with it, the older version 1 should not need to be loaded... (ii) Yours loaded BOTH - 'Hello.exe': Loaded 'C:\Users\ruiz\Documents\Visual Studio 2005\Projects\Tests\Hello\debug\msvcr80.dll' +AND+ 'C:\WINDOWS\winsxs \x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.762_none_24c8a196583ff03b\msvcr80d.dll' while mine ONLY loaded the WinSXS version msvcr80d.dll, as it should be! You should perhaps delete the Tests\Hello\debug\msvcr80.dll! This MS runtime DLL, or other MS DLLS should NOT be copied to your 'work' folders... If you feel for some reason you have to, to get it running, then this again suggests some problem with the 'mt' tool, or some other problem??? (iii) Yours loaded a whole bunch of other DLL that are NOT present in my load, like - 'Hello.exe': Loaded 'C:\WINDOWS\System32\rpcrt4.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\nsi.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\user32.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\gdi32.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\imm32.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\msctf.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\lpk.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\usp10.dll', No symbols loaded. 'Hello.exe': Loaded 'C:\WINDOWS\System32\APSHook.dll', Binary was not and not sure why??? You must include other things not shown in your email, to cause these loads... Simply, the pthreads DLL should work fine, and the MS DLL products should be ok, but can not speak for the other '3rd party' DLLS... which is where I think the problem lies... Anyway, hope this helps... Regards, Geoff. On Fri, 2009-06-12 at 15:00 +0200, Diego Ruiz wrote: > Hello, > > I manage to test a very small example in release mode. However the same > example crashes in debug mode. > > Thanks for any help or idea > Diego > > Ps: I am new to windows. I need to port my application from ubuntu to > visual studio. > > > Microsoft Visual Studio 2005 > New project -> WIN32 -> WIN32 Console application (name Hello) > > • Added #include to stdafx.h > • Changed Hello.cpp: > #include "stdafx.h" > > pthread_mutex_t mutex_bigbag = PTHREAD_MUTEX_INITIALIZER; > > /*! This program test compilation with the pthread library on windows */ > int _tmain(int argc, _TCHAR* argv[]) > { > > printf("hello\n"); > getchar(); > getchar(); > > pthread_mutex_lock( &mutex_bigbag ); > > pthread_mutex_unlock(&mutex_bigbag); > > return 0; > } > > • QueueUserAPCEx: > - Copy the driver and reboot as explained in the README file of directory > - Copying the dll (QuserEx.dll, QuserEx.lib) in working directory of > solution (release, debug) > - Copying the lib in an usefull_libs directory > - using "net start alertdrv" in command prompt (cmd) in administrator mode > > • pthreads.2: > - programs-> Visual studio -> visual studio tools -> VS command prompt > - cd directory of pthreads.2 > - nmake clean VCE-inlined > - copy the created dll in working directory of solution (release, debug) > - copy of the library in usefull_libs directory > > • Test 1 in realease mode > - Added path to inlcludes (pthread.h) > - Added path to library in linker (usefull_libs) > - Added library dependency in linker (pthreadVCE2.lib quserex.lib) > - Compilation OK (0 errors, 0 warnings) > - Test OK (prints hello and wait for char in terminal) > > • Test in debug mode > > - Added path to inlcludes (pthread.h) > - Added path to library in linker (usefull_libs) > - Added library dependency in linker (pthreadVCE2.lib quserex.lib) > - Compilation OK (0 errors, 0 warnings) > - Test KO: > > 'Hello.exe': Loaded 'C:\Users\ruiz\Documents\Visual Studio > 2005\Projects\Tests\Hello\debug\Hello.exe', Symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\ntdll.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\kernel32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\Users\ruiz\Documents\Visual Studio > 2005\Projects\Tests\Hello\debug\pthreadVCE2.dll', Symbols loaded. > 'Hello.exe': Loaded 'C:\Users\ruiz\Documents\Visual Studio > 2005\Projects\Tests\Hello\debug\msvcr80.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\msvcrt.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\wsock32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\ws2_32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\advapi32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\rpcrt4.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\nsi.dll', No symbols loaded. > 'Hello.exe': Loaded > 'C:\WINDOWS\winsxs\x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.762_none_24c8a196583ff03b\msvcr80d.dll', > Symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\user32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\gdi32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\imm32.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\msctf.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\lpk.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\usp10.dll', No symbols loaded. > 'Hello.exe': Loaded 'C:\WINDOWS\System32\APSHook.dll', Binary was not > built with debug information. > First-chance exception at 0x77943387 in Hello.exe: 0xC0000005: Access > violation writing location 0x00000014. > R6034 > An application has made an attempt to load the C runtime library incorrectly. > Please contact the application's support team for more information. > Windows has triggered a breakpoint in Hello.exe. > > This may be due to a corruption of the heap, and indicates a bug in > Hello.exe or any of the DLLs it has loaded. > > The output window may have more diagnostic information > First-chance exception at 0x77909cac in Hello.exe: 0xC0000142: DLL > Initialization Failed. > Unhandled exception at 0x77909cac in Hello.exe: 0xC0000142: DLL > Initialization Failed. > Hello.exe has triggered a breakpoint > First-chance exception at 0x769e8f21 in Hello.exe: 0xC0000005: Access > violation reading location 0x769e8f21. > > > *** A stack buffer overrun occurred in "c:\users\ruiz\documents\visual > studio 2005\projects\tests\hello\debug\Hello.exe" : > > This is usually the result of a memory copy to a local buffer or structure > where the size is not properly calculated/checked. > If this bug ends up in the shipping product, it could be a severe security > hole. > The stack trace should show the guilty function (the function directly > above __report_gsfailure). > *** enter .exr 779C9320 for the exception record > *** then kb to get the faulting stack > > Windows has triggered a breakpoint in Hello.exe. > > This may be due to a corruption of the heap, and indicates a bug in > Hello.exe or any of the DLLs it has loaded. > > The output window may have more diagnostic information > Windows has triggered a breakpoint in Hello.exe. > > This may be due to a corruption of the heap, and indicates a bug in > Hello.exe or any of the DLLs it has loaded. > > The output window may have more diagnostic information > The program '[5584] Hello.exe: Native' has exited with code -1073740791 > (0xc0000409).