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