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