Glib-Windows Compilation Issues
- From: Jake Goulding <goulding vivisimo com>
- To: gtk-devel-list gnome org
- Subject: Glib-Windows Compilation Issues
- Date: Fri, 17 Mar 2006 16:40:09 -0500
Hey all:
I've had some trouble in compiling and subsequently using glib (2.8.6)
on a Windows machine.
I am building using nmake and the MSVC toolset. My procedure is such:
unpack glib into a directory containing gettext and libiconv.
cd build/win32/dirent
nmake -f makefile.msc
cd ../../../
nmake -f makefile.msc
Then the trouble starts... I have gotten it to compile, and my patches
are included here. The very bottom describes my current trouble.
##################################################################################
I had to make the following changes to work around differing level of
indirection errors:
diff -r --unified glib-2.8.6/glib/gatomic.c gmod/glib/gatomic.c
--- glib-2.8.6/glib/gatomic.c 2005-12-17 07:26:54.000000000 -0500
+++ gmod/glib/gatomic.c 2006-03-15 10:27:21.907293400 -0500
@@ -514,9 +514,9 @@
gint32 oldval,
gint32 newval)
{
- return (guint32)InterlockedCompareExchange ((PVOID*)atomic,
- (PVOID)newval,
- (PVOID)oldval) == oldval;
+ return (guint32)InterlockedCompareExchange (atomic,
+ newval,
+ oldval) == oldval;
}
gboolean
@@ -527,7 +527,7 @@
# if GLIB_SIZEOF_VOID_P != 4 /* no 32-bit system */
# error "InterlockedCompareExchangePointer needed"
# else
- return InterlockedCompareExchange (atomic, newval, oldval) == oldval;
+ return InterlockedCompareExchange ((volatile long *)atomic,
(long)newval, (long)oldval) == (long)oldval;
# endif
}
#endif /* DEFINE_WITH_WIN32_INTERLOCKED */
##################################################################################
I also had to remove support for g_win32_ftruncate, as mingw has it
defined, and I later want to link glib against mingw-compiled code:
diff -r --unified glib-2.8.6/glib/glib.symbols gmod/glib/glib.symbols
--- glib-2.8.6/glib/glib.symbols 2005-08-29 18:12:15.000000000 -0400
+++ gmod/glib/glib.symbols 2006-03-15 10:27:44.126612200 -0500
@@ -1243,7 +1243,6 @@
#if IN_FILE(__G_WIN32_H__)
#ifdef G_OS_WIN32
g_win32_error_message
-g_win32_ftruncate
g_win32_get_package_installation_directory PRIVATE
g_win32_get_package_installation_directory_utf8
g_win32_get_package_installation_subdirectory PRIVATE
diff -r --unified glib-2.8.6/glib/gwin32.h gmod/glib/gwin32.h
--- glib-2.8.6/glib/gwin32.h 2005-04-27 05:50:09.000000000 -0400
+++ gmod/glib/gwin32.h 2006-03-15 10:27:21.907293400 -0500
@@ -61,8 +63,13 @@
* g_win32_. Or that was the idea at some time, but there is just one
* of those:
*/
-gint g_win32_ftruncate (gint f,
- guint size);
+
+/* Use supplied MinGW function */
+#define ftruncate g_win32_ftruncate
+
+ gint g_win32_ftruncate (gint f,
+ guint size);
+
#endif /* G_OS_WIN32 */
/* The MS setlocale uses locale names of the form "English_United
##################################################################################
And I also had to add the following changes to the makefiles, in order
to build static versions of all 4 libraries:
diff -r --unified glib-2.8.6/glib/makefile.msc gmod/glib/makefile.msc
--- glib-2.8.6/glib/makefile.msc 2006-01-18 12:03:46.000000000 -0500
+++ gmod/glib/makefile.msc 2006-03-15 10:27:21.922918800 -0500
@@ -107,7 +107,7 @@
# create a static libary
# static library can well have the real version number in the name
glib-2.8s.lib : $(glib_OBJECTS) gnulib\gnulib.lib
- lib /out:glib-2.8s.lib $(glib_OBJECTS) gnulib\gnulib.lib
+ lib /out:glib-2.8s.lib $(glib_OBJECTS) gnulib\gnulib.lib
$(DIRENT_LIBS)
libglib-2.0-0.dll : $(glib_OBJECTS) gnulib\gnulib.lib glib.def glib.res
$(CC) $(CFLAGS) -LD -Fe$@ $(glib_OBJECTS) glib.res
$(LIBICONV_LIBS) $(INTL_LIBS) \
diff -r --unified glib-2.8.6/gmodule/makefile.msc gmod/gmodule/makefile.msc
--- glib-2.8.6/gmodule/makefile.msc 2006-01-18 12:03:50.000000000 -0500
+++ gmod/gmodule/makefile.msc 2006-03-15 10:27:21.922918800 -0500
@@ -12,7 +12,8 @@
all : \
gmoduleconf.h \
- libgmodule-2.0-0.dll
+ libgmodule-2.0-0.dll \
+ gmodule-2.8s.lib
gmodule_OBJECTS = \
gmodule.obj
@@ -23,6 +24,9 @@
gmodule.res : gmodule.rc
rc -DBUILDNUMBER=0 -r -fo gmodule.res gmodule.rc
+gmodule-2.8s.lib : $(gmodule_OBJECTS)
+ lib /out:gmodule-2.8s.lib $(gmodule_OBJECTS)
+
libgmodule-2.0-0.dll : $(gmodule_OBJECTS) gmodule.def gmodule.res
$(CC) $(CFLAGS) -LD -Fe$@ $(gmodule_OBJECTS) gmodule.res \
..\glib\glib-2.0.lib $(LDFLAGS) /implib:gmodule-2.0.lib
/def:gmodule.def
diff -r --unified glib-2.8.6/gthread/makefile.msc gmod/gthread/makefile.msc
--- glib-2.8.6/gthread/makefile.msc 2006-01-18 12:03:52.000000000 -0500
+++ gmod/gthread/makefile.msc 2006-03-15 10:27:21.922918800 -0500
@@ -10,7 +10,8 @@
INCLUDES = -FImsvc_recommended_pragmas.h -I .. -I . -I ..\glib
DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"GThread\"
all : \
- libgthread-2.0-0.dll
+ libgthread-2.0-0.dll \
+ gthread-2.8s.lib
gthread_OBJECTS = \
gthread-impl.obj
@@ -21,6 +22,9 @@
gthread.res : gthread.rc
rc -DBUILDNUMBER=0 -r -fo gthread.res gthread.rc
+gthread-2.8s.lib : $(gthread_OBJECTS)
+ lib /out:gthread-2.8s.lib $(gthread_OBJECTS)
+
libgthread-2.0-0.dll : $(gthread_OBJECTS) gthread.def gthread.res
$(CC) $(CFLAGS) -LD -Fe$@ $(gthread_OBJECTS) gthread.res \
..\glib\glib-2.0.lib $(DEPCLIBS) $(LDFLAGS)
/implib:gthread-2.0.lib /def:gthread.def
##################################################################################
All this gets me 4 static libraries (glib-2.8s.lib, gmodule-2.8s.lib,
gobject-2.8s.lib, gthread-2.8s.lib).
However, the end result is that I am trying to compile wvWare, which
ultimately complains with the following errors:
undefined reference to `__imp__g_thread_functions_for_glib_use'
undefined reference to `__imp__g_threads_got_initialized'
(repeated many times)
What could I possibly be doing wrong?
I did notice that inside gthread, gthread-win32.c does NOT get compiled,
only gthread-impl.c. Does this seem right?
imp__g_thread_functions_for_glib_use does not seem to be used in any of
the source files, indeed th eonly text file that does contain it is
"gobject/libgobject-2.0-0.map".
Any and all help is appreciated!!!
-jake
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]