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