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