]> git.saurik.com Git - wxWidgets.git/blob - docs/motif/install.txt
wxMenu implementations
[wxWidgets.git] / docs / motif / install.txt
1 wxWindows 2.0 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.1 beta 6, egcs 1.1.1, Redhat 5.0
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 the appropriate .tgz archive, or alternatively the files
23 wx200gen.zip and wx200mot.zip. Download documentation in a preferred format,
24 such as wx200htm.zip or wx200pdf.zip.
25
26 - Make a directory such as ~/wx and unarchive the files into this
27 directory. If using the zip archives, use the -a option if available
28 to convert the ASCII files to Unix format. Don't worry about files being
29 overwritten: they should be identical anyway.
30
31 (See http://www.cdrom.com/pub/infozip/ if you don't have zip/unzip
32 already installed. Zip isn't the same as gzip!)
33
34 - It is recommended that you install bison and flex; using yacc
35 and lex may require tweaking of the makefiles. You also need
36 libXpm (see comments in the Notes section below) if you want to have
37 XPM support in wxWindows (recommended).
38
39 - You now have the option of using the configure-based system, or the simple
40 makefile system.
41
42 Using configure is the recommended way to build the library. If it doesn't
43 work for you for whatever reason, please report it (together with detailed
44 information about your platform and the (relevant part of) contents of
45 config.log file) to wxwin-developers@wx.dent.med.uni-muenchen.de.
46
47 COMPILING USING CONFIGURE
48 =========================
49
50 * The most simple case
51 -----------------------
52
53 If you compile wxWindows on Linux for the first time and don't like to read
54 install instructions just do (in the base dir):
55
56 > ./configure --with-motif
57 > make
58 > su <type root password>
59 > make install
60 > ldconfig
61 > exit
62
63 Afterwards you can continue with
64
65 > make
66 > su <type root password>
67 > make install
68 > ldconfig
69 > exit
70
71 If you want to remove wxWindows on Unix you can do this:
72
73 > su <type root password>
74 > make uninstall
75 > ldconfig
76 > exit
77
78 * The expert case
79 -----------------
80
81 If you want to do some more serious cross-platform programming with wxWindows,
82 such as for GTK and Motif, you can now build two complete libraries and use
83 them concurretly. For this end, you have to create a directory for each build
84 of wxWindows - you may also want to create different versions of wxWindows
85 and test them concurrently. Most typically, this would be a version configured
86 with --enable-debug_flag and one without. Note, that only one build can currently
87 be installed, so you'd have to use local version of the library for that purpose.
88 For building three versions (one GTK, one Motif and a debug version of the GTK
89 source) you'd do this:
90
91 md buildmotif
92 cd buildmotif
93 ../configure --with-motif
94 make
95 cd ..
96
97 md buildgtk
98 cd buildgtk
99 ../configure --with-gtk
100 make
101 cd ..
102
103 md buildgtkd
104 cd buildgtkd
105 ../configure --with-gtk --enable-debug_flag
106 make
107 cd ..
108
109 * The most simple errors
110 ------------------------
111
112 You get errors during compilation: The reason is that you probably have a broken
113 compiler, which includes almost everything that is called gcc. If you use gcc 2.8
114 you have to disable optimsation as the compiler will give up with an internal
115 compiler error.
116
117 If there is just any way for you to use egcs, use egcs. We cannot fix gcc.
118
119 You get immediate segfault when starting any sample or application: This is either
120 due to having compiled the library with different flags or options than your program -
121 typically you might have the __WXDEBUG__ option set for the library but not for your
122 program - or due to using a broken compiler (and its optimisation) such as GCC 2.8.
123
124 * The most simple program
125 -------------------------
126
127 Now create your super-application myfoo.app and compile anywhere with
128
129 g++ myfoo.cpp `wx-config --libs --cflags` -o myfoo
130
131 * General
132 -----------------------
133
134 The Unix variants of wxWindows use GNU configure. If you have problems with your
135 make use GNU make instead.
136
137 If you have general problems with installation, read my homepage at
138
139 http://wesley.informatik.uni-freiburg.de/~wxxt
140
141 for newest information. If you still don't have any success, please send a bug
142 report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF
143 YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT DISTRIBUTION
144 YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried...
145
146 * GUI libraries
147 -----------------------
148
149 wxWindows/Motif requires the Motif library to be installed on your system. As
150 an alternative, you may also use the free library "lesstif" which implements
151 most of the Motif API without the licence restrictions of Motif.
152
153 You can get the newest version of the Lesstif from the lesstif homepage at:
154
155 http://www.lesstif.org
156
157 * Additional libraries
158 -----------------------
159
160 wxWindows/Motif requires a thread library and X libraries known to work with threads.
161 This is the case on all commercial Unix-Variants and all Linux-Versions that are
162 based on glibc 2 except RedHat 5.0 which is broken in many aspects. As of writing
163 this, these Linux distributions have correct glibc 2 support:
164
165 - RedHat 5.1
166 - Debian 2.0
167 - Stampede
168 - DLD 6.0
169 - SuSE 6.0
170
171 You can disable thread support by running
172
173 ./configure "--disable-threads"
174 make
175 su <type root password>
176 make install
177 ldconfig
178 exit
179
180 NB: DO NOT COMPILE WXGTK WITH GCC AND THREADS, SINCE ALL PROGRAMS WILL
181 CRASH UPON START-UP! Just always use egcs and be happy.
182
183 * Building wxMotif on SGI
184 --------------------------
185
186 Using the SGI native compilers, it is recommended that you
187 also set CFLAGS and CXXFLAGS before running configure. These
188 should be set to :
189
190 CFLAGS="-mips3 -n32"
191 CXXFLAGS="-mips3 -n32"
192
193 This is essential if you want to use the resultant binaries
194 on any other machine than the one it was compiled on. If you
195 have a 64bit machine (Octane) you should also do this to ensure
196 you don't accidently build the libraries as 64bit (which is
197 untested).
198
199 The SGI native compiler support has only been tested on Irix 6.5.
200
201 * Create your configuration
202 -----------------------------
203
204 Usage:
205 ./configure options
206
207 If you want to use system's C and C++ compiler,
208 set environment variables CC and CCC as
209
210 % setenv CC cc
211 % setenv CCC CC
212 % ./configure options
213
214 to see all the options please use:
215
216 ./configure --help
217
218 The basic philosophy is that if you want to use different
219 configurations, like a debug and a release version,
220 or use the same source tree on different systems,
221 you have only to change the environment variable OSTYPE.
222 (Sadly this variable is not set by default on some systems
223 in some shells - on SGI's for example). So you will have to
224 set it there. This variable HAS to be set before starting
225 configure, so that it knows which system it tries to
226 configure for.
227
228 Configure will complain if the system variable OSTYPE has
229 not been defined. And Make in some circumstances as well...
230
231
232 * General options
233 -------------------
234
235 Given below are the commands to change the default behaviour,
236 i.e. if it says "--disable-threads" it means that threads
237 are enabled by default.
238
239 Many of the confiugre options have been thoroughly tested
240 in wxWindows snapshot 6, but not yet all (ODBC not).
241
242 You have to add --with-motif on platforms, where Motif is
243 not the default (on Linux, configure will deafult to GTK).
244
245 --without-gtk Don't use the GIMP ToolKit (GTK)
246
247 --with-motif Use either Motif or Lesstif
248 Configure will look for both.
249
250 The following options handle the kind of library you want to build.
251
252 --disable-threads Compile without thread support. Threads
253 support is also required for the
254 socket code to work.
255
256 --disable-shared Do not create shared libraries.
257
258 --disable-optimise Do not optimise the code. Can
259 sometimes be useful for debugging
260 and is required on some architectures
261 such as Sun with gcc 2.8.X which
262 would otherwise produce segvs.
263
264 --enable-profile Add profiling info to the object
265 files. Currently broken, I think.
266
267 --enable-no_rtti Enable compilation without creation of
268 C++ RTTI information in object files.
269 This will speed-up compilation and reduce
270 binary size.
271
272 --enable-no_exceptions Enable compilation without creation of
273 C++ exception information in object files.
274 This will speed-up compilation and reduce
275 binary size. Also fewer crashes during the
276 actual compilation...
277
278 --enable-no_deps Enable compilation without creation of
279 dependency information.
280
281 --enable-permissive Enable compilation without creation of
282 giving erros as soon as you compile with
283 Solaris ANSI-defying headers...
284
285 --enable-mem_tracing Add built-in memory tracing.
286
287 --enable-dmalloc Use the dmalloc memory debugger.
288 Read more at www.letters.com/dmalloc/
289
290 --enable-debug_info Add debug info to object files and
291 executables for use with debuggers
292 such as gdb (or its many frontends).
293
294 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
295 compiling. This enable wxWindows' very
296 useful internal debugging tricks (such
297 as automatically reporting illegal calls)
298 to work. Note that program and library
299 must be compiled with the same debug
300 options.
301
302 * Feature Options
303 -------------------
304
305 Many of the confiugre options have been thoroughly tested
306 in wxWindows snapshot 6, but not yet all (ODBC not).
307
308 When producing an executable that is linked statically with wxGTK
309 you'll be surprised at its immense size. This can sometimes be
310 drastically reduced by removing features from wxWindows that
311 are not used in your program. The most relevant such features
312 are
313
314 --without-libpng Disables PNG image format code.
315
316 --without-libjpeg Disables JPEG image format code.
317
318 --without-odbc Disables ODBC code.
319
320 --disable-resources Disables the use of *.wxr type
321 resources.
322
323 --disable-threads Disables threads. Will also
324 disable sockets.
325
326 --disable-sockets Disables sockets.
327
328 --disable-dnd Disables Drag'n'Drop.
329
330 --disable-clipboard Disables Clipboard.
331
332 --disable-serial Disables object instance serialiasation.
333
334 --disable-streams Disables the wxStream classes.
335
336 --disable-file Disables the wxFile class.
337
338 --disable-textfile Disables the wxTextFile class.
339
340 --disable-intl Disables the internationalisation.
341
342 --disable-validators Disables validators.
343
344 --disable-accel Disables accel.
345
346 Apart from disabling certain features you can very often "strip"
347 the program of its debugging information resulting in a significant
348 reduction in size.
349
350 * Compiling
351 -------------
352
353 The following must be done in the base directory (e.g. ~/wxGTK
354 or ~/wxWin or whatever)
355
356 Now the makefiles are created (by configure) and you can compile
357 the library by typing:
358
359 make
360
361 make yourself some coffee, as it will take some time. On an old
362 386SX possibly two weeks. During compilation, you'll get a few
363 warning messages depending in your compiler.
364
365 If you want to be more selective, you can change into a specific
366 directiry and type "make" there.
367
368 Then you may install the library and it's header files under
369 /usr/local/include/wx and /usr/local/lib respectively. You
370 have to log in as root (i.e. run "su" and enter the root
371 password) and type
372
373 make install
374
375 You can remove any traces of wxWindows by typing
376
377 make uninstall
378
379 If you want to save disk space by removing unnecessary
380 object-files:
381
382 make clean
383
384 in the various directories will do the work for you.
385
386 * Creating a new Project
387 --------------------------
388
389 1) The first way uses the installed libraries and header files
390 automatically using wx-config
391
392 g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
393
394 Using this way, a make file for the minimal sample would look
395 like this
396
397 CC = g++
398
399 minimal: minimal.o
400 $(CC) -o minimal minimal.o `wx-config --libs`
401
402 minimal.o: minimal.cpp mondrian.xpm
403 $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
404
405 clean:
406 rm -f *.o minimal
407
408 This is certain to become the standard way unless we decide
409 to sitch to tmake.
410
411 2) The other way creates a project within the source code
412 directories of wxWindows. For this endeavour, you'll need
413 GNU autoconf version 2.14 and add an entry to your Makefile.in
414 to the bottom of the configure.in script and run autoconf
415 and configure before you can type make.
416
417 * Further notes by Julian Smart
418 ---------------------------------
419
420 - You may find the following script useful for compiling wxMotif,
421 especially if installing from zips (which don't preserve file
422 permissions). Make this script executable with the command
423 chmod a+x makewxmotif.
424
425 -------:x-----Cut here-----:x-----
426 # makewxmotif
427 # Sets permissions (in case we extracted wxMotif from zip files)
428 # and makes wxMotif.
429 # Call from top-level wxWindows directory.
430 # Note that this uses standard (but commonly-used) configure options;
431 # if you're feeling brave, you may wish to compile with threads:
432 # if they're not supported by the target platform, they will be disabled
433 # anyhow
434 # -- Julian Smart
435 chmod a+x configure config.sub config.guess
436 ./configure --with-shared --with-motif --without-gtk --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc
437 make
438 -------:x-----Cut here-----:x-----
439
440 This script will build wxMotif using shared libraries. If you want to build
441 a static wxWindows library, use --disable-shared.
442
443 COMPILING USING MAKEFILES
444 =========================
445
446 - Copy the file include/wx/motif/setup0.h to include/wx/motif/setup.h and
447 edit it if you wish to enable/disable some library features
448
449 - Choose a .env file from src/makeenvs that matches your
450 environment, and copy it to src/make.env. These are the
451 settings read by wxWindows for Motif makefiles.
452
453 - Edit src/make.env to change options according to your local
454 environment. In particular, change WXDIR to where wxWindows is
455 found on your system, or set the WXWIN environment variable
456 before compilation, e.g.:
457
458 export WXWIN=/home/jacs/wx2
459
460 Please feel free to contribute settings files for your environment.
461
462 - Change directory to src/motif and type:
463
464 make -f makefile.unx motif
465
466 This should make the library libwx_motif.a in the lib
467 directory. Note that this makefile system does not build shared
468 libraries, only static ones (that is, the wxWindows library will be
469 linked statically; to see remaining dependencies on shared libraries,
470 type e.g. ldd minimal_motif).
471
472 - Make a sample, such as the minimal sample:
473
474 cd samples/minimal
475 make -f makefile.unx motif
476
477 and run the resulting minimal_motif binary.
478
479 Troubleshooting
480 ---------------
481
482 - If you have trouble compiling the file y_tab.c, or have strange
483 linking errors, check whether you're using a C or C++ compiler for this file.
484 You should specify a C compiler in the CCLEX variable in src/make.env.
485 You could also try using bison and flex instead of yacc and
486 lex.
487
488 - Solaris compilation with gcc: if the compiler has problems with the variable argument
489 functions, try putting the gcc fixinclude file paths early in the include
490 path.
491
492 - If you operator-related compile errors or strange memory problems
493 (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
494 and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
495
496 - If you get an internal compiler error in gcc, turn off optimisations.
497
498 - Problems with XtDestroyWidget crashing in ~wxWindow have been
499 reported on SGI IRIX 6.4. This has not yet been resolved, so
500 any advice here would be very welcome. See bugs.txt for a
501 possible temporary workaround (comment out the final
502 XtDestroyWidget from ~wxWindow in window.cpp).
503
504 - If you use flex and bison instead of yacc and lex, you may need
505 to change the relevant part of src/motif/makefile.unx to read:
506
507 ../common/y_tab.c: ../common/parser.y
508 $(YACC) ../common/parser.y
509 mv ../common/parser.tab.c ../common/y_tab.c
510
511 (the 'mv' command needs to be changed)
512
513 - Some compilers, such as Sun C++, may give a lot of warnings about
514 virtual functions being hidden. Please ignore these, it's correct C++ syntax.
515 If you find any incorrect instances, though, such as a
516 missing 'const' in an overridden function, please let us know.
517
518 Other Notes
519 -----------
520
521 - Debugging mode is switched on by default in the makefiles, but using
522 configure will create a release build of the library by default: it's
523 recommended to use --with-debug_info and --with-debug_flag configure
524 switches while developing your application. To compile in non-debug
525 mode, remove the -D__WXDEBUG__ switch in make.env (or if using the
526 configure system, change --with-debug_flag to --without_debug_flag
527 and --with-debug_info to --without-debug_info in the makewxmotif
528 script).
529
530 - Some classes can be switched off in include/wx/motif/setup.h,
531 if you are having trouble with a particular file. However,
532 I'd prefer you to fix the problem and send the fix to me :-) or at
533 least let me know about it.
534
535 - Thread support is switched off by default in setup.h (wxUSE_THREADS)
536 because standard Unices often do not have the necessary thread library
537 installed. Please see ../docs/gtk/install.txt for more details on this.
538 The systems for which thread support is known to work are Linux with libc6
539 (a.k.a. glibc2), Solaris 2.5 and 2.6 (provided that X libraries are thread
540 safe) and, to some extent, FreeBSD 2.8 and 3.1 (any feedback on thread
541 support under FreeBSD as well as the systems not mentioned here would be
542 appreciated).
543
544 - If you run into problems with a missing X11/Xpm.h header, you
545 need to install the XPM package. It can be obtained from:
546
547 ftp://ftp.x.org/contrib/libraries/xpm-3.4k.tar.gz
548 http://sunfreeware.com
549
550 You may need to modify make.env to add -I and -L options pointing to where Xpm
551 is installed and possibly change bitmap.cpp to
552 include <xpm.h> instead of <X11/xpm.h>
553
554 Alternatively, edit include/wx/motif/setup.h, set wxUSE_XPM
555 to 0, and recompile. You will not be able to load any XPMs,
556 though (currently the only supported colour bitmap format).
557
558 Bug reports
559 -----------
560
561 Please send bug reports with a description of your environment,
562 compiler and the error message(s) to the wxwin-developers mailing list at:
563
564 wxwin-developers@wx.dent.med.uni-muenchen.de
565
566 Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999.
567