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