cross-compiling linux->win32 with mingw



Hi Gtk List!

I downloaded binaries and development files needed for compiling GTK
applications targeting the win32 platform from gtk.org:

ftp://ftp.gtk.org/pub/gtk/v2.8/win32/

I have tried building my program binaries using the mingw compiler
available in the Debian stable (Etch) repository to no avail. Whenever
I attempt to start the application on Windows, however, I get this
cryptic and useless error message:

"The application failed to initialize properly (0xc0000022). Click on
OK to terminate the application." message.

In case you aren't using Etch, her is my compiler version:

$ i586-mingw32msvc-cc --version
i586-mingw32msvc-cc (GCC) 3.4.5 (mingw special)

I have narrowed my problem down to a simple test case:

/* test.c */
#include <stdio.h>
#include <glib.h>
#include <SDL.h>
#include <gtk/gtk.h>
#include <windows.h>
#include <sqlite3.h>

int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)   {
    puts("Symbol Party!");
    printf("Address of printf   %p\n", printf);
    printf("Address of puts     %p\n", puts);
    printf("Address of sqlite3_close    %p\n", sqlite3_close);
    printf("Address of SDL_Init %p\n", SDL_Init);
    printf("Address of g_free   %p\n", g_free);
    return 0;
}

As you might have guessed from the look of it, I am using other
libraries as well, and as I suspected some kind of linker issue (since
a very basic program using only the standard C library worked just
fine) I decided to write this test program that would simply require
that certain symbols were available at runtime. Simply remove the
sqlite3_close and SDL_Init lines to get to the simplest test case if
you wish to try this yourself. Here is the command I used to build the
test program:

$ i586-mingw32msvc-cc -lSDLmain test.c -o test.exe
-I/home/donny/mingw/sqlite3 -I/home/donny/mingw/SDL-1.2.13/include/SDL
-D_GNU_SOURCE=1 -mms-bitfields -I/home/donny/mingw/GTK/include/gtk-2.0
-I/home/donny/mingw/GTK/lib/gtk-2.0/include
-I/home/donny/mingw/GTK/include/atk-1.0
-I/home/donny/mingw/GTK/include/cairo
-I/home/donny/mingw/GTK/include/pango-1.0
-I/home/donny/mingw/GTK/include/glib-2.0
-I/home/donny/mingw/GTK/lib/glib-2.0/include
-I/home/donny/mingw/GTK/include/libpng12   -Wall
-L/home/donny/rioskiller -L/home/donny/mingw/sqlite3
-L/home/donny/mingw/SDL-1.2.13/lib -lSDL -lSDLmain
-L/home/donny/mingw/GTK/lib -lgtk-win32-2.0 -lglib-2.0 -lintl -liconv
-lsqlite3  && wine test.exe

The program runs fine under wine. Under Windows XP, however, I get the
aforementioned "failed to initialize properly" message. If I remove
the g_free line from test.c, then my program runs fine.

Anyone have any guess as to why this is happening?

-- 
http://www.socsurveys.org/
http://blogger.socsurveys.org/
http://del.icio.us/hdon
http://hdon.soup.io/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]