]> git.saurik.com Git - wxWidgets.git/blame - docs/motif/install.txt
Penguin Unicode compilation fix.
[wxWidgets.git] / docs / motif / install.txt
CommitLineData
42280e48 1wxWindows 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
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
42280e48 14 example: wxMotif 2.5.0, 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
BP
24 Download documentation in a preferred format, such as
25 wxWindows-HTML.zip or wxWindows-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
VZ
32 libXpm (see comments in the Notes section below) if you want to have
33 XPM support in wxWindows (recommended).
acbd13a3 34
1cf13934 35- You can now use configure to build wxWindows 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
JS
48
49If you compile wxWindows on Linux for the first time and don't like to read
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
67If you want to remove wxWindows 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
77If you want to do some more serious cross-platform programming with wxWindows,
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
af111fc3
JS
80of wxWindows - you may also want to create different versions of wxWindows
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
b55a176b
JS
129The Unix variants of wxWindows use GNU configure. If you have problems with
130your make use GNU make instead.
af111fc3 131
b55a176b 132If you have general problems with installation, see the wxWindows website at
af111fc3 133
b55a176b 134 http://www.wxwindows.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
JS
144
145wxWindows/Motif requires the Motif library to be installed on your system. As
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
b55a176b
JS
156wxWindows/Motif requires a thread library and X libraries known to work with
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
159many aspects. As of writing this, these Linux distributions have correct glibc
1602 support:
af111fc3
JS
161
162 - RedHat 5.1
b55a176b 163 - Debian 2.0 and 3.0
af111fc3
JS
164 - Stampede
165 - DLD 6.0
166 - SuSE 6.0
167
168You can disable thread support by running
169
b55a176b 170./configure --disable-threads
af111fc3
JS
171make
172su <type root password>
173make install
174ldconfig
175exit
176
b55a176b 177* Building wxMotif on OS/2
9bb3479c
JS
178--------------------------
179
180Please send comments and question about the OS/2 installation
181to Andrea Venturoli <a.ventu@flashnet.it> and patches to
182the wxWindows mailing list.
183
184You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer),
185Lesstif (0.89.1 or newer), emx (0.9d fix 1), flex (2.5.4),
186yacc (1.8), unix like shell, e.g. korn shell (5.2.13),
187Autoconf (2.13), GNU file utilities (3.6),
188GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4),
189sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1).
190
191Open an OS/2 prompt and switch to the directory above.
192First set some global environment variables we need:
193
194SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__
195SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__
196SET OSTYPE=OS2X
197SET COMSPEC=sh
198
199Notice you can choose whatever you want, if you don't like OS2X.
200
201Now, run autoconf in the main directory and in the samples, demos
202and utils subdirectory. This will generate the OS/2 specific
203versions of the configure scripts. Now run
204 configure --with-motif
205as described above.
206
207To verify Lesstif installation, configure will try to compile a
208sample program that requires X headers/libraries to be either
209available via C_INCLUDE_PATH and LIBRARY_PATH or you need to
210explicitly set CFLAGS prior to running configure.
211
212If you have pthreads library installed, it will be autodetected
213and the library will be compiled with thread-support.
214
215Note that configure assumes your flex will generate files named
216"lexyy.c", not "lex.yy.c". If you have a version which does
217generate "lex.yy.c", you need to manually change the generated
218makefile.
219
af111fc3 220* Building wxMotif on SGI
b55a176b 221-------------------------
af111fc3
JS
222
223Using the SGI native compilers, it is recommended that you
224also set CFLAGS and CXXFLAGS before running configure. These
225should be set to :
226
227CFLAGS="-mips3 -n32"
228CXXFLAGS="-mips3 -n32"
229
230This is essential if you want to use the resultant binaries
231on any other machine than the one it was compiled on. If you
232have a 64bit machine (Octane) you should also do this to ensure
233you don't accidently build the libraries as 64bit (which is
234untested).
235
236The SGI native compiler support has only been tested on Irix 6.5.
237
238* Create your configuration
b55a176b 239---------------------------
af111fc3
JS
240
241Usage:
b55a176b 242 ./configure [options]
ee1aaf99 243
af111fc3 244If you want to use system's C and C++ compiler,
3a922bb4 245set environment variables CXX and CC as
af111fc3
JS
246
247 % setenv CC cc
3a922bb4 248 % setenv CXX CC
af111fc3
JS
249 % ./configure options
250
251to see all the options please use:
252
253 ./configure --help
254
255The basic philosophy is that if you want to use different
256configurations, like a debug and a release version,
257or use the same source tree on different systems,
258you have only to change the environment variable OSTYPE.
259(Sadly this variable is not set by default on some systems
260in some shells - on SGI's for example). So you will have to
261set it there. This variable HAS to be set before starting
262configure, so that it knows which system it tries to
263configure for.
264
265Configure will complain if the system variable OSTYPE has
266not been defined. And Make in some circumstances as well...
267
268
269* General options
270-------------------
271
272Given below are the commands to change the default behaviour,
273i.e. if it says "--disable-threads" it means that threads
274are enabled by default.
275
2edb0bde 276Many of the configure options have been thoroughly tested
af111fc3
JS
277in wxWindows snapshot 6, but not yet all (ODBC not).
278
279You have to add --with-motif on platforms, where Motif is
2edb0bde 280not the default (on Linux, configure will default to GTK).
af111fc3 281
af111fc3
JS
282 --with-motif Use either Motif or Lesstif
283 Configure will look for both.
284
285The following options handle the kind of library you want to build.
286
287 --disable-threads Compile without thread support. Threads
288 support is also required for the
289 socket code to work.
290
291 --disable-shared Do not create shared libraries.
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
2edb0bde
VZ
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.
af111fc3
JS
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
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
334 compiling. This enable wxWindows' 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
b55a176b 342-----------------
af111fc3 343
2edb0bde 344Many of the configure options have been thoroughly tested
af111fc3
JS
345in wxWindows snapshot 6, but not yet all (ODBC not).
346
347When producing an executable that is linked statically with wxGTK
348you'll be surprised at its immense size. This can sometimes be
349drastically reduced by removing features from wxWindows that
350are not used in your program. The most relevant such features
351are
352
353 --without-libpng Disables PNG image format code.
354
355 --without-libjpeg Disables JPEG image format code.
356
70aac632 357 --without-odbc Disables ODBC code.
af111fc3 358
af111fc3
JS
359 --disable-threads Disables threads. Will also
360 disable sockets.
361
362 --disable-sockets Disables sockets.
363
364 --disable-dnd Disables Drag'n'Drop.
365
366 --disable-clipboard Disables Clipboard.
367
af111fc3
JS
368 --disable-streams Disables the wxStream classes.
369
370 --disable-file Disables the wxFile class.
371
372 --disable-textfile Disables the wxTextFile class.
373
374 --disable-intl Disables the internationalisation.
375
376 --disable-validators Disables validators.
377
378 --disable-accel Disables accel.
379
380Apart from disabling certain features you can very often "strip"
381the program of its debugging information resulting in a significant
382reduction in size.
383
384* Compiling
b55a176b 385-----------
af111fc3 386
b55a176b 387The following must be done in the base directory (e.g. ~/wxMotif
af111fc3
JS
388or ~/wxWin or whatever)
389
390Now the makefiles are created (by configure) and you can compile
391the library by typing:
392
393 make
394
395make yourself some coffee, as it will take some time. On an old
70aac632 396Pentium 200 around 40 minutes. During compilation, you may get a few
af111fc3
JS
397warning messages depending in your compiler.
398
399If you want to be more selective, you can change into a specific
2edb0bde 400directory and type "make" there.
af111fc3 401
2edb0bde 402Then you may install the library and its header files under
af111fc3
JS
403/usr/local/include/wx and /usr/local/lib respectively. You
404have to log in as root (i.e. run "su" and enter the root
405password) and type
406
407 make install
408
409You can remove any traces of wxWindows by typing
410
411 make uninstall
412
413If you want to save disk space by removing unnecessary
414object-files:
415
416 make clean
417
418in the various directories will do the work for you.
419
420* Creating a new Project
b55a176b 421------------------------
af111fc3
JS
422
4231) The first way uses the installed libraries and header files
424automatically using wx-config
425
b55a176b 426g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo
af111fc3
JS
427
428Using this way, a make file for the minimal sample would look
429like this
430
3a922bb4 431CXX = g++
af111fc3
JS
432
433minimal: minimal.o
3a922bb4 434 $(CXX) -o minimal minimal.o `wx-config --libs`
af111fc3
JS
435
436minimal.o: minimal.cpp mondrian.xpm
b55a176b 437 $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
af111fc3
JS
438
439clean:
440 rm -f *.o minimal
441
442This is certain to become the standard way unless we decide
2edb0bde 443to stick to tmake.
af111fc3
JS
444
4452) The other way creates a project within the source code
446directories of wxWindows. For this endeavour, you'll need
447GNU autoconf version 2.14 and add an entry to your Makefile.in
448to the bottom of the configure.in script and run autoconf
449and configure before you can type make.
450
451* Further notes by Julian Smart
452---------------------------------
453
ee1aaf99
JS
454- You may find the following script useful for compiling wxMotif,
455 especially if installing from zips (which don't preserve file
456 permissions). Make this script executable with the command
8870c26e
JS
457 chmod a+x makewxmotif.
458
459 -------:x-----Cut here-----:x-----
460 # makewxmotif
461 # Sets permissions (in case we extracted wxMotif from zip files)
462 # and makes wxMotif.
463 # Call from top-level wxWindows directory.
464 # Note that this uses standard (but commonly-used) configure options;
4417b343
VZ
465 # if you're feeling brave, you may wish to compile with threads:
466 # if they're not supported by the target platform, they will be disabled
467 # anyhow
8870c26e 468 # -- Julian Smart
af111fc3 469 chmod a+x configure config.sub config.guess
70aac632 470 ./configure --with-shared --with-motif --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc
44c4a334 471 make
8870c26e
JS
472 -------:x-----Cut here-----:x-----
473
af111fc3
JS
474 This script will build wxMotif using shared libraries. If you want to build
475 a static wxWindows library, use --disable-shared.
f5ee2e5f 476
750b78ba
JS
477Troubleshooting
478---------------
479
b55a176b
JS
480- Solaris compilation with gcc: if the compiler has problems with the variable
481 argument functions, try putting the gcc fixinclude file paths early in the
482 include path.
750b78ba 483
0492c5a0
JS
484- If you operator-related compile errors or strange memory problems
485 (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
486 and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
cba2db0c 487
4417b343 488- If you get an internal compiler error in gcc, turn off optimisations.
ca5c8b2d 489
cba2db0c
JS
490- Problems with XtDestroyWidget crashing in ~wxWindow have been
491 reported on SGI IRIX 6.4. This has not yet been resolved, so
492 any advice here would be very welcome. See bugs.txt for a
0492c5a0
JS
493 possible temporary workaround (comment out the final
494 XtDestroyWidget from ~wxWindow in window.cpp).
cba2db0c 495
ad813b00
JS
496- Some compilers, such as Sun C++, may give a lot of warnings about
497 virtual functions being hidden. Please ignore these, it's correct C++ syntax.
498 If you find any incorrect instances, though, such as a
499 missing 'const' in an overridden function, please let us know.
500
750b78ba
JS
501Other Notes
502-----------
5de9c45c 503
70aac632
MB
504- Using configure will create a release build of the library by
505 default: it's recommended to use --enable-debug configure switch
506 while developing your application. To compile in non-debug mode, use
507 --disable-debug configure switch.
ea57084d 508
750b78ba
JS
509Bug reports
510-----------
511
512Please send bug reports with a description of your environment,
4417b343 513compiler and the error message(s) to the wxwin-developers mailing list at:
5de9c45c 514
1cf13934 515 wx-dev@lists.wxwindows.org
5de9c45c 516
ee1aaf99
JS
517Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999.
518