]> git.saurik.com Git - wxWidgets.git/blame - docs/gtk/install.txt
Implemented wxToggleButton under Motif.
[wxWidgets.git] / docs / gtk / install.txt
CommitLineData
42280e48 1wxWindows 2.4 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
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
42280e48 14 example: wxGTK 2.4.0, gcc 2.95.4, Redhat 6.2
b55a176b
JS
15
16* The simplest case
17-------------------
c98f0421 18
2e1e7f9d 19If you compile wxWindows 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
8e1e6fac
RR
37If you want to remove wxWindows on Unix you can do this:
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
42280e48 47wxGTK 2.4.0 has support for the new version 2.0.X of GTK+. This means
0dd6e08c
RR
48that wxGTK apps can now make use Unicode as the underlying encoding
49for all text operations. This is a very fundamental change and will
50need time to stabilize, so be careful. Anyways, after installing a
51recent version of GTK+ 2.0, do this
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
2e1e7f9d
VZ
71If you want to do some more serious cross-platform programming with wxWindows,
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
91b8de8d 74of wxWindows - you may also want to create different versions of wxWindows
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
117program. Currently wxWindows can be built only with GNU make, BSD make and
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
b55a176b
JS
145The Unix variants of wxWindows use GNU configure. If you have problems with
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
2e1e7f9d 161wxWindows/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
b55a176b
JS
175wxWindows/Gtk requires a thread library and X libraries known to work with
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
178many aspects. As of writing this, these Linux distributions have correct glibc
1792 support:
58614078
RR
180
181 - RedHat 5.1
b55a176b 182 - Debian 2.0 and 3.0
58614078 183 - Stampede
4f22cf8d 184 - DLD 6.0
cffee23b 185 - SuSE 6.0
58614078 186
2e1e7f9d
VZ
187You can disable thread support by running
188
189./configure --disable-threads
58614078 190make
034be888 191su <type root password>
8710cf5c 192make install
034be888
RR
193ldconfig
194exit
2e1e7f9d 195
91b8de8d 196* Building wxGTK on OS/2
b55a176b 197------------------------
c98f0421 198
91b8de8d
RR
199Please send comments and question about the OS/2 installation
200to Andrea Venturoli <a.ventu@flashnet.it> and patches to
510fc784 201the wxWindows mailing list.
c98f0421 202
2e1e7f9d
VZ
203You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer),
204GTK+ (1.2.5 or newer), emx (0.9d fix 1), flex (2.5.4), yacc (1.8),
205korn shell (5.2.13), Autoconf (2.13), GNU file utilities (3.6),
206GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4),
91b8de8d 207sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
c98f0421 208
91b8de8d
RR
209Open an OS/2 prompt and switch to the directory above.
210First set some global environment variables we need:
211
212SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
9f2d09aa 213SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
2e1e7f9d 214SET OSTYPE=OS2X
91b8de8d
RR
215SET COMSPEC=sh
216
217Notice you can choose whatever you want, if you don't like OS2X.
218
ea0dbf30
SN
219Now, run autoconf in the main directory and in the samples, demos
220and utils subdirectory. This will generate the OS/2 specific
221versions of the configure scripts. Now run
222 configure --with-gtk
223as described above.
224
225If you have pthreads library installed, but have a gtk version
226which does not yet support threading, you need to explicitly
2edb0bde 227disable threading by using the option --disable-threads.
ea0dbf30
SN
228
229Note that configure assumes your flex will generate files named
230"lexyy.c", not "lex.yy.c". If you have a version which does
231generate "lex.yy.c", you need to manually change the generated
232makefile.
9f2d09aa 233
91b8de8d 234* Building wxGTK on SGI
b55a176b 235-----------------------
c98f0421
RR
236
237Using the SGI native compilers, it is recommended that you
2e1e7f9d 238also set CFLAGS and CXXFLAGS before running configure. These
c98f0421
RR
239should be set to :
240
2e1e7f9d 241CFLAGS="-mips3 -n32"
c98f0421
RR
242CXXFLAGS="-mips3 -n32"
243
2e1e7f9d
VZ
244This is essential if you want to use the resultant binaries
245on any other machine than the one it was compiled on. If you
246have a 64bit machine (Octane) you should also do this to ensure
247you don't accidently build the libraries as 64bit (which is
c98f0421
RR
248untested).
249
250The SGI native compiler support has only been tested on Irix 6.5.
251
91b8de8d 252* Create your configuration
b55a176b 253---------------------------
91b8de8d
RR
254
255Usage:
2e1e7f9d 256 ./configure options
91b8de8d
RR
257
258If you want to use system's C and C++ compiler,
259set environment variables CC and CCC as
260
2e1e7f9d 261 % setenv CC cc
b55a176b
JS
262 % setenv CXX CC
263 % ./configure [options]
91b8de8d 264
c98f0421
RR
265to see all the options please use:
266
2e1e7f9d 267 ./configure --help
c98f0421 268
2e1e7f9d
VZ
269It is recommended to build wxWindows in another directory (maybe a
270subdirectory of your wxWindows installation) as this allows you to
271have multiple configurations (for example, debug and release or GTK
272and Motif) simultaneously.
c98f0421
RR
273
274
275* General options
b55a176b 276-----------------
c98f0421 277
77c85c2b
RR
278Given below are the commands to change the default behaviour,
279i.e. if it says "--disable-threads" it means that threads
280are enabled by default.
281
cf7a7e13
RR
282Normally, you won't have to choose a toolkit, because when
283you download wxGTK, it will default to --with-gtk etc. But
2e1e7f9d 284if you use all of our CVS repository you have to choose a
cf7a7e13 285toolkit. You must do this by running configure with either of:
c98f0421 286
4b6b4dfc 287 --with-gtk Use the GIMP ToolKit (GTK). Default.
2e1e7f9d
VZ
288
289 --with-motif Use either Motif or Lesstif
290 Configure will look for both.
c98f0421
RR
291
292The following options handle the kind of library you want to build.
293
2e1e7f9d 294 --disable-threads Compile without thread support.
c98f0421 295
2e1e7f9d 296 --disable-shared Do not create shared libraries, but
4b6b4dfc 297 build static libraries instead.
bbeb6c2b 298
2e1e7f9d
VZ
299 --disable-optimise Do not optimise the code. Can
300 sometimes be useful for debugging
4b6b4dfc
RR
301 and is required on some architectures
302 such as Sun with gcc 2.8.X which
303 would otherwise produce segvs.
c98f0421 304
2e1e7f9d
VZ
305 --enable-profile Add profiling info to the object
306 files. Currently broken, I think.
307
308 --enable-no_rtti Enable compilation without creation of
309 C++ RTTI information in object files.
310 This will speed-up compilation and reduce
4b6b4dfc 311 binary size.
2e1e7f9d
VZ
312
313 --enable-no_exceptions Enable compilation without creation of
314 C++ exception information in object files.
315 This will speed-up compilation and reduce
4b6b4dfc
RR
316 binary size. Also fewer crashes during the
317 actual compilation...
2e1e7f9d
VZ
318
319 --enable-no_deps Enable compilation without creation of
320 dependency information.
321
2edb0bde
VZ
322 --enable-permissive Enable compilation without checking for strict
323 ANSI conformance. Useful to prevent the build
324 dying with errors as soon as you compile with
2e1e7f9d
VZ
325 Solaris' ANSI-defying headers.
326
327 --enable-mem_tracing Add built-in memory tracing.
328
329 --enable-dmalloc Use the dmalloc memory debugger.
330 Read more at www.letters.com/dmalloc/
331
332 --enable-debug_info Add debug info to object files and
333 executables for use with debuggers
334 such as gdb (or its many frontends).
335
336 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
337 compiling. This enable wxWindows' very
4b6b4dfc
RR
338 useful internal debugging tricks (such
339 as automatically reporting illegal calls)
340 to work. Note that program and library
2e1e7f9d 341 must be compiled with the same debug
4b6b4dfc 342 options.
c98f0421 343
2b5f62a0
VZ
344 --enable-debug Same as --enable-debug_info and
345 --enable-debug_flag together. Unless you have
346 some very specific needs, you should use this
347 option instead of --enable-debug_info/flag ones
348 separately.
349
c98f0421 350* Feature Options
b55a176b 351-----------------
c98f0421 352
3cdda6cd
RR
353When producing an executable that is linked statically with wxGTK
354you'll be surprised at its immense size. This can sometimes be
2e1e7f9d 355drastically reduced by removing features from wxWindows that
3cdda6cd
RR
356are not used in your program. The most relevant such features
357are
358
2e1e7f9d 359 --with-odbc Enables ODBC code. This is disabled
cc977e5f 360 by default because iODBC is under the
2e1e7f9d
VZ
361 L-GPL license which is less liberal than
362 wxWindows license.
363
364 --without-libpng Disables PNG image format code.
365
366 --without-libjpeg Disables JPEG image format code.
367
368 --without-libtiff Disables TIFF image format code.
369
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
RR
405
406* Compiling
b55a176b 407-----------
c98f0421
RR
408
409The following must be done in the base directory (e.g. ~/wxGTK
cf7a7e13 410or ~/wxWin or whatever)
c98f0421 411
2e1e7f9d 412Now the makefiles are created (by configure) and you can compile
8710cf5c 413the library by typing:
c98f0421 414
2e1e7f9d 415 make
c98f0421 416
8710cf5c 417make yourself some coffee, as it will take some time. On an old
2e1e7f9d 418386SX possibly two weeks. During compilation, you'll get a few
3cdda6cd 419warning messages depending in your compiler.
c98f0421 420
51d55e1c 421If you want to be more selective, you can change into a specific
2edb0bde 422directory and type "make" there.
c98f0421 423
2edb0bde 424Then you may install the library and its header files under
cf7a7e13
RR
425/usr/local/include/wx and /usr/local/lib respectively. You
426have to log in as root (i.e. run "su" and enter the root
427password) and type
428
2e1e7f9d 429 make install
c98f0421 430
8e1e6fac 431You can remove any traces of wxWindows by typing
c98f0421 432
8e1e6fac 433 make uninstall
2e1e7f9d 434
3cdda6cd 435If you want to save disk space by removing unnecessary
c98f0421
RR
436object-files:
437
2e1e7f9d 438make clean
c98f0421 439
3cdda6cd 440in the various directories will do the work for you.
c98f0421
RR
441
442* Creating a new Project
443--------------------------
444
f3cb6592
RR
4451) The first way uses the installed libraries and header files
446automatically using wx-config
447
b55a176b 448g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo
f3cb6592
RR
449
450Using this way, a make file for the minimal sample would look
451like this
452
cc977e5f 453CC = gcc
f3cb6592
RR
454
455minimal: minimal.o
2e1e7f9d 456 $(CC) -o minimal minimal.o `wx-config --libs`
f3cb6592
RR
457
458minimal.o: minimal.cpp mondrian.xpm
b55a176b 459 $(CC) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
f3cb6592 460
2e1e7f9d 461clean:
f3cb6592
RR
462 rm -f *.o minimal
463
464This is certain to become the standard way unless we decide
2edb0bde 465to stick to tmake.
f3cb6592 466
2e1e7f9d 4672) The other way creates a project within the source code
8e1e6fac 468directories of wxWindows. For this endeavour, you'll need
79144b8a
RR
469GNU autoconf version 2.14 and add an entry to your Makefile.in
470to the bottom of the configure.in script and run autoconf
471and configure before you can type make.
cf7a7e13 472
91b8de8d 473----------------------
c98f0421
RR
474
475In the hope that it will be useful,
476
510fc784
RR
477 Robert Roebling
478