]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/motif/install.txt
fixing return values and handling of invalid files
[wxWidgets.git] / docs / motif / install.txt
... / ...
CommitLineData
1wxWidgets for Motif installation
2--------------------------------
3
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
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.8.1, gcc 2.95.4, Redhat 6.1
15
16First 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.wxwidgets.org.
41
42
43COMPILING USING CONFIGURE
44=========================
45
46* The simplest case
47-------------------
48
49If you compile wxWidgets 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 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
77If you want to do some more serious cross-platform programming with wxWidgets,
78such as for GTK and Motif, you can now build two complete libraries and use
79them concurrently. For this end, you have to create a directory for each build
80of wxWidgets - you may also want to create different versions of wxWidgets
81and test them concurrently. Most typically, this would be a version configured
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:
86
87mkdir buildmotif
88cd buildmotif
89../configure --with-motif
90make
91cd ..
92
93mkdir buildgtk
94cd buildgtk
95../configure --with-gtk
96make
97cd ..
98
99mkdir buildgtkd
100cd buildgtkd
101../configure --with-gtk --enable-debug
102make
103cd ..
104
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
108* The simplest errors
109---------------------
110
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.
115
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.
121
122* The simplest program
123----------------------
124
125Now create your super-application myfoo.app and compile anywhere with
126
127g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
128
129* General
130---------
131
132The Unix variants of wxWidgets use GNU configure. If you have problems with
133your make use GNU make instead.
134
135If you have general problems with installation, see the wxWidgets website at
136
137 http://www.wxwidgets.org/
138
139for newest information. If you still don't have any success, please send a bug
140report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF
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...
144
145* GUI libraries
146---------------
147
148wxWidgets/Motif requires the Motif library to be installed on your system. As
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
154 http://www.lesstif.org/
155
156* Additional libraries
157----------------------
158
159wxWidgets/Motif requires a thread library and X libraries known to work with
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
162many aspects. As of writing this, virtually all Linux distributions have
163correct glibc 2 support.
164
165You can disable thread support by running
166
167./configure --disable-threads
168make
169su <type root password>
170make install
171ldconfig
172exit
173
174* Building wxMotif on OS/2
175--------------------------
176
177Please send comments and question about the OS/2 installation
178to Stefan Neis <Stefan.Neis@t-online.de> and patches to
179the wxWidgets mailing list.
180
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.
184
185You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer),
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),
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.
194
195Open an OS/2 prompt and switch to the directory above.
196Set MAKESHELL or MAKE_SHELL (which one is needed depends on the version of
197make) to a Unix like shell, e.g.
198SET MAKESHELL=ash
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.
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
205
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.
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
216* Building wxMotif on SGI
217-------------------------
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* Building wxMotif on Cygwin
235----------------------------
236
237The normal build instructions should work fine on Cygwin. The one difference
238with Cygwin is that when using the "--enable-shared" configure option (which
239is the default) the API is exported explicitly using __declspec(dllexport)
240rather than all global symbols being available.
241
242This shouldn't make a difference using the library and should be a little
243more efficient. However if an export attribute has been missed somewhere you
244will see linking errors. If this happens then you can work around the
245problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know
246about it on the wx-dev mailing list.
247
248* Create your configuration
249---------------------------
250
251Usage:
252 ./configure [options]
253
254If you want to use system's C and C++ compiler,
255set environment variables CXX and CC as
256
257 % setenv CC cc
258 % setenv CXX CC
259 % ./configure options
260
261to see all the options please use:
262
263 ./configure --help
264
265The basic philosophy is that if you want to use different
266configurations, like a debug and a release version,
267or use the same source tree on different systems,
268you have only to change the environment variable OSTYPE.
269(Sadly this variable is not set by default on some systems
270in some shells - on SGI's for example). So you will have to
271set it there. This variable HAS to be set before starting
272configure, so that it knows which system it tries to
273configure for.
274
275Configure will complain if the system variable OSTYPE has
276not been defined. And Make in some circumstances as well...
277
278
279* General options
280-------------------
281
282Given below are the commands to change the default behaviour,
283i.e. if it says "--disable-threads" it means that threads
284are enabled by default.
285
286Many of the configure options have been thoroughly tested
287in wxWidgets snapshot 6, but not yet all (ODBC not).
288
289You have to add --with-motif on platforms, where Motif is
290not the default (on Linux, configure will default to GTK).
291
292 --with-motif Use either Motif or Lesstif
293 Configure will look for both.
294
295The following options handle the kind of library you want to build.
296
297 --disable-threads Compile without thread support. Threads
298 support is also required for the
299 socket code to work.
300
301 --disable-shared Do not create shared libraries.
302
303 --enable-monolithic Build wxWidgets as single library instead
304 of as several smaller libraries (which is
305 the default since wxWidgets 2.5.0).
306
307 --disable-optimise Do not optimise the code. Can
308 sometimes be useful for debugging
309 and is required on some architectures
310 such as Sun with gcc 2.8.X which
311 would otherwise produce segvs.
312
313 --enable-profile Add profiling info to the object
314 files. Currently broken, I think.
315
316 --enable-no_rtti Enable compilation without creation of
317 C++ RTTI information in object files.
318 This will speed-up compilation and reduce
319 binary size.
320
321 --enable-no_exceptions Enable compilation without creation of
322 C++ exception information in object files.
323 This will speed-up compilation and reduce
324 binary size. Also fewer crashes during the
325 actual compilation...
326
327 --enable-no_deps Enable compilation without creation of
328 dependency information.
329
330 --enable-permissive Enable compilation without checking for strict
331 ANSI conformance. Useful to prevent the build
332 dying with errors as soon as you compile with
333 Solaris' ANSI-defying headers.
334
335 --enable-mem_tracing Add built-in memory tracing.
336
337 --enable-dmalloc Use the dmalloc memory debugger.
338 Read more at www.letters.com/dmalloc/
339
340 --enable-debug Equivalent to --enable-debug_info plus
341 --enable-debug-flag.
342
343 --enable-debug_info Add debug info to object files and
344 executables for use with debuggers
345 such as gdb (or its many frontends).
346
347 --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
348 compiling. This enable wxWidgets' very
349 useful internal debugging tricks (such
350 as automatically reporting illegal calls)
351 to work. Note that program and library
352 must be compiled with the same debug
353 options.
354
355* Feature Options
356-----------------
357
358Many of the configure options have been thoroughly tested
359in wxWidgets snapshot 6, but not yet all (ODBC not).
360
361When producing an executable that is linked statically with wxGTK
362you'll be surprised at its immense size. This can sometimes be
363drastically reduced by removing features from wxWidgets that
364are not used in your program. The most relevant such features
365are
366
367 --without-libpng Disables PNG image format code.
368
369 --without-libjpeg Disables JPEG image format code.
370
371 --without-odbc Disables ODBC code.
372
373 --without-libtiff Disables TIFF image format code.
374
375 --without-expat Disable XML classes based on Expat parser.
376
377 --disable-threads Disables threads. Will also
378 disable sockets.
379
380 --disable-sockets Disables sockets.
381
382 --disable-dnd Disables Drag'n'Drop.
383
384 --disable-clipboard Disables Clipboard.
385
386 --disable-streams Disables the wxStream classes.
387
388 --disable-file Disables the wxFile class.
389
390 --disable-textfile Disables the wxTextFile class.
391
392 --disable-intl Disables the internationalisation.
393
394 --disable-validators Disables validators.
395
396 --disable-accel Disables accel.
397
398Apart from disabling certain features you can very often "strip"
399the program of its debugging information resulting in a significant
400reduction in size.
401
402Please see the output of "./configure --help" for comprehensive list
403of all configurable options.
404
405
406* Compiling
407-----------
408
409The following must be done in the base directory (e.g. ~/wxMotif
410or ~/wxWin or whatever)
411
412Now the makefiles are created (by configure) and you can compile
413the library by typing:
414
415 make
416
417make yourself some coffee, as it will take some time. On an old
418Pentium 200 around 40 minutes. During compilation, you may get a few
419warning messages depending in your compiler.
420
421If you want to be more selective, you can change into a specific
422directory and type "make" there.
423
424Then you may install the library and its header files under
425/usr/local/include/wx and /usr/local/lib respectively. You
426have to log in as root (i.e. run "su" and enter the root
427password) and type
428
429 make install
430
431You can remove any traces of wxWidgets by typing
432
433 make uninstall
434
435If you want to save disk space by removing unnecessary
436object-files:
437
438 make clean
439
440in the various directories will do the work for you.
441
442* Creating a new Project
443------------------------
444
4451) The first way uses the installed libraries and header files
446automatically using wx-config
447
448g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo
449
450Using this way, a make file for the minimal sample would look
451like this
452
453CXX = g++
454
455minimal: minimal.o
456 $(CXX) -o minimal minimal.o `wx-config --libs`
457
458minimal.o: minimal.cpp mondrian.xpm
459 $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
460
461clean:
462 rm -f *.o minimal
463
464This is certain to become the standard way unless we decide
465to stick to tmake.
466
467If your application uses only some of wxWidgets libraries, you can
468specify required libraries when running wx-config. For example,
469`wx-config --libs=html,core` will only output link command to link
470with libraries required by core GUI classes and wxHTML classes. See
471the manual for more information on the libraries.
472
4732) The other way creates a project within the source code
474directories of wxWidgets. For this endeavour, you'll need
475GNU autoconf version 2.14 and add an entry to your Makefile.in
476to the bottom of the configure.in script and run autoconf
477and configure before you can type make.
478
479* Further notes by Julian Smart
480---------------------------------
481
482- You may find the following script useful for compiling wxMotif,
483 especially if installing from zips (which don't preserve file
484 permissions). Make this script executable with the command
485 chmod a+x makewxmotif.
486
487 -------:x-----Cut here-----:x-----
488 # makewxmotif
489 # Sets permissions (in case we extracted wxMotif from zip files)
490 # and makes wxMotif.
491 # Call from top-level wxWidgets directory.
492 # Note that this uses standard (but commonly-used) configure options;
493 # if you're feeling brave, you may wish to compile with threads:
494 # if they're not supported by the target platform, they will be disabled
495 # anyhow
496 # -- Julian Smart
497 chmod a+x configure config.sub config.guess
498 ./configure --with-shared --with-motif --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc
499 make
500 -------:x-----Cut here-----:x-----
501
502 This script will build wxMotif using shared libraries. If you want to build
503 a static wxWidgets library, use --disable-shared.
504
505Troubleshooting
506---------------
507
508- Solaris compilation with gcc: if the compiler has problems with the variable
509 argument functions, try putting the gcc fixinclude file paths early in the
510 include path.
511
512- If you operator-related compile errors or strange memory problems
513 (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
514 and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
515
516- If you get an internal compiler error in gcc, turn off optimisations.
517
518- Problems with XtDestroyWidget crashing in ~wxWindow have been
519 reported on SGI IRIX 6.4. This has not yet been resolved, so
520 any advice here would be very welcome. See bugs.txt for a
521 possible temporary workaround (comment out the final
522 XtDestroyWidget from ~wxWindow in window.cpp).
523
524- Some compilers, such as Sun C++, may give a lot of warnings about
525 virtual functions being hidden. Please ignore these, it's correct C++ syntax.
526 If you find any incorrect instances, though, such as a
527 missing 'const' in an overridden function, please let us know.
528
529Other Notes
530-----------
531
532- Using configure will create a release build of the library by
533 default: it's recommended to use --enable-debug configure switch
534 while developing your application. To compile in non-debug mode, use
535 --disable-debug configure switch.
536
537Bug reports
538-----------
539
540Please send bug reports with a description of your environment,
541compiler and the error message(s) to the wxwin-developers mailing list at:
542
543 wx-dev@lists.wxwidgets.org
544
545Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999.
546