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