]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/book/chap_install.tex
Replaced /'s with \'s as BCC requires \'s for path names
[wxWidgets.git] / docs / latex / book / chap_install.tex
CommitLineData
397f14ce
JS
1\chapter{Installing wxWindows}\label{chapinstall}
2\pagenumbering{arabic}%
3\setheader{{\it CHAPTER \thechapter: INSTALLING wxWINDOWS}}{}{}{}{}{{\it CHAPTER \thechapter: INSTALLING wxWINDOWS}}%
4\setfooter{\thepage}{}{}{}{}{\thepage}%
5
42b3e73e
JS
6CONTENTS: Installing wxWindows (and what tools to use).
7
8Installing wxWindows isn't too hard. Each platform has a different method, so we'll look
9at each major platform in turn.
10
11\section{Unix: GTK+ and Motif}\label{installunix}
12
13\subsection{The most simple case}
14
15If you are compile wxWindows on Linux for the first time and don't like to read
16install instructions, just do this in the base directory:
17
18\begin{verbatim}
19 ./configure --with-gtk
20 make
21 su <type root password>
22 make install
23 ldconfig
24 exit
25\end{verbatim}
26
27This is using the GTK+ port. If using the Motif port, type --with-motif instead of --with-gtk.
28
29Afterwards you can continue with:
30
31\begin{verbatim}
32 make
33 su <type root password>
34 make install
35 ldconfig
36 exit
37\end{verbatim}
38
39If you want to remove wxWindows on Unix you can do this:
40
41\begin{verbatim}
42 su <type root password>
43 make uninstall
44 ldconfig
45 exit
46\end{verbatim}
47
48\subsection{The expert case}
49
50If you want to do some more serious cross-platform programming with wxWindows,
51such as for GTK and Motif, you can now build two complete libraries and use
52them concurrently. For this end, you have to create a directory for each build
53of wxWindows - you may also want to create different versions of wxWindows
54and test them concurrently. Most typically, this would be a version configured
55with --enable-debug\_flag and one without. Note, that only one build can currently
56be installed, so you'd have to use a local version of the library for that purpose.
57For building three versions (one for GTK+, one for Motif and a debug GTK+ version) you'd do this:
58
59\begin{verbatim}
60 md buildmotif
61 cd buildmotif
62 ../configure --with-motif
63 make
64 cd ..
65
66 md buildgtk
67 cd buildgtk
68 ../configure --with-gtk
69 make
70 cd ..
71
72 md buildgtkd
73 cd buildgtkd
74 ../configure --with-gtk --enable-debug_flag
75 make
76 cd ..
77\end{verbatim}
78
79\subsection{The most simple errors}
80
81\begin{itemize}\itemsep=0pt
82\item Configure reports, that you don't have GTK 1.2 installed although you are
83very sure you have. Well, you have installed it, but you also have another
84version of the GTK installed, which you may need to remove including other
85versions of glib (and its headers). Also, look for the PATH variable and check
86if it includes the path to the correct gtk-config! The check your LDPATH if it
87points to the correct library. There is no way to compile wxGTK if configure
88doesn't pass this test as all this test does is compile and link a GTK program.
89\item You get errors during compilation: The reason is that you probably have a broken
90compiler, which includes almost everything that is called gcc. If you use gcc 2.8
91you have to disable optimsation as the compiler will give up with an internal
92compiler error.You get immediate segfault when starting any sample or application: This is either
93due to having compiled the library with different flags or options than your program -
94typically you might have the __WXDEBUG__ option set for the library but not for your
95program - or due to using a broken compiler (and its optimisation) such as GCC 2.8.
96\end{itemize}
97
98\subsection{The most simple program}
99
100Now create your super-application myfoo.app and compile anywhere with:
101
102\begin{verbatim}
103 gcc myfoo.cpp `wx-config --libs --cflags` -o myfoo
104\end{verbatim}
105
106\wxheading{General}
107
108The Unix variants of wxWindows use GNU configure. If you have problems with your
109make use GNU make instead.
110
111If you have general problems with installation, visit Robert Roebling's homepage at
112
113\begin{verbatim}
114 http://wesley.informatik.uni-freiburg.de/~wxxt
115\end{verbatim}
116
117for the latest information. If you still don't have any success, please send a bug
118report to one of the mailing lists.
119
120\wxheading{Libraries needed}
121
122wxWindows/GTK requires the GTK+ library to be installed on your system. It has to
123be a stable version, preferebly version 1.2.3.
124
125You can get the newest version of the GTK+ from the GTK homepage at:
126
127\begin{verbatim}
128 http://www.gtk.org
129\end{verbatim}
130
131wxWindows/Gtk requires a thread library and X libraries known to work with threads.
132This is the case on all commercial Unix-Variants and all Linux-Versions that are
133based on glibc 2 except RedHat 5.0 which is broken in many aspects. As of writing
134this, these Linux distributions have correct glibc 2 support:
135
136\begin{itemize}\itemsep=0pt
137\item RedHat 5.1
138\item Debian 2.0
139\item Stampede
140\item DLD 6.0
141\item SuSE 6.0
142\end{itemize}
143
144You can disable thread support by running
145
146\begin{verbatim}
147./configure "--disable-threads"
148make
149su <type root password>
150make install
151ldconfig
152exit
153\end{verbatim}
154
155\subsection{Building wxGTK on OS/2}
156
157Please send comments and question about the OS/2 installation
158to Andrea Venturoli <a.ventu@flashnet.it> and patches to
159the wxWindows mailing list.
160
161You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer),
162GTK+ (1.2.5 or newer), emx (0.9d fix 1), flex (2.5.4), yacc (1.8),
163korn shell (5.2.13), Autoconf (2.13), GNU file utilities (3.6),
164GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4),
165sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
166
167Open an OS/2 prompt and switch to the directory above.
168First set some global environment variables we need:
169
170\begin{verbatim}
171 SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
172 SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
173 SET OSTYPE=OS2X
174 SET COMSPEC=sh
175 \end{verbatim}
176
177Notice you can choose whatever you want, if you don't like OS2X.
178
179Now, run autoconf in the main directory and in the samples, demos
180and utils subdirectory. This will generate the OS/2 specific
181versions of the configure scripts. Now run
182
183\begin{verbatim}
184 configure --with-gtk
185\end{verbatim}
186
187as described above.
188
189If you have pthreads library installed, but have a gtk version
190which does not yet support threading, you need to explicitly
191diable threading by using the option --disable-threads.
192
193Note that configure assumes your flex will generate files named
194"lexyy.c", not "lex.yy.c". If you have a version which does
195generate "lex.yy.c", you need to manually change the generated
196makefile.
197
198\subsection{Building wxGTK on SGI}
199
200Using the SGI native compilers, it is recommended that you
201also set CFLAGS and CXXFLAGS before running configure. These
202should be set to:
203
204\begin{verbatim}
205 CFLAGS="-mips3 -n32"
206 CXXFLAGS="-mips3 -n32"
207\end{verbatim}
208
209This is essential if you want to use the resultant binaries
210on any other machine than the one it was compiled on. If you
211have a 64-bit machine (Octane) you should also do this to ensure
212you don't accidently build the libraries as 64bit (which is
213untested).
214
215The SGI native compiler support has only been tested on Irix 6.5.
216
217\subsection{Create your configuration}
218
219Usage:
220
221\begin{verbatim}
222 ./configure options
223\end{verbatim}
224
225If you want to use system's C and C++ compiler,
226set environment variables CC and CCC as
227
228\begin{verbatim}
229 setenv CC cc
230 setenv CCC CC
231 ./configure options
232\end{verbatim}
233
234to see all the options please use:
235
236\begin{verbatim}
237 ./configure --help
238\end{verbatim}
239
240The basic philosophy is that if you want to use different
241configurations, like a debug and a release version,
242or use the same source tree on different systems,
243you have only to change the environment variable OSTYPE.
244(Sadly this variable is not set by default on some systems
245in some shells - on SGI's for example). So you will have to
246set it there. This variable HAS to be set before starting
247configure, so that it knows which system it tries to
248configure for.
249
250Configure (and sometimes make) will complain if the system variable OSTYPE has
251not been defined.
252
253\subsubsection{General options}
254
255Given below are the commands to change the default behaviour,
256i.e. if it says "--disable-threads" it means that threads
257are enabled by default.
258
259Normally, you won't have to choose a toolkit, because when
260you download wxGTK, it will default to --with-gtk etc. But
261if you use all of our CVS repository you have to choose a
262toolkit. You must do this by running configure with either of:
263
264\begin{verbatim}
265 --without-gtk Don't use the GIMP ToolKit (GTK)
266
267 --with-motif Use either Motif or Lesstif
268 Configure will look for both.
269\end{verbatim}
270
271The following options handle the kind of library you want to build.
272
273\begin{verbatim}
274 --disable-threads Compile without thread support.
275
276 --disable-shared Do not create shared libraries.
277
278 --enable-static Create static libraries.
279
280 --disable-optimise Do not optimise the code. Can
281 sometimes be useful for debugging
282 and is required on some architectures
283 such as Sun with gcc 2.8.X which
284 and otherwise produce segvs.
285
286 --enable-profile Add profiling info to the object
287 files. Currently broken, I think.
288
289 --enable-no_rtti Enable compilation without creation of
290 C++ RTTI information in object files.
291 This will speed-up compilation and reduce
292 binary size.
293
294 --enable-no_exceptions Enable compilation without creation of
295 C++ exception information in object files.
296 This will speed-up compilation and reduce
297 binary size. Also fewer crashes during the
298 actual compilation...
299
300 --enable-no_deps Enable compilation without creation of
301 dependency information.
302
303 --enable-permissive Enable compilation without creation of
304 giving erros as soon as you compile with
305 Solaris' ANSI-defying headers.
306
307 --enable-mem_tracing Add built-in memory tracing.
308
309 --enable-dmalloc Use the dmalloc memory debugger.
310 Read more at www.letters.com/dmalloc/
311
312 --enable-debug_info Add debug info to object files and
313 executables for use with debuggers
314 such as gdb (or its many frontends).
315
316 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
317 compiling. This enable wxWindows' very
318 useful internal debugging tricks (such
319 as automatically reporting illegal calls)
320 to work. Note that program and library
321 must be compiled with the same debug
322 options.
323\end{verbatim}
324
325\subsubsection{Feature Options}
326
327When producing an executable that is linked statically with wxGTK
328you'll be surprised at its immense size. This can sometimes be
329drastically reduced by removing features from wxWindows that
330are not used in your program. The most relevant such features
331are
332
333\begin{verbatim}
334 --with-odbc Enables ODBC code. This is disabled
335 by default because iODBC is under the
336 L-GPL license.
337
338 --without-libpng Disables PNG image format code.
339
340 --without-libjpeg Disables JPEG image format code.
341
342 --without-libtiff Disables TIFF image format code.
343
344 --disable-pnm Disables PNM image format code.
345
346 --disable-gif Disables GIF image format code.
347
348 --disable-pcx Disables PCX image format code.
349
350 --disable-resources Disables the use of *.wxr type
351 resources.
352
353 --disable-threads Disables threads. Will also
354 disable sockets.
355
356 --disable-sockets Disables sockets.
357
358 --disable-dnd Disables Drag'n'Drop.
359
360 --disable-clipboard Disables Clipboard.
361
362 --disable-serial Disables object instance serialiasation.
363
364 --disable-streams Disables the wxStream classes.
365
366 --disable-file Disables the wxFile class.
367
368 --disable-textfile Disables the wxTextFile class.
369
370 --disable-intl Disables the internationalisation.
371
372 --disable-validators Disables validators.
373
374 --disable-accel Disables accel.
375\end{verbatim}
376
377Apart from disabling certain features you can very often "strip"
378the program of its debugging information resulting in a significant
379reduction in size.
380
381\subsubsection{Compiling}
382
383The following must be done in the base directory (e.g. ~/wxGTK
384or ~/wxWin or whatever)
385
386Now the makefiles are created (by configure) and you can compile
387the library by typing:
388
389\begin{verbatim}
390 make
391\end{verbatim}
392
393make yourself some coffee, as it will take some time. On an old
394386SX possibly two weeks. During compilation, you'll get a few
395warning messages depending in your compiler.
396
397If you want to be more selective, you can change into a specific
398directiry and type "make" there.
399
400Then you may install the library and it's header files under
401/usr/local/include/wx and /usr/local/lib respectively. You
402have to log in as root (i.e. run "su" and enter the root
403password) and type
404
405\begin{verbatim}
406 make install
407\end{verbatim}
408
409You can remove any traces of wxWindows by typing
410
411\begin{verbatim}
412 make uninstall
413\end{verbatim}
414
415If you want to save disk space by removing unnecessary
416object-files:
417
418\begin{verbatim}
419 make clean
420\end{verbatim}
421
422in the various directories will do the work for you.
423
424\subsubsection{Creating a new Project}
425
4261) The first way uses the installed libraries and header files
427automatically using wx-config
428
429\begin{verbatim}
430gcc myfoo.cpp `wx-config --cflags --libs` -o myfoo
431\end{verbatim}
432
433Using this way, a make file for the minimal sample would look
434like this
435
436\begin{verbatim}
437CC = gcc
438
439minimal: minimal.o
440 $(CC) -o minimal minimal.o `wx-config --libs`
441
442minimal.o: minimal.cpp mondrian.xpm
443 $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
444
445clean:
446 rm -f *.o minimal
447\end{verbatim}
448
449This is certain to become the standard way unless we decide
450to sitch to tmake.
451
4522) The other way creates a project within the source code
453directories of wxWindows. For this endeavour, you'll need
454GNU autoconf version 2.14 and add an entry to your Makefile.in
455to the bottom of the configure.in script and run autoconf
456and configure before you can type make.
457
458\section{Windows}\label{installwindows}
459
460
461\section{Mac}\label{installmac}
462
463We don't have information about Mac installation at this time.
397f14ce 464