Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> Guide to Compiling MiniGTK
Daemon404
Posted: May 27, 2005 12:34 am
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



This guide will tell you how to compie MiniGTK as a static library and a shared DLL.

This was done with MS Visual C++ .NET 2003. I have not tried ti with anythign else.

What you need:

MinGW - Get it .
MS Visual C++ (edit by Pu7o: You can also use the delicious MSVC++ Toolkit, available . If you do, you should unzip archive on the toolkit's installation directory.)
MiniGTK Source Code - Get it .
libiconv 1.9.2 Source Code - Get it .
Cygwin - Get it .

How:

First of all, extract glibgtkpango244.tar.bz2 with WinRAR or some other archiving utility. Also, extract libiconv-1.9.2.tar.gz to the same directory.

Open a Visual Studio Command Prompt windows and cd to the directory where you extracted everything. Now, you have to set the PATH to you cygwin and mingw bin directories.

For Example:
CODE
SET PATH=C:\MinGW\bin;C:\Cygwin\bin;%PATH%


The %PATH% is very important.

Now, cd to gtk\gtk. run nmake -f makefile.msc. Let it do its thing until it finishes. The LIB file will automatically be moved to the directory where you extracted everything.

Next, cd to ..\gdk\win32 and run nmake -f makefile.msc. Now, cd to .. and run nmake -f makefile.msc. Once its done, ti will automatically move teh LIB fiel to teh same directory as the gtk lib.

Now, copy libiconv-1.9.2\include\iconv.h.msvc-static to glib\glib and rename it to iconv.h.

cd to the directory where you extracted everything. Then, cd to glib/glib. Run nmake -f makefile.msc. It will eventualyl fail, and complain about iconv.lib. Ignore this. cd to gnulib. Run nmake -f makefile.msc. Now cd to .. and run nmake -f makefile.msc glib-2.2s.lib. Copy glib-2.2s.lib to the same directory as teh otehr libs you built.

Now, cd to ../gobject and run nmake -f makefile.msc. It will quickly fail and give you anotehr iconv.lib thing. Ignore it. Now run nmake -f makefile.msc gobject-2.2s.lib. Copy the lib to folder where you have all of the rest of the libs.

Next, cd to ../gmodule. Run nmake -f makefile.msc. It will fail and complain about glib. Ignore this. Run link -lib /out:gmodule-2.2s.lib gmodule.obj. Copy the lib to the place with teh rest fo the libs you built.

cd to ..\build\win32\dirent. Run nmake -f makefile.msc. Copy the lib to the place with the rest fo the libs you built.

cd back to the directory where you extracted everything. Now, cd to gtk\gdk-pixbuf. Run nmake -f makefile.msc. It will eventually fail and complain abotu glib. Ignore it. Run nmake -f makefile.msc gdk_pixbuf-2.2s.lib. Copy the lib to teh same directory as teh rest.

cd back to the directory where you extracted everything. Now, cd to pango\pango and re-type "nmake -f makefile.msc". It will fail and complain about glib. Ignore it. The libs you need have already been build before the error occurred. Copy both libs to the directory with teh rest of them.

cd back to the directory where you extracted everything. Now, cd to libiconv-1.9.2.
Run:
CODE
sh configure --disable-shared --enable-static


Run make. Then, cd to lib\.libs and run teh following:

CODE
ar vx libiconv.a
link -lib /out:iconv.lib *.o


Copy the newly create lib file to teh same directory as the rest.

cd back to teh directory with all teh libs you built. In this directory, create a file called empty.c and put this in it:

CODE
errno(){return 0;}
_alloca(){return 0;}


then run

CODE
gcc -c empty.c
lib -out:empty.lib empty.o
.

Now, edit makefile.msc so it looks like this:

CODE
OBJ = gobject-2.2s.lib gmodule-2.2s.lib glib-2.2s.lib  \
 gdk-win32-2.2s.lib gdk_pixbuf-2.2s.lib \
 pango-0.24s.lib pangowin32-0.24s.lib \
 gtk-win32-2.2s.lib dirent.lib empty.lib /nodefaultlib:libc.lib
LIBS = iconv.lib
SYSLIB = gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib comdlg32.lib winmm.lib ws2_32.lib

all:
link /LTCG $(OBJ) /DLL /OUT:minigtk.dll /SUBSYSTEM:Windows $(LIBS) $(SYSLIB) /DEF:minigtk.def
ls -l minigtk.dll
static:
link -lib $(OBJ) /OUT:minigtk-static.lib $(LIBS) $(SYSLIB)


Next, edit minigtk.def and remove the following from it

CODE
textdomain
gettext
bind_textdomain_codeset
bindtextdomain


To create minigtk.dll, run nmake -f makefile.msc.

To make the static library run nmake -f makefile.msc static. Ignore the warnings.

To link it to xchat, use Pu7os guide.

If there are any errors in this guide, please post them.

EDIT by Pu7o: MinGW should be in the path first, not cygwin.

EDIT by Daemon404 : I have gotten gettext to work as a shared library. Do This with cygwin, mingw, and msvc in your path:

Get the source code for gettext-0.10.40 (Must be that specific version) and extract it.

cd to the directory and run sh configure --disable-shared --enable-static and then run make. Find teh newly create libintl.a and cd to intl\.libs and create a fiel named gettext.def with thsio in it:

CODE
EXPORTS
textdomain
gettext
bind_textdomain_codeset
bindtextdomain


Then run:

CODE
dllwrap --def gettext.def --dllname minintl.dll libintl.a


Refer to pu7o's guide abotu linkign to minigtk to fidn otu hwo to get gettext.lib out of intl.dll using exports.sed. Then all you have to to is add gettext.lib to the LIBS=... line of makefile.msc and have it in the same dir as minigtk-static.lib, etc.

Edit by Pu7o: Changed "intl.dll" to "minintl.dll" for the following reason:

Intl.dll is the name used by the full gettext library. Using intl.dll for this "miniature-version" of libintl could cause compatibility problems with other programs which might use gettext.


Edit by Daemon404 (Again): I have been able to statically link my minint to xchat using teh great program DLL to Lib by Binary-Soft. :-)

Edit by Pu7o: Added part about visual c++ toolkit, with the archive zip file. The archive.zip file is based on by boing with some extra needed files from the platform SDK. (a few .h files and comdlg32.lib)

Edit by Pu7o: Changed links to reflect the new MiniGTK.

Edit by Daemon404. It is also possible to compile MiniGTK with MSVC 6.0. I just did it. You need to add /Zm1000 to the command line arguments in makefile.msc in glib\glib

This post has been edited by Daemon404 on June 24, 2005 01:02 am
PMEmail Poster
Top
Pu7o
Posted: May 27, 2005 06:46 am
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



neat, thanks for the guide! smile.gif
PMEmail Poster
Top
Pu7o
Posted: May 27, 2005 02:58 pm
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



if anyone knows a better way of getting the errno and _alloca symbols to work, please post here, as the described way is bound to break something
PMEmail Poster
Top
Daemon404
Posted: May 27, 2005 09:15 pm
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



Yeah, if i compile gettext-0.10.40 and link ti with teh _alloca trick, it works but then after i link it to xchat, I run xchat.exe and it crashes on startup, doesnt even show the server list.
PMEmail Poster
Top
Daemon404
Posted: May 28, 2005 06:15 pm
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



Ok, i have gotten gettext to work with a special build of intl.dll, and ill update thsi guide in a sec. Sucks though that it cant be statically linked.
PMEmail Poster
Top
Pu7o
Posted: May 31, 2005 07:59 pm
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



you don't need dll to lib to use a static intl.lib, you can use gettext 0.13 and it will work (i tried it). Also, with gettext 0.13 you won't even need to fake an _alloca symbol smile.gif
PMEmail Poster
Top
Daemon404
Posted: May 31, 2005 09:15 pm
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



still need to for iconv though.
PMEmail Poster
Top
Pu7o
Posted: May 31, 2005 10:59 pm
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



why don't you use the MSVC build system for iconv?

(i.e. nmake -f makefile.msvc MFLAGS=-MD NO_NLS=1)
PMEmail Poster
Top
Pu7o
Posted: May 31, 2005 11:04 pm
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



here's how you can define _alloca correctly:

in the libiconv source, there's an alloca.c file. Compile it and create an alloca.lib file, and link to it. simple as that smile.gif [note: this is still untested]
PMEmail Poster
Top
Daemon404
Posted: June 01, 2005 02:04 am
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



i liek using teh bare minimum for everything, my xchat.exe is only 3.04 MB and is linked to verythign it needs. MinGW helps create smaller files.
PMEmail Poster
Top
Pu7o
Posted: June 01, 2005 01:20 pm
Quote Post


Administrator
***

Group: Admin
Posts: 40
Member No.: 1
Joined: May 14, 2005



ok, the alloca.c file didn't work, but now i found where mingw has its alloca implementation, which we can use on msvc. on /mingw/lib/gcc-lib/mingw32/3.2.3/libgcc.a

(yes, even though it's a gcc library, it will work for msvc if converted to .lib and will provide a working _alloca implementation)
PMEmail Poster
Top
Daemon404
Posted: June 02, 2005 02:02 am
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



You dont even need libgcc.a anymore, because evrything is built with MSVC (With the exception of my minintl.lib and minintl.dll)
PMEmail Poster
Top
Daemon404
Posted: June 24, 2005 01:02 am
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



It is also possible to compile MiniGTK with MSVC 6.0. I just did it. You need to add /Zm1000 to the command line arguments in makefile.msc in glib\glib
PMEmail Poster
Top
MasterC
  Posted: June 29, 2005 04:52 pm
Quote Post


Unregistered









Hi,

I get the fallowing error, while doing the first nmake -f makefile.msc:

CODE
[...]X-Chat Build\gtk\gtk>nmake -f makefile.msc

Microsoft (R) Program Maintenance Utility Version 7.10.2240.8
Copyright (C) Microsoft Corporation.  All rights reserved.

       cl -G5 -GF -MD -W3 -nologo /GL -O1  -FImsvc_recommended_pragmas.h -I . -
I .. -I ../gdk -I ../gdk-pixbuf -I../../../include  -DGTK_DISABLE_COMPAT_H -DG_L
OG_DOMAIN=\"Gtk\" -Dnear=xxnear  -DPANGO_ENABLE_BACKEND  -DGTK_VERSION=\"2.2\" -
DGTK_BINARY_VERSION=\"2.2.200\"  -DGTK_HOST=\"win32\" -DG_DISABLE_CAST_CHECKS  -
DGTK_LOCALEDIR=\"./locale\" -I ..\../pango -I ..\..\glib -I ..\..\glib\glib -I .
.\..\glib\gmodule -I ..\../gettext-0.10.40/intl -I ..\../libiconv-1.8\include  -
I ..\../gettext-0.10.40/intl -I ..\../atk -c -DGTK_COMPILATION -DG_LOG_DOMAIN=\"
Gtk\" imcyrillic-translit.c
imcyrillic-translit.c
imcyrillic-translit.c(23) : fatal error C1083: Cannot open include file: 'string
.h': No such file or directory
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.


What should I do?

kind regards
Chris
Top
Daemon404
Posted: June 30, 2005 03:19 am
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



make sure that the LIBS dir is defined. are you running the shortcut called: Visual Studio .NET 2003 Command Prompt. Because that should work. with no defiend of anything besides whats in the guide in the PATH. I know this works, i have doen this on 3 systems, and i evenn compiled it on windows 98 with visual c++ 6. i don't knwo what the issue could be.
PMEmail Poster
Top
TomB
Posted: July 25, 2005 11:20 pm
Quote Post


Unregistered









CODE
C:\Stuff>nmake -f makefile.msc

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

       link /ltcg gobject-2.2s.lib gmodule-2.2s.lib glib-2.2s.lib   gdk-win32-
.2s.lib gdk_pixbuf-2.2s.lib  pango-0.24s.lib pangowin32-0.24s.lib  gtk-win32-2.
s.lib dirent.lib empty.lib /nodefaultlib:libc.lib  /out:minigtk.dll /subsystem:
indows iconv.lib gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.
ib comdlg32.lib winmm.lib ws2_32.lib /def:minigtk.def
link: extra operand `gmodule-2.2s.lib'
Try `link --help' for more information.
NMAKE : fatal error U1077: 'link' : return code '0x1'
Stop.


I get this error
Top
Guest
Posted: July 26, 2005 12:57 am
Quote Post


Unregistered









the dynamic minigtk doesn't work very well. Try the static one.
Top
Daemon404
Posted: July 26, 2005 03:55 pm
Quote Post


Unofficial X-Chat Builder
**

Group: XCCE Project Testers
Posts: 20
Member No.: 2
Joined: May 26, 2005



The dynamic one works fine as long as you add teh extra symbols you need.
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll