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