]>
Commit | Line | Data |
---|---|---|
1 | wxWidgets 2.6.2 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 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.6.2, 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 | 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.wxwindows.org. | |
41 | ||
42 | ||
43 | COMPILING USING CONFIGURE | |
44 | ========================= | |
45 | ||
46 | * The simplest case | |
47 | ------------------- | |
48 | ||
49 | If you compile wxWidgets 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 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 | ||
77 | If you want to do some more serious cross-platform programming with wxWidgets, | |
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 wxWidgets - you may also want to create different versions of wxWidgets | |
81 | and test them concurrently. Most typically, this would be a version configured | |
82 | with --enable-debug 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 | mkdir buildmotif | |
88 | cd buildmotif | |
89 | ../configure --with-motif | |
90 | make | |
91 | cd .. | |
92 | ||
93 | mkdir buildgtk | |
94 | cd buildgtk | |
95 | ../configure --with-gtk | |
96 | make | |
97 | cd .. | |
98 | ||
99 | mkdir buildgtkd | |
100 | cd buildgtkd | |
101 | ../configure --with-gtk --enable-debug | |
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 wxWidgets 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 wxWidgets website at | |
133 | ||
134 | http://www.wxwidgets.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 | wxWidgets/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 | wxWidgets/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, virtually all Linux distributions have | |
160 | correct glibc 2 support. | |
161 | ||
162 | You can disable thread support by running | |
163 | ||
164 | ./configure --disable-threads | |
165 | make | |
166 | su <type root password> | |
167 | make install | |
168 | ldconfig | |
169 | exit | |
170 | ||
171 | * Building wxMotif on OS/2 | |
172 | -------------------------- | |
173 | ||
174 | Please send comments and question about the OS/2 installation | |
175 | to Stefan Neis <Stefan.Neis@t-online.de> and patches to | |
176 | the wxWidgets mailing list. | |
177 | ||
178 | In the following list, the version numbers indicate the configuration that | |
179 | was actually used by myself, newer version should cause no problems and | |
180 | even older ones are expected to work most of the time. | |
181 | ||
182 | You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer), | |
183 | Lesstif (0.92.7 or newer), emx (0.9d fix 4), flex (2.5.4), yacc (1.8) or | |
184 | bison (1.25), a Unix like shell (pdksh-5.2.14 or ash), Autoconf (2.57), | |
185 | GNU file utilities (3.13), GNU text utilities (1.19), | |
186 | GNU shell utilites (1.12), m4 (1.4), sed (2.05), grep (2.0), Awk (3.0.3), | |
187 | GNU Make (3.75). | |
188 | ||
189 | Preferably, you should have Posix/2 installed and C(PLUS)_INCLUDE_PATH and | |
190 | LIBRARY_PATH set up accordingly, however, wxGTK will even work without it. | |
191 | Presence of Posix/2 will be auto-detected. | |
192 | ||
193 | Open an OS/2 prompt and switch to the directory above. | |
194 | Set MAKESHELL (and depending on your installation also INSTALL, for me | |
195 | it tends to try to use the system's tcpip\pcomos\install.exe which causes | |
196 | problems...) to a Unix like shell, e.g. | |
197 | SET MAKESHELL=ash | |
198 | ||
199 | Be warned that depending on the precise version of your make, the | |
200 | variable that needs to be set might be MAKE_SHELL instead of MAKESHELL. | |
201 | If you have a really deficient version of GNU make, it might even be | |
202 | necessary to set SHELL or even COMSPEC to a unix like shell as well. | |
203 | ||
204 | Notice that the delivered configure scripts are fully OS/2 aware, so you | |
205 | can simply run | |
206 | ash -c "configure --with-motif" | |
207 | and make and possibly make install as described above. | |
208 | ||
209 | To verify Lesstif installation, configure will try to compile a | |
210 | sample program that requires X headers/libraries to be either | |
211 | available via C_INCLUDE_PATH and LIBRARY_PATH or you need to | |
212 | explicitly set CFLAGS prior to running configure. | |
213 | ||
214 | * Building wxMotif on SGI | |
215 | ------------------------- | |
216 | ||
217 | Using the SGI native compilers, it is recommended that you | |
218 | also set CFLAGS and CXXFLAGS before running configure. These | |
219 | should be set to : | |
220 | ||
221 | CFLAGS="-mips3 -n32" | |
222 | CXXFLAGS="-mips3 -n32" | |
223 | ||
224 | This is essential if you want to use the resultant binaries | |
225 | on any other machine than the one it was compiled on. If you | |
226 | have a 64bit machine (Octane) you should also do this to ensure | |
227 | you don't accidently build the libraries as 64bit (which is | |
228 | untested). | |
229 | ||
230 | The SGI native compiler support has only been tested on Irix 6.5. | |
231 | ||
232 | * Create your configuration | |
233 | --------------------------- | |
234 | ||
235 | Usage: | |
236 | ./configure [options] | |
237 | ||
238 | If you want to use system's C and C++ compiler, | |
239 | set environment variables CXX and CC as | |
240 | ||
241 | % setenv CC cc | |
242 | % setenv CXX CC | |
243 | % ./configure options | |
244 | ||
245 | to see all the options please use: | |
246 | ||
247 | ./configure --help | |
248 | ||
249 | The basic philosophy is that if you want to use different | |
250 | configurations, like a debug and a release version, | |
251 | or use the same source tree on different systems, | |
252 | you have only to change the environment variable OSTYPE. | |
253 | (Sadly this variable is not set by default on some systems | |
254 | in some shells - on SGI's for example). So you will have to | |
255 | set it there. This variable HAS to be set before starting | |
256 | configure, so that it knows which system it tries to | |
257 | configure for. | |
258 | ||
259 | Configure will complain if the system variable OSTYPE has | |
260 | not been defined. And Make in some circumstances as well... | |
261 | ||
262 | ||
263 | * General options | |
264 | ------------------- | |
265 | ||
266 | Given below are the commands to change the default behaviour, | |
267 | i.e. if it says "--disable-threads" it means that threads | |
268 | are enabled by default. | |
269 | ||
270 | Many of the configure options have been thoroughly tested | |
271 | in wxWidgets snapshot 6, but not yet all (ODBC not). | |
272 | ||
273 | You have to add --with-motif on platforms, where Motif is | |
274 | not the default (on Linux, configure will default to GTK). | |
275 | ||
276 | --with-motif Use either Motif or Lesstif | |
277 | Configure will look for both. | |
278 | ||
279 | The 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 | |
283 | socket code to work. | |
284 | ||
285 | --disable-shared Do not create shared libraries. | |
286 | ||
287 | --enable-monolithic Build wxWidgets as single library instead | |
288 | of as several smaller libraries (which is | |
289 | the default since wxWidgets 2.5.0). | |
290 | ||
291 | --disable-optimise Do not optimise the code. Can | |
292 | sometimes be useful for debugging | |
293 | and is required on some architectures | |
294 | such as Sun with gcc 2.8.X which | |
295 | would otherwise produce segvs. | |
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 | ||
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. | |
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 | ||
324 | --enable-debug Equivalent to --enable-debug_info plus | |
325 | --enable-debug-flag. | |
326 | ||
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 | |
332 | compiling. This enable wxWidgets' very | |
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 | |
340 | ----------------- | |
341 | ||
342 | Many of the configure options have been thoroughly tested | |
343 | in wxWidgets snapshot 6, but not yet all (ODBC not). | |
344 | ||
345 | When producing an executable that is linked statically with wxGTK | |
346 | you'll be surprised at its immense size. This can sometimes be | |
347 | drastically reduced by removing features from wxWidgets that | |
348 | are not used in your program. The most relevant such features | |
349 | are | |
350 | ||
351 | --without-libpng Disables PNG image format code. | |
352 | ||
353 | --without-libjpeg Disables JPEG image format code. | |
354 | ||
355 | --without-odbc Disables ODBC code. | |
356 | ||
357 | --without-libtiff Disables TIFF image format code. | |
358 | ||
359 | --without-expat Disable XML classes based on Expat parser. | |
360 | ||
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 | ||
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 | Please see the output of "./configure --help" for comprehensive list | |
387 | of all configurable options. | |
388 | ||
389 | ||
390 | * Compiling | |
391 | ----------- | |
392 | ||
393 | The following must be done in the base directory (e.g. ~/wxMotif | |
394 | or ~/wxWin or whatever) | |
395 | ||
396 | Now the makefiles are created (by configure) and you can compile | |
397 | the library by typing: | |
398 | ||
399 | make | |
400 | ||
401 | make yourself some coffee, as it will take some time. On an old | |
402 | Pentium 200 around 40 minutes. During compilation, you may get a few | |
403 | warning messages depending in your compiler. | |
404 | ||
405 | If you want to be more selective, you can change into a specific | |
406 | directory and type "make" there. | |
407 | ||
408 | Then you may install the library and its header files under | |
409 | /usr/local/include/wx and /usr/local/lib respectively. You | |
410 | have to log in as root (i.e. run "su" and enter the root | |
411 | password) and type | |
412 | ||
413 | make install | |
414 | ||
415 | You can remove any traces of wxWidgets by typing | |
416 | ||
417 | make uninstall | |
418 | ||
419 | If you want to save disk space by removing unnecessary | |
420 | object-files: | |
421 | ||
422 | make clean | |
423 | ||
424 | in the various directories will do the work for you. | |
425 | ||
426 | * Creating a new Project | |
427 | ------------------------ | |
428 | ||
429 | 1) The first way uses the installed libraries and header files | |
430 | automatically using wx-config | |
431 | ||
432 | g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo | |
433 | ||
434 | Using this way, a make file for the minimal sample would look | |
435 | like this | |
436 | ||
437 | CXX = g++ | |
438 | ||
439 | minimal: minimal.o | |
440 | $(CXX) -o minimal minimal.o `wx-config --libs` | |
441 | ||
442 | minimal.o: minimal.cpp mondrian.xpm | |
443 | $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o | |
444 | ||
445 | clean: | |
446 | rm -f *.o minimal | |
447 | ||
448 | This is certain to become the standard way unless we decide | |
449 | to stick to tmake. | |
450 | ||
451 | If your application uses only some of wxWidgets libraries, you can | |
452 | specify required libraries when running wx-config. For example, | |
453 | `wx-config --libs=html,core` will only output link command to link | |
454 | with libraries required by core GUI classes and wxHTML classes. See | |
455 | the manual for more information on the libraries. | |
456 | ||
457 | 2) The other way creates a project within the source code | |
458 | directories of wxWidgets. For this endeavour, you'll need | |
459 | GNU autoconf version 2.14 and add an entry to your Makefile.in | |
460 | to the bottom of the configure.in script and run autoconf | |
461 | and configure before you can type make. | |
462 | ||
463 | * Further notes by Julian Smart | |
464 | --------------------------------- | |
465 | ||
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 | |
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. | |
475 | # Call from top-level wxWidgets directory. | |
476 | # Note that this uses standard (but commonly-used) configure options; | |
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 | |
480 | # -- Julian Smart | |
481 | chmod a+x configure config.sub config.guess | |
482 | ./configure --with-shared --with-motif --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc | |
483 | make | |
484 | -------:x-----Cut here-----:x----- | |
485 | ||
486 | This script will build wxMotif using shared libraries. If you want to build | |
487 | a static wxWidgets library, use --disable-shared. | |
488 | ||
489 | Troubleshooting | |
490 | --------------- | |
491 | ||
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. | |
495 | ||
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. | |
499 | ||
500 | - If you get an internal compiler error in gcc, turn off optimisations. | |
501 | ||
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 | |
505 | possible temporary workaround (comment out the final | |
506 | XtDestroyWidget from ~wxWindow in window.cpp). | |
507 | ||
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 | ||
513 | Other Notes | |
514 | ----------- | |
515 | ||
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. | |
520 | ||
521 | Bug reports | |
522 | ----------- | |
523 | ||
524 | Please send bug reports with a description of your environment, | |
525 | compiler and the error message(s) to the wxwin-developers mailing list at: | |
526 | ||
527 | wx-dev@lists.wxwindows.org | |
528 | ||
529 | Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999. | |
530 |