Applied patch [ 608876 ] Improvements to installation docs
[wxWidgets.git] / docs / motif / install.txt
1 wxWindows 2.3 for Motif installation
2 ------------------------------------
3
4 IMPORTANT NOTE:
5
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   
12   When sending bug reports tell us what version of wxWindows you are 
13   using (including the beta) and what compiler on what system. One 
14   example: wxMotif 2.3.3, gcc 2.95.4, Redhat 6.1
15
16 First steps
17 -----------
18
19 - Prerequisites: Motif 1.2 or above, or Lesstif
20   (not yet tested). Motif 2.0 and above may also be suitable.
21
22 - Download wxMotif-x.y.z.tgz, where x.y.z is the version number.
23   Download documentation in a preferred format, such as
24   wxWindows-HTML.zip or wxWindows-PDF.zip.
25
26 - Make a directory such as ~/wx and unarchive the files into this
27   directory.
28
29 - It is recommended that you install bison and flex; using yacc
30   and lex may require tweaking of the makefiles. You also need
31   libXpm (see comments in the Notes section below) if you want to have
32   XPM support in wxWindows (recommended).
33
34 - You can now use configure to build wxWindows and the samples.
35
36   Using configure is the recommended way to build the library. If it doesn't
37   work for you for whatever reason, please report it (together with detailed
38   information about your platform and the (relevant part of) contents of
39   config.log file) to wx-dev@lists.wxwindows.org.
40
41
42 COMPILING USING CONFIGURE
43 =========================
44
45 * The simplest case
46 -------------------
47
48 If you compile wxWindows on Linux for the first time and don't like to read 
49 install instructions just do (in the base dir):
50
51 > ./configure --with-motif
52 > make
53 > su <type root password>
54 > make install
55 > ldconfig
56 > exit
57
58 Afterwards you can continue with
59
60 > make
61 > su <type root password>
62 > make install
63 > ldconfig
64 > exit
65
66 If you want to remove wxWindows on Unix you can do this:
67
68 > su <type root password>
69 > make uninstall
70 > ldconfig
71 > exit
72
73 * The expert case
74 -----------------
75
76 If you want to do some more serious cross-platform programming with wxWindows, 
77 such as for GTK and Motif, you can now build two complete libraries and use 
78 them concurrently. For this end, you have to create a directory for each build 
79 of wxWindows - you may also want to create different versions of wxWindows
80 and test them concurrently. Most typically, this would be a version configured 
81 with --enable-debug_flag and one without. Note, that only one build can
82 currently be installed, so you'd have to use local version of the library for
83 that purpose.  For building three versions (one GTK, one Motif and a debug
84 version of the GTK source) you'd do this:
85
86 md buildmotif
87 cd buildmotif
88 ../configure --with-motif
89 make
90 cd ..
91
92 md buildgtk
93 cd buildgtk
94 ../configure --with-gtk
95 make
96 cd ..
97
98 md buildgtkd
99 cd buildgtkd
100 ../configure --with-gtk --enable-debug_flag
101 make
102 cd ..
103
104 * The simplest errors
105 ---------------------
106
107 You get errors during compilation: The reason is that you probably have a
108 broken compiler.  GCC 2.8 and earlier versions and egcs are likely to cause
109 problems due to incomplete support for C++ and optimisation bugs.  Best to use
110 GCC 2.95 or later.
111
112 You get immediate segfault when starting any sample or application: This is
113 either due to having compiled the library with different flags or options than
114 your program - typically you might have the __WXDEBUG__ option set for the
115 library but not for your program - or due to using a compiler with optimisation
116 bugs.
117
118 * The simplest program
119 ----------------------
120
121 Now create your super-application myfoo.app and compile anywhere with
122
123 g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
124
125 * General
126 ---------
127
128 The Unix variants of wxWindows use GNU configure. If you have problems with
129 your make use GNU make instead.
130
131 If you have general problems with installation, see the wxWindows website at 
132
133   http://www.wxwindows.org/
134   
135 for newest information. If you still don't have any success, please send a bug 
136 report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF 
137 YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF MOTIF, WXMOTIF, WHAT
138 DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect,
139 but I tried...
140
141 * GUI libraries
142 ---------------
143
144 wxWindows/Motif requires the Motif library to be installed on your system. As
145 an alternative, you may also use the free library "lesstif" which implements
146 most of the Motif API without the licence restrictions of Motif.
147
148 You can get the newest version of the Lesstif from the lesstif homepage at:
149
150   http://www.lesstif.org
151   
152 * Additional libraries
153 ----------------------
154
155 wxWindows/Motif requires a thread library and X libraries known to work with
156 threads.  This is the case on all commercial Unix-Variants and all
157 Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in
158 many aspects. As of writing this, these Linux distributions have correct glibc
159 2 support:
160
161  - RedHat 5.1
162  - Debian 2.0 and 3.0
163  - Stampede
164  - DLD 6.0
165  - SuSE 6.0
166  
167 You can disable thread support by running 
168
169 ./configure --disable-threads
170 make
171 su <type root password>
172 make install
173 ldconfig
174 exit
175   
176 * Building wxMotif on OS/2
177 --------------------------
178
179 Please send comments and question about the OS/2 installation
180 to Andrea Venturoli <a.ventu@flashnet.it> and patches to
181 the wxWindows mailing list.
182
183 You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer), 
184 Lesstif (0.89.1 or newer), emx (0.9d fix 1), flex (2.5.4),
185 yacc (1.8), unix like shell, e.g. korn shell (5.2.13),
186 Autoconf (2.13),  GNU file utilities (3.6),
187 GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4), 
188 sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
189
190 Open an OS/2 prompt and switch to the directory above.
191 First set some global environment variables we need:
192
193 SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
194 SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
195 SET OSTYPE=OS2X              
196 SET COMSPEC=sh
197
198 Notice you can choose whatever you want, if you don't like OS2X.
199
200 Now, run autoconf in the main directory and in the samples, demos
201 and utils subdirectory. This will generate the OS/2 specific
202 versions of the configure scripts. Now run
203     configure --with-motif
204 as described above.
205
206 To verify Lesstif installation, configure will try to compile a
207 sample program that requires X headers/libraries to be either
208 available via C_INCLUDE_PATH and LIBRARY_PATH or you need to
209 explicitly set CFLAGS prior to running configure.
210
211 If you have pthreads library installed, it will be autodetected
212 and the library will be compiled with thread-support.
213
214 Note that configure assumes your flex will generate files named
215 "lexyy.c", not "lex.yy.c". If you have a version which does
216 generate "lex.yy.c", you need to manually change the generated
217 makefile.
218
219 * Building wxMotif on SGI
220 -------------------------
221
222 Using the SGI native compilers, it is recommended that you
223 also set CFLAGS and CXXFLAGS before running configure. These 
224 should be set to :
225
226 CFLAGS="-mips3 -n32" 
227 CXXFLAGS="-mips3 -n32"
228
229 This is essential if you want to use the resultant binaries 
230 on any other machine than the one it was compiled on. If you 
231 have a 64bit machine (Octane) you should also do this to ensure 
232 you don't accidently build the libraries as 64bit (which is 
233 untested).
234
235 The SGI native compiler support has only been tested on Irix 6.5.
236
237 * Create your configuration
238 ---------------------------
239
240 Usage:
241         ./configure [options]
242
243 If you want to use system's C and C++ compiler,
244 set environment variables CXX and CC as
245
246         % setenv CC cc
247         % setenv CXX CC
248         % ./configure options
249
250 to see all the options please use:
251
252         ./configure --help
253
254 The basic philosophy is that if you want to use different
255 configurations, like a debug and a release version, 
256 or use the same source tree on different systems,
257 you have only to change the environment variable OSTYPE.
258 (Sadly this variable is not set by default on some systems
259 in some shells - on SGI's for example). So you will have to 
260 set it there. This variable HAS to be set before starting 
261 configure, so that it knows which system it tries to 
262 configure for.
263
264 Configure will complain if the system variable OSTYPE has 
265 not been defined. And Make in some circumstances as well...
266
267
268 * General options
269 -------------------
270
271 Given below are the commands to change the default behaviour,
272 i.e. if it says "--disable-threads" it means that threads
273 are enabled by default.
274
275 Many of the configure options have been thoroughly tested
276 in wxWindows snapshot 6, but not yet all (ODBC not).
277
278 You have to add --with-motif on platforms, where Motif is
279 not the default (on Linux, configure will default to GTK).
280
281         --with-motif             Use either Motif or Lesstif
282                                  Configure will look for both. 
283
284 The following options handle the kind of library you want to build.
285
286         --disable-threads       Compile without thread support. Threads
287                                 support is also required for the
288                                 socket code to work.
289
290         --disable-shared        Do not create shared libraries.
291
292         --disable-optimise      Do not optimise the code. Can
293                                 sometimes be useful for debugging
294                                 and is required on some architectures
295                                 such as Sun with gcc 2.8.X which
296                                 would otherwise produce segvs.
297
298         --enable-profile        Add profiling info to the object 
299                                 files. Currently broken, I think.
300                                 
301         --enable-no_rtti        Enable compilation without creation of
302                                 C++ RTTI information in object files. 
303                                 This will speed-up compilation and reduce 
304                                 binary size.
305                                 
306         --enable-no_exceptions  Enable compilation without creation of
307                                 C++ exception information in object files. 
308                                 This will speed-up compilation and reduce 
309                                 binary size. Also fewer crashes during the
310                                 actual compilation...
311                                 
312         --enable-no_deps        Enable compilation without creation of
313                                 dependency information.
314                                 
315         --enable-permissive     Enable compilation without checking for strict
316                                 ANSI conformance.  Useful to prevent the build
317                                 dying with errors as soon as you compile with
318                                 Solaris' ANSI-defying headers.
319                                 
320         --enable-mem_tracing    Add built-in memory tracing. 
321                                 
322         --enable-dmalloc        Use the dmalloc memory debugger.
323                                 Read more at www.letters.com/dmalloc/
324                                 
325         --enable-debug_info     Add debug info to object files and
326                                 executables for use with debuggers
327                                 such as gdb (or its many frontends).
328
329         --enable-debug_flag     Define __DEBUG__ and __WXDEBUG__ when
330                                 compiling. This enable wxWindows' very
331                                 useful internal debugging tricks (such
332                                 as automatically reporting illegal calls)
333                                 to work. Note that program and library
334                                 must be compiled with the same debug 
335                                 options.
336
337 * Feature Options
338 -----------------
339
340 Many of the configure options have been thoroughly tested
341 in wxWindows snapshot 6, but not yet all (ODBC not).
342
343 When producing an executable that is linked statically with wxGTK
344 you'll be surprised at its immense size. This can sometimes be
345 drastically reduced by removing features from wxWindows that 
346 are not used in your program. The most relevant such features
347 are
348
349         --without-libpng        Disables PNG image format code.
350         
351         --without-libjpeg       Disables JPEG image format code.
352         
353 {       --without-odbc          Disables ODBC code. Not yet. }
354         
355         --disable-resources     Disables the use of *.wxr type
356                                 resources.
357                 
358         --disable-threads       Disables threads. Will also
359                                 disable sockets.
360
361         --disable-sockets       Disables sockets.
362
363         --disable-dnd           Disables Drag'n'Drop.
364         
365         --disable-clipboard     Disables Clipboard.
366         
367         --disable-serial        Disables object instance serialisation.
368         
369         --disable-streams       Disables the wxStream classes.
370         
371         --disable-file          Disables the wxFile class.
372         
373         --disable-textfile      Disables the wxTextFile class.
374         
375         --disable-intl          Disables the internationalisation.
376         
377         --disable-validators    Disables validators.
378         
379         --disable-accel         Disables accel.
380         
381 Apart from disabling certain features you can very often "strip"
382 the program of its debugging information resulting in a significant
383 reduction in size.
384
385 * Compiling
386 -----------
387
388 The following must be done in the base directory (e.g. ~/wxMotif
389 or ~/wxWin or whatever)
390
391 Now the makefiles are created (by configure) and you can compile 
392 the library by typing:
393
394         make
395
396 make yourself some coffee, as it will take some time. On an old
397 386SX possibly two weeks. During compilation, you'll get a few 
398 warning messages depending in your compiler.
399
400 If you want to be more selective, you can change into a specific
401 directory and type "make" there.
402
403 Then you may install the library and its header files under
404 /usr/local/include/wx and /usr/local/lib respectively. You
405 have to log in as root (i.e. run "su" and enter the root
406 password) and type
407
408         make install    
409
410 You can remove any traces of wxWindows by typing
411
412         make uninstall
413         
414 If you want to save disk space by removing unnecessary
415 object-files:
416
417          make clean
418
419 in the various directories will do the work for you.
420
421 * Creating a new Project
422 ------------------------
423
424 1) The first way uses the installed libraries and header files
425 automatically using wx-config
426
427 g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo
428
429 Using this way, a make file for the minimal sample would look
430 like this
431
432 CXX = g++
433
434 minimal: minimal.o
435     $(CXX) -o minimal minimal.o `wx-config --libs` 
436
437 minimal.o: minimal.cpp mondrian.xpm
438     $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
439
440 clean: 
441         rm -f *.o minimal
442
443 This is certain to become the standard way unless we decide
444 to stick to tmake.
445
446 2) The other way creates a project within the source code 
447 directories of wxWindows. For this endeavour, you'll need
448 GNU autoconf version 2.14 and add an entry to your Makefile.in
449 to the bottom of the configure.in script and run autoconf
450 and configure before you can type make.
451
452 * Further notes by Julian Smart
453 ---------------------------------
454
455 - You may find the following script useful for compiling wxMotif,
456   especially if installing from zips (which don't preserve file
457   permissions). Make this script executable with the command
458   chmod a+x makewxmotif.
459
460   -------:x-----Cut here-----:x-----
461   # makewxmotif
462   # Sets permissions (in case we extracted wxMotif from zip files)
463   # and makes wxMotif.
464   # Call from top-level wxWindows directory.
465   # Note that this uses standard (but commonly-used) configure options;
466   # if you're feeling brave, you may wish to compile with threads:
467   # if they're not supported by the target platform, they will be disabled
468   # anyhow
469   # -- Julian Smart
470   chmod a+x configure config.sub config.guess
471   ./configure --with-shared --with-motif --without-gtk --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc
472   make
473   -------:x-----Cut here-----:x-----
474
475   This script will build wxMotif using shared libraries. If you want to build
476   a static wxWindows library, use --disable-shared.
477
478 Troubleshooting
479 ---------------
480
481 - Solaris compilation with gcc: if the compiler has problems with the variable
482   argument functions, try putting the gcc fixinclude file paths early in the
483   include path.
484
485 - If you operator-related compile errors or strange memory problems
486   (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
487   and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
488
489 - If you get an internal compiler error in gcc, turn off optimisations.
490
491 - Problems with XtDestroyWidget crashing in ~wxWindow have been
492   reported on SGI IRIX 6.4. This has not yet been resolved, so
493   any advice here would be very welcome. See bugs.txt for a
494   possible temporary workaround (comment out the final
495   XtDestroyWidget from ~wxWindow in window.cpp).
496
497 - Some compilers, such as Sun C++, may give a lot of warnings about
498   virtual functions being hidden. Please ignore these, it's correct C++ syntax.
499   If you find any incorrect instances, though, such as a
500   missing 'const' in an overridden function, please let us know.
501
502 Other Notes
503 -----------
504
505 - Debugging mode is switched on by default in the makefiles, but using
506   configure will create a release build of the library by default: it's
507   recommended to use --with-debug_info and --with-debug_flag configure
508   switches while developing your application. To compile in non-debug
509   mode, remove the -D__WXDEBUG__ switch in make.env (or if using the
510   configure system, change --with-debug_flag to --without_debug_flag
511   and --with-debug_info to --without-debug_info in the makewxmotif
512   script).
513
514 Bug reports
515 -----------
516
517 Please send bug reports with a description of your environment,
518 compiler and the error message(s) to the wxwin-developers mailing list at:
519
520     wx-dev@lists.wxwindows.org
521
522 Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999.
523