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