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