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