]> git.saurik.com Git - wxWidgets.git/blob - docs/gtk/install.txt
Typo
[wxWidgets.git] / docs / gtk / install.txt
1 wxWidgets 2.6 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 wxWidgets you are
13 using (including the beta) and what compiler on what system. One
14 example: wxGTK 2.6.0, gcc 2.95.4, Redhat 6.2
15
16 * The simplest case
17 -------------------
18
19 If you compile wxWidgets on Linux for the first time and don't like to read
20 install instructions just do (in the base dir):
21
22 > mkdir buildgtk
23 > cd buildgtk
24 > ../configure --with-gtk
25 > make
26 > su <type root password>
27 > make install
28 > ldconfig
29 > exit
30
31 Afterwards you can continue with:
32
33 > make
34 > su <type root password>
35 > make install
36 > ldconfig
37 > exit
38
39 (If you don't do the 'make install' part, you can still
40 use the libraries from the buildgtk directory, but they
41 will not be available to other users.)
42
43 If you want to remove wxWidgets on Unix you can do this:
44
45 > su <type root password>
46 > make uninstall
47 > ldconfig
48 > exit
49
50 Note that by default, GTK+ 2 is used. GTK+ 1 can be specified
51 with --with-gtk1.
52
53 * The expert case
54 -----------------
55
56 If you want to do some more serious cross-platform programming with wxWidgets,
57 such as for GTK+ and Motif, you can now build two complete libraries and use
58 them concurrently. To do this, create a separate directory for each build
59 of wxWidgets - you may also want to create different versions of wxWidgets
60 and test them concurrently. Most typically, this would be a version configured
61 with --enable-debug and one without. Note, that only one build can
62 currently be installed with 'make install', so you'd have to use local version of
63 the library for that purpose.
64
65 For building three versions (one GTK+, one Motif and a debug version of the GTK
66 source) you'd do this:
67
68 md buildmotif
69 cd buildmotif
70 ../configure --with-motif
71 make
72 cd ..
73
74 md buildgtk
75 cd buildgtk
76 ../configure --with-gtk
77 make
78 cd ..
79
80 md buildgtkd
81 cd buildgtkd
82 ../configure --with-gtk --enable-debug
83 make
84 cd ..
85
86 * The simplest errors
87 ---------------------
88
89 For any configure errors: please look at config.log file which was generated
90 during configure run, it usually contains some useful information.
91
92 configure reports, that you don't have GTK+ 1.2 installed although you are
93 very sure you have. Well, you have installed it, but you also have another
94 version of the GTK+ installed, which you may need to remove including other
95 versions of glib (and its headers). Or maybe you installed it in non default
96 location and configure can't find it there, so please check that your PATH
97 variable includes the path to the correct gtk-config. Also check that your
98 LD_LIBRARY_PATH or equivalent variable contains the path to GTK+ libraries if
99 they were installed in a non default location.
100
101 You get errors from make: please use GNU make instead of the native make
102 program. Currently wxWidgets can be built only with GNU make, BSD make and
103 Solaris make. Other versions might work or not (any which don't have VPATH
104 support definitely won't).
105
106 You get errors during compilation: The reason is that you probably have a
107 broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause
108 problems due to incomplete support for C++ and optimisation bugs. Best to use
109 GCC 2.95 or later.
110
111 You get immediate segfault when starting any sample or application: This is
112 either due to having compiled the library with different flags or options than
113 your program - typically you might have the __WXDEBUG__ option set for the
114 library but not for your program - or due to using a compiler with optimisation
115 bugs.
116
117 Linker complains about missing PROIO_yy_flex_alloc and similar symbols: you
118 probably have an old version of flex, 2.5.4 is recommended.
119
120 * The simplest program
121 ----------------------
122
123 Now create your super-application myfoo.cpp and compile anywhere with
124
125 g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
126
127 * GUI libraries
128 ---------------
129
130 wxWidgets/GTK+ requires the GTK+ library to be installed on your system. It has
131 to be a stable version, preferably version 1.2.10 (at least 1.2.3 is required,
132 1.2.7 is strongly recommended).
133
134 You can get the newest version of the GTK+ from the GTK+ homepage at:
135
136 http://www.gtk.org
137
138 We also mirror GTK+ at my ftp site. You'll find information about downloading
139 at my homepage.
140
141 * Additional libraries
142 ----------------------
143
144 wxWidgets/Gtk requires a thread library and X libraries known to work with
145 threads. This is the case on all commercial Unix-Variants and all
146 Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in
147 many aspects. As of writing this, virtually all Linux distributions have
148 correct glibc 2 support.
149
150 You can disable thread support by running
151
152 ./configure --disable-threads
153 make
154 su <type root password>
155 make install
156 ldconfig
157 exit
158
159 * Building wxGTK on OS/2
160 ------------------------
161
162 Please send comments and question about the OS/2 installation
163 to Stefan Neis <Stefan.Neis@t-online.de> and patches to
164 the wxWidgets mailing list.
165
166 In the following list, the version numbers indicate the configuration that
167 was actually used by myself, newer version should cause no problems and
168 even older ones are expected to work most of the time.
169
170 You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer),
171 GTK+ (1.2.5 or newer), emx (0.9d fix 4), flex (2.5.4), yacc (1.8) or
172 bison (1.25), a Unix like shell (pdksh-5.2.14 or ash), Autoconf (2.57),
173 GNU file utilities (3.13), GNU text utilities (1.19),
174 GNU shell utilites (1.12), m4 (1.4), sed (2.05), grep (2.0), Awk (3.0.3),
175 GNU Make (3.75).
176
177 Preferably, you should have Posix/2 installed and C(PLUS)_INCLUDE_PATH and
178 LIBRARY_PATH set up accordingly, however, wxGTK will even work without it.
179 Presence of Posix/2 will be auto-detected.
180
181 Open an OS/2 prompt and switch to the directory above.
182 Set MAKESHELL (and depending on your installation also INSTALL, for me
183 it tends to try to use the system's tcpip\pcomos\install.exe which causes
184 problems...) to a Unix like shell, e.g.
185 SET MAKESHELL=ash
186
187 Be warned that depending on the precise version of your make, the
188 variable that needs to be set might be MAKE_SHELL instead of MAKESHELL.
189 If you have a really deficient version of GNU make, it might even be
190 necessary to set SHELL or even COMSPEC to a unix like shell as well.
191
192 Notice that the delivered configure scripts are fully OS/2 aware, so you
193 can simply run
194 ash -c "configure --with-gtk"
195 and make and possibly make install as described above.
196
197 * Building wxGTK on SGI
198 -----------------------
199
200 Using the SGI native compilers, it is recommended that you
201 also set CFLAGS and CXXFLAGS before running configure. These
202 should be set to :
203
204 CFLAGS="-mips3 -n32"
205 CXXFLAGS="-mips3 -n32"
206
207 This is essential if you want to use the resultant binaries
208 on any other machine than the one it was compiled on. If you
209 have a 64bit machine (Octane) you should also do this to ensure
210 you don't accidently build the libraries as 64bit (which is
211 untested).
212
213 The SGI native compiler support has only been tested on Irix 6.5.
214
215 * Create your configuration
216 ---------------------------
217
218 Usage:
219 ./configure options
220
221 If you want to use system's C and C++ compiler,
222 set environment variables CC and CCC as
223
224 % setenv CC cc
225 % setenv CXX CC
226 % ./configure [options]
227
228 to see all the options please use:
229
230 ./configure --help
231
232 It is recommended to build wxWidgets in another directory (maybe a
233 subdirectory of your wxWidgets installation) as this allows you to
234 have multiple configurations (for example, debug and release or GTK
235 and Motif) simultaneously.
236
237
238 * General options
239 -----------------
240
241 Given below are the commands to change the default behaviour,
242 i.e. if it says "--disable-threads" it means that threads
243 are enabled by default.
244
245 Normally, you won't have to choose a toolkit, because when
246 you download wxGTK, it will default to --with-gtk etc. But
247 if you use all of our CVS repository you have to choose a
248 toolkit. You must do this by running configure with either of:
249
250 --with-gtk Use the GIMP ToolKit (GTK+). Default.
251 --with-gtk2 Use the GTK+ 2.0. Default.
252 --with-gtk1 Use the GTK+ 1.2. Default.
253 --with-motif Use either Motif or Lesstif
254 Configure will look for both.
255
256 The following options handle the kind of library you want to build.
257
258 --disable-threads Compile without thread support.
259
260 --disable-shared Do not create shared libraries, but
261 build static libraries instead.
262
263 --enable-monolithic Build wxWidgets as single library instead
264 of as several smaller libraries (which is
265 the default since wxWidgets 2.5.0).
266
267 --disable-optimise Do not optimise the code. Can
268 sometimes be useful for debugging
269 and is required on some architectures
270 such as Sun with gcc 2.8.X which
271 would otherwise produce segvs.
272
273 --enable-unicode Enable Unicode support. Default for GTK+2.0
274
275 --enable-profile Add profiling info to the object
276 files. Currently broken, I think.
277
278 --enable-no_rtti Enable compilation without creation of
279 C++ RTTI information in object files.
280 This will speed-up compilation and reduce
281 binary size.
282
283 --enable-no_exceptions Enable compilation without creation of
284 C++ exception information in object files.
285 This will speed-up compilation and reduce
286 binary size. Also fewer crashes during the
287 actual compilation...
288
289 --enable-no_deps Enable compilation without creation of
290 dependency information.
291
292 --enable-permissive Enable compilation without checking for strict
293 ANSI conformance. Useful to prevent the build
294 dying with errors as soon as you compile with
295 Solaris' ANSI-defying headers.
296
297 --enable-mem_tracing Add built-in memory tracing.
298
299 --enable-dmalloc Use the dmalloc memory debugger.
300 Read more at www.letters.com/dmalloc/
301
302 --enable-debug_info Add debug info to object files and
303 executables for use with debuggers
304 such as gdb (or its many frontends).
305
306 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
307 compiling. This enable wxWidgets' very
308 useful internal debugging tricks (such
309 as automatically reporting illegal calls)
310 to work. Note that program and library
311 must be compiled with the same debug
312 options.
313
314 --enable-debug Same as --enable-debug_info and
315 --enable-debug_flag together. Unless you have
316 some very specific needs, you should use this
317 option instead of --enable-debug_info/flag ones
318 separately.
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 wxWidgets 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 wxWidgets 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 --without-expat Disable XML classes based on Expat parser.
341
342 --disable-pnm Disables PNM image format code.
343
344 --disable-gif Disables GIF image format code.
345
346 --disable-pcx Disables PCX image format code.
347
348 --disable-iff Disables IFF image format code.
349
350 --disable-resources Disables the use of *.wxr type resources.
351
352 --disable-threads Disables threads. Will also disable sockets.
353
354 --disable-sockets Disables sockets.
355
356 --disable-dnd Disables Drag'n'Drop.
357
358 --disable-clipboard Disables Clipboard.
359
360 --disable-serial Disables object instance serialisation.
361
362 --disable-streams Disables the wxStream classes.
363
364 --disable-file Disables the wxFile class.
365
366 --disable-textfile Disables the wxTextFile class.
367
368 --disable-intl Disables the internationalisation.
369
370 --disable-validators Disables validators.
371
372 --disable-accel Disables accelerators support.
373
374 Apart from disabling certain features you can very often "strip"
375 the program of its debugging information resulting in a significant
376 reduction in size.
377
378 Please see the output of "./configure --help" for comprehensive list
379 of all configurable options.
380
381
382 * Compiling
383 -----------
384
385 The following must be done in the base directory (e.g. ~/wxGTK
386 or ~/wxWin or whatever)
387
388 Now the makefiles are created (by configure) and you can compile
389 the library by typing:
390
391 make
392
393 make yourself some coffee, as it will take some time. On an old
394 386SX possibly two weeks. During compilation, you'll get a few
395 warning messages depending in your compiler.
396
397 If you want to be more selective, you can change into a specific
398 directory and type "make" there.
399
400 Then you may install the library and its header files under
401 /usr/local/include/wx and /usr/local/lib respectively. You
402 have to log in as root (i.e. run "su" and enter the root
403 password) and type
404
405 make install
406
407 You can remove any traces of wxWidgets by typing
408
409 make uninstall
410
411 If you want to save disk space by removing unnecessary
412 object-files:
413
414 make clean
415
416 in the various directories will do the work for you.
417
418 * Creating a new Project
419 --------------------------
420
421 1) The first way uses the installed libraries and header files
422 automatically using wx-config
423
424 g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo
425
426 Using this way, a make file for the minimal sample would look
427 like this
428
429 CC = gcc
430
431 minimal: minimal.o
432 $(CC) -o minimal minimal.o `wx-config --libs`
433
434 minimal.o: minimal.cpp mondrian.xpm
435 $(CC) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
436
437 clean:
438 rm -f *.o minimal
439
440 If your application uses only some of wxWidgets libraries, you can
441 specify required libraries when running wx-config. For example,
442 `wx-config --libs=html,core` will only output link command to link
443 with libraries required by core GUI classes and wxHTML classes. See
444 the manual for more information on the libraries.
445
446 2) The other way creates a project within the source code
447 directories of wxWidgets. For this endeavour, you'll need
448 GNU autoconf version 2.14 and add an entry to your Makefile.in
449 to the bottom of the configure.in script and run autoconf
450 and configure before you can type make.
451
452 ----------------------
453
454 In the hope that it will be useful,
455
456 Robert Roebling
457