]>
Commit | Line | Data |
---|---|---|
42280e48 | 1 | wxWindows 2.5 for X11 installation |
b55a176b | 2 | ---------------------------------- |
1cf13934 JS |
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. | |
b55a176b | 11 | |
1cf13934 JS |
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: wxX11 2.5.0, gcc 2.95.4, Redhat 6.2 |
1cf13934 JS |
15 | |
16 | First steps | |
17 | ----------- | |
18 | ||
42280e48 | 19 | - Download wxX11-x.y.z.tgz, where x.y.z is the version number. |
1cf13934 JS |
20 | Download documentation in a preferred format, such as |
21 | wxWindows-HTML.zip or wxWindows-PDF.zip. | |
22 | ||
23 | - Make a directory such as ~/wx and unarchive the files into this | |
24 | directory. | |
25 | ||
26 | - It is recommended that you install bison and flex; using yacc | |
27 | and lex may require tweaking of the makefiles. You also need | |
28 | libXpm if you want to have XPM support in wxWindows (recommended). | |
29 | ||
30 | - You can now use configure to build wxWindows and the samples. | |
31 | ||
32 | Using configure is the recommended way to build the library. If it doesn't | |
33 | work for you for whatever reason, please report it (together with detailed | |
34 | information about your platform and the (relevant part of) contents of | |
35 | config.log file) to wx-dev@lists.wxwindows.org. | |
36 | ||
37 | COMPILING USING CONFIGURE | |
38 | ========================= | |
39 | ||
b55a176b JS |
40 | * The simplest case |
41 | ------------------- | |
1cf13934 JS |
42 | |
43 | If you compile wxWindows on Linux for the first time and don't like to read | |
44 | install instructions just do (in the base dir): | |
45 | ||
ea596687 | 46 | > ./configure --with-x11 |
1cf13934 JS |
47 | > make |
48 | > su <type root password> | |
49 | > make install | |
50 | > ldconfig | |
51 | > exit | |
52 | ||
53 | Afterwards you can continue with | |
54 | ||
55 | > make | |
56 | > su <type root password> | |
57 | > make install | |
58 | > ldconfig | |
59 | > exit | |
60 | ||
61 | If you want to remove wxWindows on Unix you can do this: | |
62 | ||
63 | > su <type root password> | |
64 | > make uninstall | |
65 | > ldconfig | |
66 | > exit | |
67 | ||
68 | * The expert case | |
69 | ----------------- | |
70 | ||
71 | If you want to do some more serious cross-platform programming with wxWindows, | |
72 | such as for GTK and X11, you can now build two complete libraries and use | |
2edb0bde | 73 | them concurrently. For this end, you have to create a directory for each build |
1cf13934 JS |
74 | of wxWindows - you may also want to create different versions of wxWindows |
75 | and test them concurrently. Most typically, this would be a version configured | |
b55a176b JS |
76 | with --enable-debug_flag and one without. Note, that only one build can |
77 | currently be installed, so you'd have to use local version of the library for | |
78 | that purpose. | |
79 | ||
1cf13934 JS |
80 | For building three versions (one GTK, one X11 and a debug version of the GTK |
81 | source) you'd do this: | |
82 | ||
83 | md buildx11 | |
84 | cd buildx11 | |
b55a176b | 85 | ../configure --with-x11 |
1cf13934 JS |
86 | make |
87 | cd .. | |
88 | ||
89 | md buildgtk | |
90 | cd buildgtk | |
91 | ../configure --with-gtk | |
92 | make | |
93 | cd .. | |
94 | ||
95 | md buildgtkd | |
96 | cd buildgtkd | |
97 | ../configure --with-gtk --enable-debug_flag | |
98 | make | |
99 | cd .. | |
100 | ||
b55a176b JS |
101 | * The simplest errors |
102 | --------------------- | |
1cf13934 | 103 | |
b55a176b JS |
104 | You get errors during compilation: The reason is that you probably have a |
105 | broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause | |
106 | problems due to incomplete support for C++ and optimisation bugs. Best to use | |
107 | GCC 2.95 or later. | |
1cf13934 | 108 | |
b55a176b JS |
109 | You get immediate segfault when starting any sample or application: This is |
110 | either due to having compiled the library with different flags or options than | |
111 | your program - typically you might have the __WXDEBUG__ option set for the | |
112 | library but not for your program - or due to using a compiler with optimisation | |
113 | bugs. | |
1cf13934 | 114 | |
b55a176b JS |
115 | * The simplest program |
116 | ---------------------- | |
1cf13934 | 117 | |
b55a176b | 118 | Now create your super-application myfoo.cpp and compile anywhere with |
1cf13934 | 119 | |
b55a176b | 120 | g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo |
1cf13934 JS |
121 | |
122 | * General | |
b55a176b | 123 | --------- |
1cf13934 | 124 | |
b55a176b JS |
125 | The Unix variants of wxWindows use GNU configure. If you have problems with |
126 | your make use GNU make instead. | |
1cf13934 | 127 | |
b55a176b | 128 | If you have general problems with installation, see the wxWindows website at |
1cf13934 | 129 | |
b55a176b | 130 | http://www.wxwindows.org/ |
1cf13934 JS |
131 | |
132 | for newest information. If you still don't have any success, please send a bug | |
133 | report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF | |
b55a176b | 134 | YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF X, WHAT DISTRIBUTION |
1cf13934 JS |
135 | YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried... |
136 | ||
137 | * GUI libraries | |
b55a176b | 138 | --------------- |
1cf13934 | 139 | |
b55a176b | 140 | wxWindows/X11 requires the X11 library to be installed on your system. |
1cf13934 JS |
141 | |
142 | * Additional libraries | |
b55a176b | 143 | ---------------------- |
1cf13934 | 144 | |
b55a176b JS |
145 | wxWindows/X11 requires a thread library and X libraries known to work with |
146 | threads. This is the case on all commercial Unix-Variants and all | |
147 | Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in | |
148 | many aspects. As of writing this, these Linux distributions have correct glibc | |
149 | 2 support: | |
1cf13934 JS |
150 | |
151 | - RedHat 5.1 | |
b55a176b | 152 | - Debian 2.0 and 3.0 |
1cf13934 JS |
153 | - Stampede |
154 | - DLD 6.0 | |
155 | - SuSE 6.0 | |
156 | ||
157 | You can disable thread support by running | |
158 | ||
b55a176b | 159 | ./configure --disable-threads |
1cf13934 JS |
160 | make |
161 | su <type root password> | |
162 | make install | |
163 | ldconfig | |
164 | exit | |
165 | ||
b55a176b JS |
166 | * Building wxX11 on OS/2 |
167 | ------------------------ | |
1cf13934 JS |
168 | |
169 | Please send comments and question about the OS/2 installation | |
170 | to Andrea Venturoli <a.ventu@flashnet.it> and patches to | |
171 | the wxWindows mailing list. | |
172 | ||
173 | You'll need OS/2 Warp (4.00FP#6), X-Free86/2 (3.3.3 or newer), | |
b55a176b JS |
174 | emx (0.9d fix 1), flex (2.5.4), yacc (1.8), unix like shell, |
175 | e.g. korn shell (5.2.13), Autoconf (2.13), GNU file utilities (3.6), | |
1cf13934 JS |
176 | GNU text utilities (1.3), GNU shell utilites (1.12), m4 (1.4), |
177 | sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.76.1). | |
178 | ||
179 | Open an OS/2 prompt and switch to the directory above. | |
180 | First set some global environment variables we need: | |
181 | ||
182 | SET CXXFLAGS=-Zmtd -D__ST_MT_ERRNO__ | |
183 | SET CFLAGS=-Zmtd -D__ST_MT_ERRNO__ | |
184 | SET OSTYPE=OS2X | |
185 | SET COMSPEC=sh | |
186 | ||
187 | Notice you can choose whatever you want, if you don't like OS2X. | |
188 | ||
189 | Now, run autoconf in the main directory and in the samples, demos | |
190 | and utils subdirectory. This will generate the OS/2 specific | |
191 | versions of the configure scripts. Now run | |
192 | configure --with-x11 | |
193 | as described above. | |
194 | ||
b55a176b | 195 | To verify X11 installation, configure will try to compile a |
1cf13934 JS |
196 | sample program that requires X headers/libraries to be either |
197 | available via C_INCLUDE_PATH and LIBRARY_PATH or you need to | |
198 | explicitly set CFLAGS prior to running configure. | |
199 | ||
200 | If you have pthreads library installed, it will be autodetected | |
201 | and the library will be compiled with thread-support. | |
202 | ||
203 | Note that configure assumes your flex will generate files named | |
204 | "lexyy.c", not "lex.yy.c". If you have a version which does | |
205 | generate "lex.yy.c", you need to manually change the generated | |
206 | makefile. | |
207 | ||
208 | * Building wxX11 on SGI | |
b55a176b | 209 | ----------------------- |
1cf13934 JS |
210 | |
211 | Using the SGI native compilers, it is recommended that you | |
212 | also set CFLAGS and CXXFLAGS before running configure. These | |
213 | should be set to : | |
214 | ||
215 | CFLAGS="-mips3 -n32" | |
216 | CXXFLAGS="-mips3 -n32" | |
217 | ||
218 | This is essential if you want to use the resultant binaries | |
219 | on any other machine than the one it was compiled on. If you | |
220 | have a 64bit machine (Octane) you should also do this to ensure | |
221 | you don't accidently build the libraries as 64bit (which is | |
222 | untested). | |
223 | ||
224 | The SGI native compiler support has only been tested on Irix 6.5. | |
225 | ||
226 | * Create your configuration | |
b55a176b | 227 | --------------------------- |
1cf13934 JS |
228 | |
229 | Usage: | |
b55a176b | 230 | ./configure [options] |
1cf13934 JS |
231 | |
232 | If you want to use system's C and C++ compiler, | |
233 | set environment variables CXX and CC as | |
234 | ||
235 | % setenv CC cc | |
236 | % setenv CXX CC | |
b55a176b | 237 | % ./configure [options] |
1cf13934 JS |
238 | |
239 | to see all the options please use: | |
240 | ||
241 | ./configure --help | |
242 | ||
243 | The basic philosophy is that if you want to use different | |
244 | configurations, like a debug and a release version, | |
245 | or use the same source tree on different systems, | |
246 | you have only to change the environment variable OSTYPE. | |
247 | (Sadly this variable is not set by default on some systems | |
248 | in some shells - on SGI's for example). So you will have to | |
249 | set it there. This variable HAS to be set before starting | |
250 | configure, so that it knows which system it tries to | |
251 | configure for. | |
252 | ||
253 | Configure will complain if the system variable OSTYPE has | |
254 | not been defined. And Make in some circumstances as well... | |
255 | ||
256 | ||
257 | * General options | |
b55a176b | 258 | ----------------- |
1cf13934 JS |
259 | |
260 | Given below are the commands to change the default behaviour, | |
261 | i.e. if it says "--disable-threads" it means that threads | |
262 | are enabled by default. | |
263 | ||
1cf13934 | 264 | You have to add --with-x11 on platforms, where X11 is |
2edb0bde | 265 | not the default (on Linux, configure will default to GTK). |
1cf13934 | 266 | |
b55a176b | 267 | --with-x11 Use X11. |
1cf13934 JS |
268 | |
269 | The following options handle the kind of library you want to build. | |
270 | ||
271 | --disable-threads Compile without thread support. Threads | |
272 | support is also required for the | |
273 | socket code to work. | |
274 | ||
275 | --disable-shared Do not create shared libraries. | |
276 | ||
277 | --disable-optimise Do not optimise the code. Can | |
278 | sometimes be useful for debugging | |
279 | and is required on some architectures | |
280 | such as Sun with gcc 2.8.X which | |
281 | would otherwise produce segvs. | |
282 | ||
283 | --enable-profile Add profiling info to the object | |
284 | files. Currently broken, I think. | |
285 | ||
286 | --enable-no_rtti Enable compilation without creation of | |
287 | C++ RTTI information in object files. | |
288 | This will speed-up compilation and reduce | |
289 | binary size. | |
290 | ||
291 | --enable-no_exceptions Enable compilation without creation of | |
292 | C++ exception information in object files. | |
293 | This will speed-up compilation and reduce | |
294 | binary size. Also fewer crashes during the | |
295 | actual compilation... | |
296 | ||
297 | --enable-no_deps Enable compilation without creation of | |
298 | dependency information. | |
299 | ||
2edb0bde VZ |
300 | --enable-permissive Enable compilation without checking for strict |
301 | ANSI conformance. Useful to prevent the build | |
302 | dying with errors as soon as you compile with | |
303 | Solaris' ANSI-defying headers. | |
1cf13934 JS |
304 | |
305 | --enable-mem_tracing Add built-in memory tracing. | |
306 | ||
307 | --enable-dmalloc Use the dmalloc memory debugger. | |
308 | Read more at www.letters.com/dmalloc/ | |
309 | ||
310 | --enable-debug_info Add debug info to object files and | |
311 | executables for use with debuggers | |
312 | such as gdb (or its many frontends). | |
313 | ||
314 | --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when | |
315 | compiling. This enable wxWindows' very | |
316 | useful internal debugging tricks (such | |
317 | as automatically reporting illegal calls) | |
318 | to work. Note that program and library | |
319 | must be compiled with the same debug | |
320 | options. | |
321 | ||
322 | * Feature Options | |
b55a176b | 323 | ----------------- |
1cf13934 | 324 | |
2edb0bde | 325 | Many of the configure options have been thoroughly tested |
1cf13934 JS |
326 | in wxWindows snapshot 6, but not yet all (ODBC not). |
327 | ||
b55a176b | 328 | When producing an executable that is linked statically with wxX11 |
1cf13934 JS |
329 | you'll be surprised at its immense size. This can sometimes be |
330 | drastically reduced by removing features from wxWindows that | |
331 | are not used in your program. The most relevant such features | |
332 | are | |
333 | ||
334 | --without-libpng Disables PNG image format code. | |
335 | ||
336 | --without-libjpeg Disables JPEG image format code. | |
337 | ||
338 | { --without-odbc Disables ODBC code. Not yet. } | |
339 | ||
340 | --disable-resources Disables the use of *.wxr type | |
341 | resources. | |
342 | ||
343 | --disable-threads Disables threads. Will also | |
344 | disable sockets. | |
345 | ||
346 | --disable-sockets Disables sockets. | |
347 | ||
348 | --disable-dnd Disables Drag'n'Drop. | |
349 | ||
350 | --disable-clipboard Disables Clipboard. | |
351 | ||
2edb0bde | 352 | --disable-serial Disables object instance serialisation. |
1cf13934 JS |
353 | |
354 | --disable-streams Disables the wxStream classes. | |
355 | ||
356 | --disable-file Disables the wxFile class. | |
357 | ||
358 | --disable-textfile Disables the wxTextFile class. | |
359 | ||
360 | --disable-intl Disables the internationalisation. | |
361 | ||
362 | --disable-validators Disables validators. | |
363 | ||
364 | --disable-accel Disables accel. | |
365 | ||
366 | Apart from disabling certain features you can very often "strip" | |
367 | the program of its debugging information resulting in a significant | |
368 | reduction in size. | |
369 | ||
370 | * Compiling | |
b55a176b | 371 | ----------- |
1cf13934 | 372 | |
b55a176b JS |
373 | The following must be done in the base directory (e.g. ~/wxX11 |
374 | or whatever) | |
1cf13934 JS |
375 | |
376 | Now the makefiles are created (by configure) and you can compile | |
377 | the library by typing: | |
378 | ||
379 | make | |
380 | ||
381 | make yourself some coffee, as it will take some time. On an old | |
382 | 386SX possibly two weeks. During compilation, you'll get a few | |
383 | warning messages depending in your compiler. | |
384 | ||
385 | If you want to be more selective, you can change into a specific | |
2edb0bde | 386 | directory and type "make" there. |
1cf13934 | 387 | |
2edb0bde | 388 | Then you may install the library and its header files under |
1cf13934 JS |
389 | /usr/local/include/wx and /usr/local/lib respectively. You |
390 | have to log in as root (i.e. run "su" and enter the root | |
391 | password) and type | |
392 | ||
393 | make install | |
394 | ||
395 | You can remove any traces of wxWindows by typing | |
396 | ||
397 | make uninstall | |
398 | ||
399 | If you want to save disk space by removing unnecessary | |
400 | object-files: | |
401 | ||
b55a176b | 402 | make clean |
1cf13934 JS |
403 | |
404 | in the various directories will do the work for you. | |
405 | ||
406 | * Creating a new Project | |
b55a176b | 407 | ------------------------ |
1cf13934 JS |
408 | |
409 | 1) The first way uses the installed libraries and header files | |
410 | automatically using wx-config | |
411 | ||
b55a176b | 412 | g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo |
1cf13934 JS |
413 | |
414 | Using this way, a make file for the minimal sample would look | |
415 | like this | |
416 | ||
417 | CXX = g++ | |
418 | ||
419 | minimal: minimal.o | |
420 | $(CXX) -o minimal minimal.o `wx-config --libs` | |
421 | ||
422 | minimal.o: minimal.cpp mondrian.xpm | |
b55a176b | 423 | $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o |
1cf13934 JS |
424 | |
425 | clean: | |
426 | rm -f *.o minimal | |
427 | ||
428 | This is certain to become the standard way unless we decide | |
2edb0bde | 429 | to stick to tmake. |
1cf13934 JS |
430 | |
431 | 2) The other way creates a project within the source code | |
432 | directories of wxWindows. For this endeavour, you'll need | |
433 | GNU autoconf version 2.14 and add an entry to your Makefile.in | |
434 | to the bottom of the configure.in script and run autoconf | |
435 | and configure before you can type make. | |
436 | ||
437 | * Further notes by Julian Smart | |
b55a176b | 438 | ------------------------------- |
1cf13934 JS |
439 | |
440 | - You may find the following script useful for compiling wxX11, | |
441 | especially if installing from zips (which don't preserve file | |
442 | permissions). Make this script executable with the command | |
443 | chmod a+x makewxx11. | |
444 | ||
445 | -------:x-----Cut here-----:x----- | |
446 | # makewxx11 | |
447 | # Sets permissions (in case we extracted wxX11 from zip files) | |
448 | # and makes wxX11. | |
449 | # Call from top-level wxWindows directory. | |
450 | # Note that this uses standard (but commonly-used) configure options; | |
451 | # if you're feeling brave, you may wish to compile with threads: | |
452 | # if they're not supported by the target platform, they will be disabled | |
453 | # anyhow | |
454 | # -- Julian Smart | |
455 | chmod a+x configure config.sub config.guess | |
b55a176b | 456 | ./configure --with-x11 --with-shared --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc |
1cf13934 JS |
457 | make |
458 | -------:x-----Cut here-----:x----- | |
459 | ||
460 | This script will build wxX11 using shared libraries. If you want to build | |
461 | a static wxWindows library, use --disable-shared. | |
462 | ||
463 | Troubleshooting | |
464 | --------------- | |
465 | ||
b55a176b JS |
466 | - Solaris compilation with gcc: if the compiler has problems with the variable |
467 | argument functions, try putting the gcc fixinclude file paths early in the | |
468 | include path. | |
1cf13934 JS |
469 | |
470 | - If you operator-related compile errors or strange memory problems | |
471 | (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS | |
472 | and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile. | |
473 | ||
474 | - If you get an internal compiler error in gcc, turn off optimisations. | |
475 | ||
476 | - Some compilers, such as Sun C++, may give a lot of warnings about | |
477 | virtual functions being hidden. Please ignore these, it's correct C++ syntax. | |
478 | If you find any incorrect instances, though, such as a | |
479 | missing 'const' in an overridden function, please let us know. | |
480 | ||
481 | Other Notes | |
482 | ----------- | |
483 | ||
484 | - Debugging mode is switched on by default in the makefiles, but using | |
485 | configure will create a release build of the library by default: it's | |
486 | recommended to use --with-debug_info and --with-debug_flag configure | |
487 | switches while developing your application. To compile in non-debug | |
488 | mode, remove the -D__WXDEBUG__ switch in make.env (or if using the | |
b55a176b | 489 | configure system, change --with-debug_flag to --without-debug_flag |
1cf13934 JS |
490 | and --with-debug_info to --without-debug_info in the makewxx11 |
491 | script). | |
492 | ||
493 | Bug reports | |
494 | ----------- | |
495 | ||
496 | Please send bug reports with a description of your environment, | |
497 | compiler and the error message(s) to the wxwin-developers mailing list at: | |
498 | ||
499 | wx-dev@lists.wxwindows.org | |
500 | ||
501 | Julian Smart, Robert Roebling and Vadim Zeitlin, February 2002. | |
502 |