Seg fault on printf when porting a Gtk app from Linux to Windows with MSYS
Patrice St-Gelais <[email protected]> Wed, 19 Jan 2011 00:43:51 -0500
| Newsgroups | gmane.comp.gnu.mingw.msys |
|---|---|
| Message-ID | <[email protected]> |
Hi list,
I am trying to port a Gtk/OpenGL app to Windows (geomorph.sourceforge.net).
I first installed the MinGW - Msys current bundle in a WinXP SP3 VM
(mingw-get-inst-20101030.exe).
Then I installed separately, in the /mingw directory, the GTK win32
packages (http://www.gtk.org/download-windows.html). I first tried to
install the GTK bundle in a distinct directory, but I got some library
conflicts, which ended with seg faults in internationalization functions
(bindtextdomain).
I was able to compile my app with ./configure and make, after some
reordering of the libraries in the linking command. Autoconf / automake
broke the configure script, so I avoided them.
Now when I execute geomorph.exe from the MSYS shell I get a seg fault in
printf.
A test with "printf("Hello World!\n");" worked perfectly, though.
After searching the Mingw / Msys forums and the web a few evenings, I
give up!
The linking command is:
gcc -v -g -O2 -o geomorph.exe -Lc:/MinGW/msys/1.0/lib -Lc:/MinGW/lib
main.o app.o document.o doctype.o thisappinit.o stack.o ../hf/libhf.a
../fourier/libfourier.a ../utils/libutils.a -lgdk-win32-2.0
-lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0
-lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lglu32
-lopengl32 -luser32 -lkernel32 -lgtkglext-win32-1.0
-lgdkglext-win32-1.0 -lpng14 -lmsvcrt -lm &> gcc.txt
The backtrace in GDB is:
Starting program:
C:\MinGW\msys\1.0\home\Patrice_St-Gelais\geomorph-0.61\src\app/geomorph.exe
[New Thread 2064.0x86c]
Program received signal SIGSEGV, Segmentation fault.
0x7c928fea in ntdll!RtlpWaitForCriticalSection ()
from C:\WINDOWS\system32\ntdll.dll
(gdb) backtrace
#0 0x7c928fea in ntdll!RtlpWaitForCriticalSection ()
from C:\WINDOWS\system32\ntdll.dll
#1 0x7c91104b in ntdll!RtlEnumerateGenericTableLikeADirectory ()
from C:\WINDOWS\system32\ntdll.dll
#2 0x0009bb0c in ?? ()
#3 0x71064c08 in msys-1!cfsetispeed ()
from C:\MinGW\msys\1.0\bin\msys-1.0.dll
#4 0x7105f964 in msys-1!ctermid () from C:\MinGW\msys\1.0\bin\msys-1.0.dll
#5 0x7108eb6e in msys-1!_ctype_ () from C:\MinGW\msys\1.0\bin\msys-1.0.dll
#6 0x00000000 in ?? ()
From what I have read on the web and in the system headers, the problem
is probably related to an internationalisation library which redefines
printf.
Msys provides /mingw/msys/1.0/lib/libintl.dll.a (gettext 0.17?), Mingw
also (/mingw/lib/libintl.dll.a) but they are not the same size, and Gtk
provides /mingw/bin/intl.dll (gettext 0.18!).
How can I compile and link an internationalized program with Msys?
Should I have ever tried at first?
Any help to sort that mess is welcome!
Thanks
Patrice
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl