| 1 |
|
| 2 |
|
| 3 |
Cross Compiling GNUstep for MinGW from Cygwin |
| 4 |
============================================= |
| 5 |
|
| 6 |
If you wish to build on a native MinGW system (recommended), |
| 7 |
please read README.MinGW instead. |
| 8 |
|
| 9 |
MinGW is a collection of header files and import libraries that allow |
| 10 |
one to use GCC and produce native Windows32 programs that do not rely |
| 11 |
on any 3rd-party DLLs. GNUstep has only partially been ported to MinGW |
| 12 |
so expect some problems when trying to compile. Also, there are still |
| 13 |
subtle problems with running GNU tools on Windows, so any problems you |
| 14 |
may encounter may just as easly have to do with the compilation tools |
| 15 |
you are using as with GNUstep. |
| 16 |
|
| 17 |
The base library is not completely ported to run on MinGW yet, but most |
| 18 |
stuff works, including networking/distributed objects. |
| 19 |
Probably background file handle operations (other than networking) and |
| 20 |
advanced parts of NSTask code do not currently work. |
| 21 |
|
| 22 |
Note for compiling with shared libraries (DLLs), it's a good idea to |
| 23 |
remove the libobjc.a that comes with gcc (gcc -v for location) so that |
| 24 |
it isn't accidentally found instead of the libobjc DLL that you will |
| 25 |
compile below. Also note that, despite the statement in the GNUstep-HOWTO, |
| 26 |
even if you have 3.x, you still need to install gnustep-objc as it properly |
| 27 |
exports symbols for DLLs. |
| 28 |
|
| 29 |
Note also that the //c construct for specifying paths with drives has |
| 30 |
been depreciated. You'll need to use /cygwin/path or C: style paths now. |
| 31 |
|
| 32 |
MinGW on Cygwin |
| 33 |
--------------- |
| 34 |
|
| 35 |
Not recommended. This is a cross compilation solution. Using native |
| 36 |
mingw/msys is simpler and less error prone. |
| 37 |
|
| 38 |
Uses the Cygwin tools to help out with the configuration and compilation of |
| 39 |
the libraries. It's always good to get the very latest version of |
| 40 |
Cygwin and MinGW. These instructions were performed |
| 41 |
with Cygwin DLL 1.3.9-1 and MingW gcc 2.95.3-6. If you have more |
| 42 |
experience with MinGW than me, please help improve these instructions! |
| 43 |
|
| 44 |
I assume you have installed Cygwin and MinGW, and dowloaded and |
| 45 |
unpacked the GNUstep packages: |
| 46 |
|
| 47 |
ffcall |
| 48 |
gnustep-make |
| 49 |
gnustep-objc |
| 50 |
gnustep-base |
| 51 |
|
| 52 |
See the GNUstep-HOWTO file for more information on where to get |
| 53 |
various files. You need to build and install each package separately, |
| 54 |
as described below. |
| 55 |
|
| 56 |
1. First, start up a Cygwin BASH shell and make sure the MinGW tools |
| 57 |
are in your path: |
| 58 |
|
| 59 |
export PATH=/c/mingw/bin:$PATH |
| 60 |
|
| 61 |
(Put in whatever path you have for the mingw tools). |
| 62 |
|
| 63 |
NB. Using MinGW-1.1 the header file winsock2.h needed to be slightly |
| 64 |
updated for 2000 or XP. The size of the sa_data field in struct sockaddr |
| 65 |
had to be increased from 14 to 22. If you don't do this before building |
| 66 |
the gnustep base library, the gdomap tool will not correctly determine the |
| 67 |
internet addresses of your machine. |
| 68 |
|
| 69 |
2. Configure and compile gnustep-make. |
| 70 |
The default location for GNUstep on Windows systems in C:/GNUstep. |
| 71 |
To use another location you can use the --prefix argument to configure. |
| 72 |
First, go to the 'gnustep-make' package and configure: |
| 73 |
|
| 74 |
cd gnustep-make |
| 75 |
./configure --target=i386-mingw32 |
| 76 |
|
| 77 |
2a. The configure script may not have recognised that you are running in |
| 78 |
a cygwin environment ... so you may need to edit 'fixpath.sh' to set the |
| 79 |
CYGWIN variable to 'yes' before you build and install the make package. |
| 80 |
|
| 81 |
3. Now build the gnustep-make package. Occationally, the make that comes |
| 82 |
with MinGW doesn't like the way GNUstep makefiles are setup (or perhaps |
| 83 |
it's that MingW make doesn't work with bash), so you can try |
| 84 |
using Cygwin's make instead (/usr/bin/make instead of just make). |
| 85 |
|
| 86 |
make target=i386-mingw32 |
| 87 |
make target=i386-mingw32 install |
| 88 |
|
| 89 |
4. Now source the GNUstep.sh file so the rest of the packages will |
| 90 |
compile correctly: |
| 91 |
|
| 92 |
. C:/GNUstep/System/Library/Makefiles/GNUstep.sh |
| 93 |
|
| 94 |
Also put this command in your shell startup script. Be sure to adjust |
| 95 |
this path to match your real GNUstep root directory if you changed it |
| 96 |
when configuring gnustep-make. |
| 97 |
|
| 98 |
NOTE for WIN98 users: You should also define the environment variables |
| 99 |
HOMEDRIVE and HOMEPATH, since these aren't defined normally. |
| 100 |
|
| 101 |
5. Compile and install the ffcall package (Version 1.8b). It's |
| 102 |
simply a C library so it requires no special tools other than the compiler. |
| 103 |
|
| 104 |
LD=ld RANLIB=touch ./configure --target=i386-mingw32 \ |
| 105 |
--prefix=`$GNUSTEP_MAKEFILES/fixpath.sh -u $GNUSTEP_SYSTEM_ROOT` |
| 106 |
|
| 107 |
which installs the libraries in the GNUstep directory structure (There is |
| 108 |
a script in ffcall-1.8d and higher that automatically configures ffcall |
| 109 |
and installs, called compile-mingw). Then |
| 110 |
|
| 111 |
make # NOTE: Might need to be 'make LN_S=cp' |
| 112 |
make install |
| 113 |
|
| 114 |
6. Now you can compile the Objective-C runtime DLL, gnustep-objc (unless |
| 115 |
you already have one installed): |
| 116 |
|
| 117 |
cd gnustep-objc |
| 118 |
make target=i386-mingw32 shared=yes |
| 119 |
make target=i386-mingw32 shared=yes install |
| 120 |
|
| 121 |
Make sure to remove libobjc.a that comes with gcc, otherwise it will find that |
| 122 |
one instead of the one we want. The libobjc library that comes with gcc-3.x |
| 123 |
MAY work if you add some extra lines to the .def file, but I won't go into |
| 124 |
that here. It's good just to use gnustep-objc. |
| 125 |
|
| 126 |
7. Now we can configure and build the gnustep-base library. |
| 127 |
|
| 128 |
cd gnustep-base |
| 129 |
./configure --target=i386-mingw32 |
| 130 |
make target=i386-mingw32 shared=yes |
| 131 |
make target=i386-mingw32 shared=yes install |
| 132 |
|
| 133 |
If you get tired of typing "target=i386-mingw32" all the time, then before |
| 134 |
you exec the GNUstep.sh script, just set the GNUSTEP_HOST: |
| 135 |
|
| 136 |
export GNUSTEP_HOST=i586-pc-mingw32 |
| 137 |
. $GNUSTEP_SYSTEM_ROOT/Library/Makefiles/GNUstep.sh |
| 138 |
|
| 139 |
Problems? |
| 140 |
--------- |
| 141 |
|
| 142 |
[1] It's really important that all the libraries you link with GNUstep be |
| 143 |
shared libraries. Even static libraries based on C (e.g. libtiff) will |
| 144 |
prevent Objective-C modules from being loaded in Objective-C libraries. |
| 145 |
|
| 146 |
[2] On Windows XP, at least, there are sometimes spaces in the path to the |
| 147 |
user directory. The make program cannot deal with this. |
| 148 |
Probably the best solution is to add a .GNUsteprc file in your home |
| 149 |
directory with a line of the form - |
| 150 |
GNUSTEP_USER_ROOT=/home/myname |
| 151 |
setting your personal GNUstep root directory to be '/home/myname' ... |
| 152 |
some path which does not contain spaces. |
| 153 |
|
| 154 |
[3] Some users report needing to make gnustep libs like this (perhaps |
| 155 |
when using Cygwin's gcc only): |
| 156 |
|
| 157 |
export CC="gcc" |
| 158 |
export CFLAGS="-mno-cygwin" |
| 159 |
export CPPFLAGS="-mno-cygwin" |
| 160 |
find . -name "*.lnk" -print -exec rm {} \; |
| 161 |
make target=i386-mingw32 shared=yes LN_S="ln -s" \ |
| 162 |
SHARED_LD_PREFLAGS="--driver-flags=\"-mno-cygwin -mdll -Wl,--enable-stdcall-fixup\" --target=i386-mingw32 --export-all-symbols" |
| 163 |
|
| 164 |
[4] Compiling iconv (1.8): |
| 165 |
|
| 166 |
(the part with the most problems - maybe you download it precompiled |
| 167 |
but if you want to compile it - here is the guide) Make sure you are |
| 168 |
compiling from a mapped drive (eg. d:) not from an UNC Path!!!! |
| 169 |
|
| 170 |
./configure --target=i386-mingw32 --host=i386-mingw32 (ignore warnings here) |
| 171 |
edit libtool and libcharset/libtool so that the CC variable reads |
| 172 |
"gcc -mno-cygwin -mdll" |
| 173 |
make |
| 174 |
(After a while make breaks with an error in linking) |
| 175 |
find . -name "*.lnk" -print -exec rm {} \; |
| 176 |
make |
| 177 |
(make breaks now in the src folder, but the DLL is already buildt, |
| 178 |
that is what we need) |
| 179 |
cp include/iconv.h $GNUSTEP_SYSTEM_ROOT/Headers |
| 180 |
cp lib/.libs/libiconv-2.dll $GNUSTEP_SYSTEM_ROOT/Tools/libiconv-2.dll |
| 181 |
cp lib/.libs/libiconv.dll.a $GNUSTEP_SYSTEM_ROOT/Libraries/libiconv.a |
| 182 |
|
| 183 |
Good Sites for Pre-Compiled Binaries |
| 184 |
------------------------------------ |
| 185 |
|
| 186 |
Many libraries, etc from: |
| 187 |
|
| 188 |
<http://sourceforge.net/project/showfiles.php?group_id=7382> |
| 189 |
<http://penguin.at0.net/~fredo/files/old/> (for libxml2, more?) |
| 190 |
<http://sourceforge.net/project/showfiles.php?group_id=23617> (libtiff) |
| 191 |
|
| 192 |
MingW guile from |
| 193 |
|
| 194 |
<http://www.textsure.net/~ela/devel.html>. |
| 195 |
|
| 196 |
also need guile from |
| 197 |
|
| 198 |
<http://sourceforge.net/project/showfiles.php?group_id=7382> |
| 199 |
|
| 200 |
for guile-config file. |
| 201 |
|
| 202 |
Author |
| 203 |
------ |
| 204 |
|
| 205 |
Adam Fedor <[email protected]> |