]>
Commit | Line | Data |
---|---|---|
1 | wxWindows 2.5 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.5.0, gcc 2.95.4, Redhat 6.1 | |
15 | ||
16 | First 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 | wxWindows-HTML.zip or wxWindows-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 wxWindows (recommended). | |
34 | ||
35 | - You can now use configure to build wxWindows and the samples. | |
36 | ||
37 | Using configure is the recommended 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.wxwindows.org. | |
41 | ||
42 | ||
43 | COMPILING USING CONFIGURE | |
44 | ========================= | |
45 | ||
46 | * The simplest case | |
47 | ------------------- | |
48 | ||
49 | If you compile wxWindows on Linux for the first time and don't like to read | |
50 | install 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 | ||
59 | Afterwards you can continue with | |
60 | ||
61 | > make | |
62 | > su <type root password> | |
63 | > make install | |
64 | > ldconfig | |
65 | > exit | |
66 | ||
67 | If 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 | ||
77 | If you want to do some more serious cross-platform programming with wxWindows, | |
78 | such as for GTK and Motif, you can now build two complete libraries and use | |
79 | them concurrently. For this end, you have to create a directory for each build | |
80 | of wxWindows - you may also want to create different versions of wxWindows | |
81 | and test them concurrently. Most typically, this would be a version configured | |
82 | with --enable-debug_flag and one without. Note, that only one build can | |
83 | currently be installed, so you'd have to use local version of the library for | |
84 | that purpose. For building three versions (one GTK, one Motif and a debug | |
85 | version of the GTK source) you'd do this: | |
86 | ||
87 | md buildmotif | |
88 | cd buildmotif | |
89 | ../configure --with-motif | |
90 | make | |
91 | cd .. | |
92 | ||
93 | md buildgtk | |
94 | cd buildgtk | |
95 | ../configure --with-gtk | |
96 | make | |
97 | cd .. | |
98 | ||
99 | md buildgtkd | |
100 | cd buildgtkd | |
101 | ../configure --with-gtk --enable-debug_flag | |
102 | make | |
103 | cd .. | |
104 | ||
105 | * The simplest errors | |
106 | --------------------- | |
107 | ||
108 | You get errors during compilation: The reason is that you probably have a | |
109 | broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause | |
110 | problems due to incomplete support for C++ and optimisation bugs. Best to use | |
111 | GCC 2.95 or later. | |
112 | ||
113 | You get immediate segfault when starting any sample or application: This is | |
114 | either due to having compiled the library with different flags or options than | |
115 | your program - typically you might have the __WXDEBUG__ option set for the | |
116 | library but not for your program - or due to using a compiler with optimisation | |
117 | bugs. | |
118 | ||
119 | * The simplest program | |
120 | ---------------------- | |
121 | ||
122 | Now create your super-application myfoo.app and compile anywhere with | |
123 | ||
124 | g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo | |
125 | ||
126 | * General | |
127 | --------- | |
128 | ||
129 | The Unix variants of wxWindows use GNU configure. If you have problems with | |
130 | your make use GNU make instead. | |
131 | ||
132 | If you have general problems with installation, see the wxWindows website at | |
133 | ||
134 | http://www.wxwindows.org/ | |
135 | ||
136 | for newest information. If you still don't have any success, please send a bug | |
137 | report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF | |
138 | YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF MOTIF, WXMOTIF, WHAT | |
139 | DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, | |
140 | but I tried... | |
141 | ||
142 | * GUI libraries | |
143 | --------------- | |
144 | ||
145 | wxWindows/Motif requires the Motif library to be installed on your system. As | |
146 | an alternative, you may also use the free library "lesstif" which implements | |
147 | most of the Motif API without the licence restrictions of Motif. | |
148 | ||
149 | You can get the newest version of the Lesstif from the lesstif homepage at: | |
150 | ||
151 | http://www.lesstif.org | |
152 | ||
153 | * Additional libraries | |
154 | ---------------------- | |
155 | ||
156 | wxWindows/Motif requires a thread library and X libraries known to work with | |
157 | threads. This is the case on all commercial Unix-Variants and all | |
158 | Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in | |
159 | many aspects. As of writing this, these Linux distributions have correct glibc | |
160 | 2 support: | |
161 | ||
162 | - RedHat 5.1 | |
163 | - Debian 2.0 and 3.0 | |
164 | - Stampede | |
165 | - DLD 6.0 | |
166 | - SuSE 6.0 | |
167 | ||
168 | You can disable thread support by running | |
169 | ||
170 | ./configure --disable-threads | |
171 | make | |
172 | su <type root password> | |
173 | make install | |
174 | ldconfig | |
175 | exit | |
176 | ||
177 | * Building wxMotif on OS/2 | |
178 | -------------------------- | |
179 | ||
180 | Please send comments and question about the OS/2 installation | |
181 | to Andrea Venturoli <a.ventu@flashnet.it> and patches to | |
182 | the wxWindows mailing list. | |
183 | ||
184 | You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer), | |
185 | Lesstif (0.89.1 or newer), emx (0.9d fix 1), flex (2.5.4), | |
186 | yacc (1.8), unix like shell, e.g. korn shell (5.2.13), | |
187 | Autoconf (2.13), GNU file utilities (3.6), | |
188 | GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4), | |
189 | sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1). | |
190 | ||
191 | Open an OS/2 prompt and switch to the directory above. | |
192 | First set some global environment variables we need: | |
193 | ||
194 | SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__ | |
195 | SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__ | |
196 | SET OSTYPE=OS2X | |
197 | SET COMSPEC=sh | |
198 | ||
199 | Notice you can choose whatever you want, if you don't like OS2X. | |
200 | ||
201 | Now, run autoconf in the main directory and in the samples, demos | |
202 | and utils subdirectory. This will generate the OS/2 specific | |
203 | versions of the configure scripts. Now run | |
204 | configure --with-motif | |
205 | as described above. | |
206 | ||
207 | To verify Lesstif installation, configure will try to compile a | |
208 | sample program that requires X headers/libraries to be either | |
209 | available via C_INCLUDE_PATH and LIBRARY_PATH or you need to | |
210 | explicitly set CFLAGS prior to running configure. | |
211 | ||
212 | If you have pthreads library installed, it will be autodetected | |
213 | and the library will be compiled with thread-support. | |
214 | ||
215 | Note that configure assumes your flex will generate files named | |
216 | "lexyy.c", not "lex.yy.c". If you have a version which does | |
217 | generate "lex.yy.c", you need to manually change the generated | |
218 | makefile. | |
219 | ||
220 | * Building wxMotif on SGI | |
221 | ------------------------- | |
222 | ||
223 | Using the SGI native compilers, it is recommended that you | |
224 | also set CFLAGS and CXXFLAGS before running configure. These | |
225 | should be set to : | |
226 | ||
227 | CFLAGS="-mips3 -n32" | |
228 | CXXFLAGS="-mips3 -n32" | |
229 | ||
230 | This is essential if you want to use the resultant binaries | |
231 | on any other machine than the one it was compiled on. If you | |
232 | have a 64bit machine (Octane) you should also do this to ensure | |
233 | you don't accidently build the libraries as 64bit (which is | |
234 | untested). | |
235 | ||
236 | The SGI native compiler support has only been tested on Irix 6.5. | |
237 | ||
238 | * Create your configuration | |
239 | --------------------------- | |
240 | ||
241 | Usage: | |
242 | ./configure [options] | |
243 | ||
244 | If you want to use system's C and C++ compiler, | |
245 | set environment variables CXX and CC as | |
246 | ||
247 | % setenv CC cc | |
248 | % setenv CXX CC | |
249 | % ./configure options | |
250 | ||
251 | to see all the options please use: | |
252 | ||
253 | ./configure --help | |
254 | ||
255 | The basic philosophy is that if you want to use different | |
256 | configurations, like a debug and a release version, | |
257 | or use the same source tree on different systems, | |
258 | you have only to change the environment variable OSTYPE. | |
259 | (Sadly this variable is not set by default on some systems | |
260 | in some shells - on SGI's for example). So you will have to | |
261 | set it there. This variable HAS to be set before starting | |
262 | configure, so that it knows which system it tries to | |
263 | configure for. | |
264 | ||
265 | Configure will complain if the system variable OSTYPE has | |
266 | not been defined. And Make in some circumstances as well... | |
267 | ||
268 | ||
269 | * General options | |
270 | ------------------- | |
271 | ||
272 | Given below are the commands to change the default behaviour, | |
273 | i.e. if it says "--disable-threads" it means that threads | |
274 | are enabled by default. | |
275 | ||
276 | Many of the configure options have been thoroughly tested | |
277 | in wxWindows snapshot 6, but not yet all (ODBC not). | |
278 | ||
279 | You have to add --with-motif on platforms, where Motif is | |
280 | not the default (on Linux, configure will default to GTK). | |
281 | ||
282 | --with-motif Use either Motif or Lesstif | |
283 | Configure will look for both. | |
284 | ||
285 | The 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 | ||
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 | ||
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 | ||
326 | --enable-debug_info Add debug info to object files and | |
327 | executables for use with debuggers | |
328 | such as gdb (or its many frontends). | |
329 | ||
330 | --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when | |
331 | compiling. This enable wxWindows' very | |
332 | useful internal debugging tricks (such | |
333 | as automatically reporting illegal calls) | |
334 | to work. Note that program and library | |
335 | must be compiled with the same debug | |
336 | options. | |
337 | ||
338 | * Feature Options | |
339 | ----------------- | |
340 | ||
341 | Many of the configure options have been thoroughly tested | |
342 | in wxWindows snapshot 6, but not yet all (ODBC not). | |
343 | ||
344 | When producing an executable that is linked statically with wxGTK | |
345 | you'll be surprised at its immense size. This can sometimes be | |
346 | drastically reduced by removing features from wxWindows that | |
347 | are not used in your program. The most relevant such features | |
348 | are | |
349 | ||
350 | --without-libpng Disables PNG image format code. | |
351 | ||
352 | --without-libjpeg Disables JPEG image format code. | |
353 | ||
354 | { --without-odbc Disables ODBC code. Not yet. } | |
355 | ||
356 | --disable-resources Disables the use of *.wxr type | |
357 | resources. | |
358 | ||
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 | ||
368 | --disable-serial Disables object instance serialisation. | |
369 | ||
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 | ||
382 | Apart from disabling certain features you can very often "strip" | |
383 | the program of its debugging information resulting in a significant | |
384 | reduction in size. | |
385 | ||
386 | * Compiling | |
387 | ----------- | |
388 | ||
389 | The following must be done in the base directory (e.g. ~/wxMotif | |
390 | or ~/wxWin or whatever) | |
391 | ||
392 | Now the makefiles are created (by configure) and you can compile | |
393 | the library by typing: | |
394 | ||
395 | make | |
396 | ||
397 | make yourself some coffee, as it will take some time. On an old | |
398 | 386SX possibly two weeks. During compilation, you'll get a few | |
399 | warning messages depending in your compiler. | |
400 | ||
401 | If you want to be more selective, you can change into a specific | |
402 | directory and type "make" there. | |
403 | ||
404 | Then you may install the library and its header files under | |
405 | /usr/local/include/wx and /usr/local/lib respectively. You | |
406 | have to log in as root (i.e. run "su" and enter the root | |
407 | password) and type | |
408 | ||
409 | make install | |
410 | ||
411 | You can remove any traces of wxWindows by typing | |
412 | ||
413 | make uninstall | |
414 | ||
415 | If you want to save disk space by removing unnecessary | |
416 | object-files: | |
417 | ||
418 | make clean | |
419 | ||
420 | in the various directories will do the work for you. | |
421 | ||
422 | * Creating a new Project | |
423 | ------------------------ | |
424 | ||
425 | 1) The first way uses the installed libraries and header files | |
426 | automatically using wx-config | |
427 | ||
428 | g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo | |
429 | ||
430 | Using this way, a make file for the minimal sample would look | |
431 | like this | |
432 | ||
433 | CXX = g++ | |
434 | ||
435 | minimal: minimal.o | |
436 | $(CXX) -o minimal minimal.o `wx-config --libs` | |
437 | ||
438 | minimal.o: minimal.cpp mondrian.xpm | |
439 | $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o | |
440 | ||
441 | clean: | |
442 | rm -f *.o minimal | |
443 | ||
444 | This is certain to become the standard way unless we decide | |
445 | to stick to tmake. | |
446 | ||
447 | 2) The other way creates a project within the source code | |
448 | directories of wxWindows. For this endeavour, you'll need | |
449 | GNU autoconf version 2.14 and add an entry to your Makefile.in | |
450 | to the bottom of the configure.in script and run autoconf | |
451 | and configure before you can type make. | |
452 | ||
453 | * Further notes by Julian Smart | |
454 | --------------------------------- | |
455 | ||
456 | - You may find the following script useful for compiling wxMotif, | |
457 | especially if installing from zips (which don't preserve file | |
458 | permissions). Make this script executable with the command | |
459 | chmod a+x makewxmotif. | |
460 | ||
461 | -------:x-----Cut here-----:x----- | |
462 | # makewxmotif | |
463 | # Sets permissions (in case we extracted wxMotif from zip files) | |
464 | # and makes wxMotif. | |
465 | # Call from top-level wxWindows directory. | |
466 | # Note that this uses standard (but commonly-used) configure options; | |
467 | # if you're feeling brave, you may wish to compile with threads: | |
468 | # if they're not supported by the target platform, they will be disabled | |
469 | # anyhow | |
470 | # -- Julian Smart | |
471 | chmod a+x configure config.sub config.guess | |
472 | ./configure --with-shared --with-motif --without-gtk --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc | |
473 | make | |
474 | -------:x-----Cut here-----:x----- | |
475 | ||
476 | This script will build wxMotif using shared libraries. If you want to build | |
477 | a static wxWindows library, use --disable-shared. | |
478 | ||
479 | Troubleshooting | |
480 | --------------- | |
481 | ||
482 | - Solaris compilation with gcc: if the compiler has problems with the variable | |
483 | argument functions, try putting the gcc fixinclude file paths early in the | |
484 | include path. | |
485 | ||
486 | - If you operator-related compile errors or strange memory problems | |
487 | (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS | |
488 | and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile. | |
489 | ||
490 | - If you get an internal compiler error in gcc, turn off optimisations. | |
491 | ||
492 | - Problems with XtDestroyWidget crashing in ~wxWindow have been | |
493 | reported on SGI IRIX 6.4. This has not yet been resolved, so | |
494 | any advice here would be very welcome. See bugs.txt for a | |
495 | possible temporary workaround (comment out the final | |
496 | XtDestroyWidget from ~wxWindow in window.cpp). | |
497 | ||
498 | - Some compilers, such as Sun C++, may give a lot of warnings about | |
499 | virtual functions being hidden. Please ignore these, it's correct C++ syntax. | |
500 | If you find any incorrect instances, though, such as a | |
501 | missing 'const' in an overridden function, please let us know. | |
502 | ||
503 | Other Notes | |
504 | ----------- | |
505 | ||
506 | - Debugging mode is switched on by default in the makefiles, but using | |
507 | configure will create a release build of the library by default: it's | |
508 | recommended to use --with-debug_info and --with-debug_flag configure | |
509 | switches while developing your application. To compile in non-debug | |
510 | mode, remove the -D__WXDEBUG__ switch in make.env (or if using the | |
511 | configure system, change --with-debug_flag to --without_debug_flag | |
512 | and --with-debug_info to --without-debug_info in the makewxmotif | |
513 | script). | |
514 | ||
515 | Bug reports | |
516 | ----------- | |
517 | ||
518 | Please send bug reports with a description of your environment, | |
519 | compiler and the error message(s) to the wxwin-developers mailing list at: | |
520 | ||
521 | wx-dev@lists.wxwindows.org | |
522 | ||
523 | Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999. | |
524 |