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