]> git.saurik.com Git - wxWidgets.git/blame - docs/gtk/install.txt
Fix for bug #511057
[wxWidgets.git] / docs / gtk / install.txt
CommitLineData
8e1e6fac 1
91b8de8d
RR
2 !!! When sending bug reports tell us what version of wxWindows you are
3 using (including the beta) and what compiler on what system. One
fb1bd1bd 4 example: wxGTK 2.3.0, egcs 1.1.1, Redhat 6.2 !!!
8e1e6fac 5
c98f0421
RR
6* The most simple case
7-----------------------
8
0544bc0a 9If you compile wxWindows on Linux for the first time and don't like to read
91b8de8d 10install instructions just do (in the base dir):
c98f0421 11
9b61f868
RR
12> ./configure --with-gtk
13> make
14> su <type root password>
15> make install
16> ldconfig
17> exit
034be888 18
9b61f868
RR
19Afterwards you can continue with
20
21> make
22> su <type root password>
23> make install
24> ldconfig
25> exit
4dcaf11a 26
8e1e6fac
RR
27If you want to remove wxWindows on Unix you can do this:
28
9b61f868
RR
29> su <type root password>
30> make uninstall
31> ldconfig
32> exit
cf7a7e13 33
2b62ab35
RR
34* The expert case
35-----------------
36
91b8de8d
RR
37If you want to do some more serious cross-platform programming with wxWindows,
38such as for GTK and Motif, you can now build two complete libraries and use
39them concurretly. For this end, you have to create a directory for each build
40of wxWindows - you may also want to create different versions of wxWindows
41and test them concurrently. Most typically, this would be a version configured
42with --enable-debug_flag and one without. Note, that only one build can currently
43be installed, so you'd have to use local version of the library for that purpose.
51d55e1c
RR
44For building three versions (one GTK, one Motif and a debug version of the GTK
45source) you'd do this:
2b62ab35
RR
46
47md buildmotif
48cd buildmotif
49../configure --with-motif
50make
51cd ..
52
53md buildgtk
54cd buildgtk
55../configure --with-gtk
56make
57cd ..
58
59md buildgtkd
60cd buildgtkd
51d55e1c 61../configure --with-gtk --enable-debug_flag
2b62ab35
RR
62make
63cd ..
64
2a29700e
RR
65* The most simple errors
66------------------------
67
79144b8a 68configure reports, that you don't have GTK 1.2 installed although you are
51d55e1c
RR
69very sure you have. Well, you have installed it, but you also have another
70version of the GTK installed, which you may need to remove including other
91b8de8d
RR
71versions of glib (and its headers). Also, look for the PATH variable and check
72if it includes the path to the correct gtk-config! The check your LDPATH if it
73points to the correct library. There is no way to compile wxGTK if configure
74doesn't pass this test as all this test does is compile and link a GTK program.
75
76You get errors during compilation: The reason is that you probably have a broken
77compiler, which includes almost everything that is called gcc. If you use gcc 2.8
78you have to disable optimsation as the compiler will give up with an internal
79compiler error.
80
81If there is just any way for you to use egcs, use egcs. We cannot fix gcc.
82
83You get immediate segfault when starting any sample or application: This is either
84due to having compiled the library with different flags or options than your program -
85typically you might have the __WXDEBUG__ option set for the library but not for your
86program - or due to using a broken compiler (and its optimisation) such as GCC 2.8.
3502e687 87
2a29700e
RR
88* The most simple program
89-------------------------
90
91b8de8d 91Now create your super-application myfoo.app and compile anywhere with
cf7a7e13 92
bbeb6c2b 93gcc myfoo.cpp `wx-config --libs --cflags` -o myfoo
c98f0421
RR
94
95* General
96-----------------------
97
91b8de8d
RR
98The Unix variants of wxWindows use GNU configure. If you have problems with your
99make use GNU make instead.
c98f0421 100
91b8de8d 101If you have general problems with installation, read my homepage at
c98f0421
RR
102
103 http://wesley.informatik.uni-freiburg.de/~wxxt
104
91b8de8d
RR
105for newest information. If you still don't have any success, please send a bug
106report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF
107YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT DISTRIBUTION
108YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried...
c98f0421
RR
109
110* GUI libraries
111-----------------------
112
91b8de8d 113wxWindows/GTK requires the GTK+ library to be installed on your system. It has to
79144b8a 114be a stable version, preferebly version 1.2.3.
91b8de8d
RR
115
116You can get the newest version of the GTK+ from the GTK homepage at:
c98f0421 117
c98f0421
RR
118 http://www.gtk.org
119
79144b8a 120We also mirror GTK+ 1.2.3 at my ftp site. You'll find information about downloading
91b8de8d 121at my homepage.
58614078 122
c98f0421
RR
123* Additional libraries
124-----------------------
125
91b8de8d
RR
126wxWindows/Gtk requires a thread library and X libraries known to work with threads.
127This is the case on all commercial Unix-Variants and all Linux-Versions that are
128based on glibc 2 except RedHat 5.0 which is broken in many aspects. As of writing
129this, these Linux distributions have correct glibc 2 support:
58614078
RR
130
131 - RedHat 5.1
132 - Debian 2.0
133 - Stampede
4f22cf8d 134 - DLD 6.0
cffee23b 135 - SuSE 6.0
58614078 136
8e1e6fac 137You can disable thread support by running
58614078 138
8e1e6fac 139./configure "--disable-threads"
58614078 140make
034be888 141su <type root password>
8710cf5c 142make install
034be888
RR
143ldconfig
144exit
c98f0421 145
bbeb6c2b 146NB: DO NOT COMPILE WXGTK WITH GCC 2.7 AND THREADS, SINCE ALL PROGRAMS WILL CRASH UPON
91b8de8d 147START-UP! Just always use egcs and be happy.
3502e687 148
91b8de8d
RR
149* Building wxGTK on OS/2
150--------------------------
c98f0421 151
91b8de8d
RR
152Please send comments and question about the OS/2 installation
153to Andrea Venturoli <a.ventu@flashnet.it> and patches to
510fc784 154the wxWindows mailing list.
c98f0421 155
9f2d09aa 156You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer),
ea0dbf30 157GTK+ (1.2.5 or newer), emx (0.9d fix 1), flex (2.5.4), yacc (1.8),
9f2d09aa 158korn shell (5.2.13), Autoconf (2.13), GNU file utilities (3.6),
91b8de8d
RR
159GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4),
160sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
c98f0421 161
91b8de8d
RR
162Open an OS/2 prompt and switch to the directory above.
163First set some global environment variables we need:
164
165SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
9f2d09aa 166SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
91b8de8d
RR
167SET OSTYPE=OS2X
168SET COMSPEC=sh
169
170Notice you can choose whatever you want, if you don't like OS2X.
171
ea0dbf30
SN
172Now, run autoconf in the main directory and in the samples, demos
173and utils subdirectory. This will generate the OS/2 specific
174versions of the configure scripts. Now run
175 configure --with-gtk
176as described above.
177
178If you have pthreads library installed, but have a gtk version
179which does not yet support threading, you need to explicitly
180diable threading by using the option --disable-threads.
181
182Note that configure assumes your flex will generate files named
183"lexyy.c", not "lex.yy.c". If you have a version which does
184generate "lex.yy.c", you need to manually change the generated
185makefile.
9f2d09aa 186
91b8de8d
RR
187* Building wxGTK on SGI
188--------------------------
c98f0421
RR
189
190Using the SGI native compilers, it is recommended that you
191also set CFLAGS and CXXFLAGS before running configure. These
192should be set to :
193
194CFLAGS="-mips3 -n32"
195CXXFLAGS="-mips3 -n32"
196
197This is essential if you want to use the resultant binaries
198on any other machine than the one it was compiled on. If you
199have a 64bit machine (Octane) you should also do this to ensure
200you don't accidently build the libraries as 64bit (which is
201untested).
202
203The SGI native compiler support has only been tested on Irix 6.5.
204
91b8de8d
RR
205* Create your configuration
206-----------------------------
207
208Usage:
209 ./configure options
210
211If you want to use system's C and C++ compiler,
212set environment variables CC and CCC as
213
214 % setenv CC cc
215 % setenv CCC CC
216 % ./configure options
217
c98f0421
RR
218to see all the options please use:
219
220 ./configure --help
221
222The basic philosophy is that if you want to use different
223configurations, like a debug and a release version,
224or use the same source tree on different systems,
225you have only to change the environment variable OSTYPE.
226(Sadly this variable is not set by default on some systems
227in some shells - on SGI's for example). So you will have to
228set it there. This variable HAS to be set before starting
229configure, so that it knows which system it tries to
230configure for.
231
232Configure will complain if the system variable OSTYPE has
233not been defined. And Make in some circumstances as well...
234
235
236* General options
237-------------------
238
77c85c2b
RR
239Given below are the commands to change the default behaviour,
240i.e. if it says "--disable-threads" it means that threads
241are enabled by default.
242
cf7a7e13
RR
243Normally, you won't have to choose a toolkit, because when
244you download wxGTK, it will default to --with-gtk etc. But
245if you use all of our CVS repository you have to choose a
246toolkit. You must do this by running configure with either of:
c98f0421 247
4b6b4dfc 248 --with-gtk Use the GIMP ToolKit (GTK). Default.
c98f0421 249
4b6b4dfc
RR
250 --with-motif Use either Motif or Lesstif
251 Configure will look for both.
c98f0421
RR
252
253The following options handle the kind of library you want to build.
254
bbeb6c2b 255 --disable-threads Compile without thread support.
c98f0421 256
4b6b4dfc
RR
257 --disable-shared Do not create shared libraries, but
258 build static libraries instead.
bbeb6c2b 259
510fc784 260 --disable-optimise Do not optimise the code. Can
3cdda6cd 261 sometimes be useful for debugging
4b6b4dfc
RR
262 and is required on some architectures
263 such as Sun with gcc 2.8.X which
264 would otherwise produce segvs.
c98f0421 265
2b62ab35 266 --enable-profile Add profiling info to the object
510fc784 267 files. Currently broken, I think.
c98f0421 268
f7bdcdd7
RR
269 --enable-no_rtti Enable compilation without creation of
270 C++ RTTI information in object files.
4b6b4dfc
RR
271 This will speed-up compilation and reduce
272 binary size.
f7bdcdd7 273
bea74fbb 274 --enable-no_exceptions Enable compilation without creation of
f7bdcdd7 275 C++ exception information in object files.
4b6b4dfc
RR
276 This will speed-up compilation and reduce
277 binary size. Also fewer crashes during the
278 actual compilation...
f7bdcdd7 279
5586805b
RR
280 --enable-no_deps Enable compilation without creation of
281 dependency information.
282
283 --enable-permissive Enable compilation without creation of
284 giving erros as soon as you compile with
cc977e5f 285 Solaris' ANSI-defying headers.
5586805b 286
bbeb6c2b 287 --enable-mem_tracing Add built-in memory tracing.
c98f0421 288
2b62ab35 289 --enable-dmalloc Use the dmalloc memory debugger.
c98f0421
RR
290 Read more at www.letters.com/dmalloc/
291
510fc784 292 --enable-debug_info Add debug info to object files and
3cdda6cd 293 executables for use with debuggers
cc977e5f 294 such as gdb (or its many frontends).
c98f0421 295
510fc784 296 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
3cdda6cd 297 compiling. This enable wxWindows' very
4b6b4dfc
RR
298 useful internal debugging tricks (such
299 as automatically reporting illegal calls)
300 to work. Note that program and library
301 must be compiled with the same debug
302 options.
c98f0421
RR
303
304* Feature Options
305-------------------
306
3cdda6cd
RR
307When producing an executable that is linked statically with wxGTK
308you'll be surprised at its immense size. This can sometimes be
309drastically reduced by removing features from wxWindows that
310are not used in your program. The most relevant such features
311are
312
cc977e5f
RR
313 --with-odbc Enables ODBC code. This is disabled
314 by default because iODBC is under the
315 L-GPL license.
316
510fc784 317 --without-libpng Disables PNG image format code.
3cdda6cd 318
510fc784 319 --without-libjpeg Disables JPEG image format code.
3cdda6cd 320
cc977e5f
RR
321 --without-libtiff Disables TIFF image format code.
322
510fc784 323 --disable-pnm Disables PNM image format code.
bbeb6c2b 324
510fc784 325 --disable-gif Disables GIF image format code.
bbeb6c2b 326
510fc784 327 --disable-pcx Disables PCX image format code.
bbeb6c2b 328
4b6b4dfc
RR
329 --disable-iff Disables IFF image format code.
330
510fc784 331 --disable-resources Disables the use of *.wxr type
3cdda6cd
RR
332 resources.
333
2b62ab35 334 --disable-threads Disables threads. Will also
31276cb5 335 disable sockets.
3cdda6cd 336
2b62ab35 337 --disable-sockets Disables sockets.
3cdda6cd 338
2b62ab35 339 --disable-dnd Disables Drag'n'Drop.
3cdda6cd 340
2b62ab35 341 --disable-clipboard Disables Clipboard.
3cdda6cd 342
2b62ab35 343 --disable-serial Disables object instance serialiasation.
3cdda6cd 344
2b62ab35 345 --disable-streams Disables the wxStream classes.
3cdda6cd 346
77c85c2b
RR
347 --disable-file Disables the wxFile class.
348
349 --disable-textfile Disables the wxTextFile class.
350
351 --disable-intl Disables the internationalisation.
352
353 --disable-validators Disables validators.
354
355 --disable-accel Disables accel.
356
3cdda6cd
RR
357Apart from disabling certain features you can very often "strip"
358the program of its debugging information resulting in a significant
359reduction in size.
c98f0421
RR
360
361* Compiling
362-------------
363
364The following must be done in the base directory (e.g. ~/wxGTK
cf7a7e13 365or ~/wxWin or whatever)
c98f0421 366
8710cf5c
RR
367Now the makefiles are created (by configure) and you can compile
368the library by typing:
c98f0421
RR
369
370 make
371
8710cf5c 372make yourself some coffee, as it will take some time. On an old
2b62ab35 373386SX possibly two weeks. During compilation, you'll get a few
3cdda6cd 374warning messages depending in your compiler.
c98f0421 375
51d55e1c 376If you want to be more selective, you can change into a specific
8e1e6fac 377directiry and type "make" there.
c98f0421 378
cf7a7e13
RR
379Then you may install the library and it's header files under
380/usr/local/include/wx and /usr/local/lib respectively. You
381have to log in as root (i.e. run "su" and enter the root
382password) and type
383
384 make install
c98f0421 385
8e1e6fac 386You can remove any traces of wxWindows by typing
c98f0421 387
8e1e6fac
RR
388 make uninstall
389
3cdda6cd 390If you want to save disk space by removing unnecessary
c98f0421
RR
391object-files:
392
510fc784 393 make clean
c98f0421 394
3cdda6cd 395in the various directories will do the work for you.
c98f0421
RR
396
397* Creating a new Project
398--------------------------
399
f3cb6592
RR
4001) The first way uses the installed libraries and header files
401automatically using wx-config
402
cc977e5f 403gcc myfoo.cpp `wx-config --cflags --libs` -o myfoo
f3cb6592
RR
404
405Using this way, a make file for the minimal sample would look
406like this
407
cc977e5f 408CC = gcc
f3cb6592
RR
409
410minimal: minimal.o
411 $(CC) -o minimal minimal.o `wx-config --libs`
412
413minimal.o: minimal.cpp mondrian.xpm
414 $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
415
416clean:
417 rm -f *.o minimal
418
419This is certain to become the standard way unless we decide
420to sitch to tmake.
421
4222) The other way creates a project within the source code
8e1e6fac 423directories of wxWindows. For this endeavour, you'll need
79144b8a
RR
424GNU autoconf version 2.14 and add an entry to your Makefile.in
425to the bottom of the configure.in script and run autoconf
426and configure before you can type make.
cf7a7e13 427
91b8de8d 428----------------------
c98f0421
RR
429
430In the hope that it will be useful,
431
510fc784
RR
432 Robert Roebling
433