• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# VC is ok but Mingw crashes with libcurl

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

10 replies to this topic

### #1FGFS  Members

Posted 26 April 2014 - 09:34 AM

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

### #2ApochPiQ  Moderators

Posted 26 April 2014 - 11:41 AM

POPULAR

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

Wielder of the Sacred Wands

### #3FGFS  Members

Posted 26 April 2014 - 11:02 PM

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)

### #4ApochPiQ  Moderators

Posted 27 April 2014 - 10:34 AM

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

### #5FGFS  Members

Posted 27 April 2014 - 11:33 PM

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.

--------

C:\Users\Michael\Desktop\X-Plane 10 Demo>gdb X-Plane.exe
GNU gdb (GDB) 7.1.90.20100730-cvs
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

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'
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);

Edited by FGFS, 28 April 2014 - 12:17 AM.

### #6Endurion  Members

Posted 28 April 2014 - 12:25 AM

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>

### #7georger.araujo  Members

Posted 28 April 2014 - 12:31 AM

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.

--------

C:\Users\Michael\Desktop\X-Plane 10 Demo>gdb X-Plane.exe
GNU gdb (GDB) 7.1.90.20100730-cvs
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

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'
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.

### #8BitMaster  Members

Posted 28 April 2014 - 01:01 AM

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.

Edited by BitMaster, 28 April 2014 - 01:01 AM.

### #9FGFS  Members

Posted 28 April 2014 - 04:14 AM

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

### #10Endurion  Members

Posted 28 April 2014 - 05:44 AM

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>

Posted 28 April 2014 - 04:56 PM

strip win.xpl

That command is the reason you have no debug symbols in your call stack. Try removing it and using gdb again. You should get a more useful call stack.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.