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