VC is ok but Mingw crashes with libcurl

Started by
9 comments, last by Adam_42 10 years ago

HI

vc2012 is ok but with mingw my app, that uses libcurl, crashes. Any ideas on what to change/try, as I want to use Mingw with Eclipse on Win8?

Many thanks

Advertisement

http://www.gamedev.net/blog/355/entry-2254834-oh-noes-my-code-is-teh-crash/

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I had a hard time finding a 64 gdb for mingw. Now it segfaults with "cannot access memory" or something alike. Funny it works everywhere except win64. (Linux/Mac/win32)

If you want help, I'd suggest starting with following the instructions in the article I linked. We're not psychics.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Thanks, as it rather small I simply paste it below. If you need more details you have to tell me how to do that. So basically I get a file from my remote server but it even crashes before doing anything at all. Yesterday, I've played all day with different link details etc. in Eclipse/mingw on Win8 without success. It simply works fine in VC11, Linux, Mac.

Many thanks for your help.

--------

C:\Users\Michael\Desktop\X-Plane 10 Demo>gdb X-Plane.exe
GNU gdb (GDB) 7.1.90.20100730-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\Michael\Desktop\X-Plane 10 Demo/X-Plane.exe...(no
debugging symbols found)...done.
(gdb) run
Starting program: C:\Users\Michael\Desktop\X-Plane 10 Demo/X-Plane.exe
[New Thread 5352.0x1318]
[New Thread 5352.0x12fc]
[New Thread 5352.0xa3c]
[New Thread 5352.0x9fc]
[New Thread 5352.0xc24]
[New Thread 5352.0xd28]
[New Thread 5352.0x1578]
[New Thread 5352.0x1658]
[New Thread 5352.0x153c]
[New Thread 5352.0xdf4]
[New Thread 5352.0x1534]
[New Thread 5352.0x14a4]
[New Thread 5352.0x8fc]
[New Thread 5352.0x1270]
[New Thread 5352.0xde4]
[New Thread 5352.0x1058]
[New Thread 5352.0x7f8]
[New Thread 5352.0x1494]
[New Thread 5352.0x6fc]
[New Thread 5352.0x14a0]
[New Thread 5352.0x5a4]
[New Thread 5352.0xc8]
[New Thread 5352.0x630]
[New Thread 5352.0xf60]
[New Thread 5352.0x720]
[New Thread 5352.0xce8]
[New Thread 5352.0x514]
[New Thread 5352.0x1254]
[New Thread 5352.0x50c]
[New Thread 5352.0x3c8]
[New Thread 5352.0xb98]
[New Thread 5352.0x32c]
[New Thread 5352.0x1090]
[New Thread 5352.0xee4]
[New Thread 5352.0x10bc]
[New Thread 5352.0x4ac]
[New Thread 5352.0x13a8]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000000011f94caf in ?? ()
from C:\Users\Michael\Desktop\X-Plane 10 Demo\Aircraft\General Aviation\someAirplane\plugins\sp12\64\win.xpl
#2 0x0000000000000000 in ?? ()
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb)

----------

?05:55:02 **** Incremental Build of configuration debug for project someplane - E64 ****
mingw32-make all
'Building file: ../main.cpp'
'Invoking: Cross G++ Compiler'
g++ -DLIN=0 -DREF=0 -DAPL=0 -DIBM=1 -DXPLM200 -DXPLM210 -IH:\CPP-Win\FilesWin\curl-7.28.1-devel-mingw64\include -IH:\CPP-Win\FilesWin\SDL_image-1.2.12\include -IH:\CPP-Win\FilesWin\include -IH:\CPP-Win\SDK\CHeaders\XPLM -IH:\CPP-Win\FilesWin\SDL-1.2.15\include -O3 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
'Finished building: ../main.cpp'
' '
'Building target: win.xpl'
'Invoking: Cross G++ Linker'
g++ -Bstatic -lcurldll -LH:\CPP-Win\FilesWin\OpenAL_1.1_SDK\libs\Win64 -L"H:\CPP-Win\FilesWin\curl-7.34.0-devel-mingw64\bin" -L"H:\CPP-Win\someplane - E64" -LH:\CPP-Win\mingw64\lib -L"H:\CPP-Win\FilesWin\curl-7.34.0-devel-mingw64\lib64" -LH:\CPP-Win\FilesWin\SDL-1.2.15\lib\x64 -LH:\CPP-Win\FilesWin\SDL_image-1.2.12\lib\x64 -LH:\CPP-Win\SDK\Libraries\Win -shared -o "win.xpl" ./main.o -lopenal32 -lcurldll -lSDL -lSDL_image -lXPLM_64 -lglew32s -lopengl32 -lglu32
Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
'Finished building target: win.xpl'
' '
mingw32-make --no-print-directory post-build
strip win.xpl
' '

05:55:10 Build Finished (took 7s.627ms)

-----------

removed the strip command and gdb debugger hangs just after:

? curl_global_init(CURL_GLOBAL_ALL);

4. Provide a call stack and the code of the crash site

There's a gazillion of options on libcurl and a myriad of ways to call it. Show the code where you call it. And, if possible, point out at which location it crashes.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Thanks, as it rather small I simply paste it below. If you need more details you have to tell me how to do that. So basically I get a file from my remote server but it even crashes before doing anything at all. Yesterday, I've played all day with different link details etc. in Eclipse/mingw on Win8 without success. It simply works fine in VC11, Linux, Mac.

Many thanks for your help.

--------

C:\Users\Michael\Desktop\X-Plane 10 Demo>gdb X-Plane.exe
GNU gdb (GDB) 7.1.90.20100730-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\Michael\Desktop\X-Plane 10 Demo/X-Plane.exe...(no
debugging symbols found)...done.
(gdb) run
Starting program: C:\Users\Michael\Desktop\X-Plane 10 Demo/X-Plane.exe
[New Thread 5352.0x1318]
[New Thread 5352.0x12fc]
[New Thread 5352.0xa3c]
[New Thread 5352.0x9fc]
[New Thread 5352.0xc24]
[New Thread 5352.0xd28]
[New Thread 5352.0x1578]
[New Thread 5352.0x1658]
[New Thread 5352.0x153c]
[New Thread 5352.0xdf4]
[New Thread 5352.0x1534]
[New Thread 5352.0x14a4]
[New Thread 5352.0x8fc]
[New Thread 5352.0x1270]
[New Thread 5352.0xde4]
[New Thread 5352.0x1058]
[New Thread 5352.0x7f8]
[New Thread 5352.0x1494]
[New Thread 5352.0x6fc]
[New Thread 5352.0x14a0]
[New Thread 5352.0x5a4]
[New Thread 5352.0xc8]
[New Thread 5352.0x630]
[New Thread 5352.0xf60]
[New Thread 5352.0x720]
[New Thread 5352.0xce8]
[New Thread 5352.0x514]
[New Thread 5352.0x1254]
[New Thread 5352.0x50c]
[New Thread 5352.0x3c8]
[New Thread 5352.0xb98]
[New Thread 5352.0x32c]
[New Thread 5352.0x1090]
[New Thread 5352.0xee4]
[New Thread 5352.0x10bc]
[New Thread 5352.0x4ac]
[New Thread 5352.0x13a8]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000000011f94caf in ?? ()
from C:\Users\Michael\Desktop\X-Plane 10 Demo\Aircraft\General Aviation\someAirplane\plugins\sp12\64\win.xpl
#2 0x0000000000000000 in ?? ()
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb)

----------

?05:55:02 **** Incremental Build of configuration debug for project someplane - E64 ****
mingw32-make all
'Building file: ../main.cpp'
'Invoking: Cross G++ Compiler'
g++ -DLIN=0 -DREF=0 -DAPL=0 -DIBM=1 -DXPLM200 -DXPLM210 -IH:\CPP-Win\FilesWin\curl-7.28.1-devel-mingw64\include -IH:\CPP-Win\FilesWin\SDL_image-1.2.12\include -IH:\CPP-Win\FilesWin\include -IH:\CPP-Win\SDK\CHeaders\XPLM -IH:\CPP-Win\FilesWin\SDL-1.2.15\include -O3 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
'Finished building: ../main.cpp'
' '
'Building target: win.xpl'
'Invoking: Cross G++ Linker'
g++ -Bstatic -lcurldll -LH:\CPP-Win\FilesWin\OpenAL_1.1_SDK\libs\Win64 -L"H:\CPP-Win\FilesWin\curl-7.34.0-devel-mingw64\bin" -L"H:\CPP-Win\someplane - E64" -LH:\CPP-Win\mingw64\lib -L"H:\CPP-Win\FilesWin\curl-7.34.0-devel-mingw64\lib64" -LH:\CPP-Win\FilesWin\SDL-1.2.15\lib\x64 -LH:\CPP-Win\FilesWin\SDL_image-1.2.12\lib\x64 -LH:\CPP-Win\SDK\Libraries\Win -shared -o "win.xpl" ./main.o -lopenal32 -lcurldll -lSDL -lSDL_image -lXPLM_64 -lglew32s -lopengl32 -lglu32
Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
'Finished building target: win.xpl'
' '
mingw32-make --no-print-directory post-build
strip win.xpl
' '

05:55:10 Build Finished (took 7s.627ms)

-----------

removed the strip command and gdb debugger hangs just after:

? curl_global_init(CURL_GLOBAL_ALL);

It looks like you're telling GCC to link against at least one MSVC-built library. To find out which one(s), look for the string /DEFAULTLIB:"LIBCMT" in each library file, and replace each incompatible library with the appropriate GCC/MinGW-built one.

I'm not too familiar with explicitly debugging with gdb but that appears as if you suffer from a severe lack of debugging information since the call stack does not contain any useful information. I usually generate my projects via CMake where it would be enough to set the configuration type to 'Debug'.

That said, georger.araujo's remark about linking MSVC-built libraries it definitely sensible. It does not have to be the cause of the problem (depends on the kind of linking and the build settings used) but it's an obvious smell that should be investigated.

Apart from adding more debugging information you should also try to create a minimal program that reproduces the problem (and post it here).

MinGW programs can also crash in unexpected ways if their runtime libraries are not present. You might want to investigate that, especially if you did not build some of the libraries you are using yourself.

Also note that some things you are not allowed to do by the standard (like using 'delete' where you should have used 'delete[]' or vice versa) typically do not cause any problems with MSVC but will with gcc.

I'll try to build libcurl. In the readme it says to use the command prompt within VC11. Where is that in VC2012? Can't find it, I've only used such on Linux...

Thanks

Usually that's in found in the start menu. It's a link to a batch file that sets up a few environment variables.

Look under "Visual Studio 2012" for "Visual Studio Tools". There should be two links to a command prompt, one for x86, one for x64.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement