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