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