]> git.saurik.com Git - wxWidgets.git/blame - docs/gtk/install.txt
Fixed wrong include paths for zlib/png/jpeg.
[wxWidgets.git] / docs / gtk / install.txt
CommitLineData
c98f0421
RR
1* The most simple case
2-----------------------
3
a802c3a1
RR
4If you compile wxWindows on Unix for the first time and don't
5like to read install instructions just do (in the base dir):
c98f0421 6
8710cf5c 7./configure
c98f0421 8make
034be888 9su <type root password>
cf7a7e13 10make install
034be888
RR
11ldconfig
12exit
13
cf7a7e13 14
2a29700e
RR
15* The most simple errors
16------------------------
17
034be888 18configure reports, that you don't have GTK 1.X installed
2a29700e
RR
19although you are certainly sure you have. Well, you have
20installed it, but you also have another version of the
21GTK installed, which you may need to removed including
22other versions of glib (and its headers).
23
3502e687
RR
24You get errors during compilation. The reason is that you
25probably have a broken compiler, which includes almost
26everything that is called gcc. If there is just any way
27for you to use egcs, use egcs. We are sorry, but we cannot
3cdda6cd 28fix gcc.
3502e687 29
2a29700e
RR
30* The most simple program
31-------------------------
32
a802c3a1
RR
33Now create your super-application myfoo.app and compile anywhere
34with
cf7a7e13 35
f3cb6592 36g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
c98f0421
RR
37
38* General
39-----------------------
40
a802c3a1
RR
41The Unix variants of wxWindows use GNU configure. If you have
42problems with your make use GNU make instead.
c98f0421 43
a802c3a1
RR
44If you have general problems with installation, read my
45homepage at
c98f0421
RR
46
47 http://wesley.informatik.uni-freiburg.de/~wxxt
48
a802c3a1
RR
49for newest information. If you still don't have any success,
50please send a bug report to one of our mailing lists (see
51my homepage) INCLUDING A DESCRIPTION OF YOUR SYSTEM AND
52YOUR PROBLEM, SUCH AS YOUR VERSION OF GTK, WXGTK, WHAT
53DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know
54this has no effect, but I tried...
c98f0421
RR
55
56* GUI libraries
57-----------------------
58
c67d8618 59wxWindows/GTK requires the GTK+ library to be installed on your system.
93b7364e 60It has to be a stable version, preferebly version 1.2.3. You can use
8a126fcc
RR
61GTK 1.0.X in connection with wxWindows, but we don't support Drag'n'Drop
62for GTK 1.0.X so you have to "configure --without-dnd". wxWindows does
63NOT work with the 1.1.X versions of the GTK+ library.
c98f0421 64
c67d8618 65You can get the newest version of the GTK+ from the GTK homepage
c98f0421
RR
66at
67 http://www.gtk.org
68
3cdda6cd 69We also mirror GTK+ 1.2.1 at my ftp site soon. You'll find information
58614078
RR
70about downloading at my homepage.
71
c98f0421
RR
72* Additional libraries
73-----------------------
74
58614078
RR
75wxWindows/Gtk requires a thread library and X libraries
76known to work with threads. This is the case on all
77commercial Unix-Variants and all Linux-Versions that
78are based on glibc 2 except RedHat 5.0 which is broken
79in many aspects. As of writing this, these Linux
80distributions have correct glibc 2 support:
81
82 - RedHat 5.1
83 - Debian 2.0
84 - Stampede
4f22cf8d 85 - DLD 6.0
cffee23b 86 - SuSE 6.0
58614078 87
cffee23b 88You can enable thread support by running
58614078 89
cffee23b 90./configure "--with-threads"
58614078
RR
91make clean
92make
034be888 93su <type root password>
8710cf5c 94make install
034be888
RR
95ldconfig
96exit
c98f0421 97
3502e687 98NB: DO NOT COMPILE WXGTK WITH GCC AND THREADS, SINCE
3cdda6cd 99ALL PROGRAMS WILL CRASH UPON START-UP! Just always
3502e687
RR
100use egcs and be happy.
101
c98f0421
RR
102* Create your configuration
103-----------------------------
104
105Usage:
106 ./configure options
107
108If you want to use system's C and C++ compiler,
109set environment variables CC and CCC as
110
111 % setenv CC cc
112 % setenv CCC CC
113 % ./configure options
114
115Using the SGI native compilers, it is recommended that you
116also set CFLAGS and CXXFLAGS before running configure. These
117should be set to :
118
119CFLAGS="-mips3 -n32"
120CXXFLAGS="-mips3 -n32"
121
122This is essential if you want to use the resultant binaries
123on any other machine than the one it was compiled on. If you
124have a 64bit machine (Octane) you should also do this to ensure
125you don't accidently build the libraries as 64bit (which is
126untested).
127
128The SGI native compiler support has only been tested on Irix 6.5.
129
130to see all the options please use:
131
132 ./configure --help
133
134The basic philosophy is that if you want to use different
135configurations, like a debug and a release version,
136or use the same source tree on different systems,
137you have only to change the environment variable OSTYPE.
138(Sadly this variable is not set by default on some systems
139in some shells - on SGI's for example). So you will have to
140set it there. This variable HAS to be set before starting
141configure, so that it knows which system it tries to
142configure for.
143
144Configure will complain if the system variable OSTYPE has
145not been defined. And Make in some circumstances as well...
146
147
148* General options
149-------------------
150
cf7a7e13
RR
151Normally, you won't have to choose a toolkit, because when
152you download wxGTK, it will default to --with-gtk etc. But
153if you use all of our CVS repository you have to choose a
154toolkit. You must do this by running configure with either of:
c98f0421
RR
155
156 --with-gtk Use the GIMP ToolKit (GTK)
157
c98f0421
RR
158 --with-motif Use either Motif or Lesstif
159 Configure will look for both.
160
161The following options handle the kind of library you want to build.
162
3cdda6cd
RR
163 --with-threads Compile with thread support. Threads
164 support is also required for the
165 socket code to work.
c98f0421 166
cf7a7e13 167 --without-shared Do not create shared libraries.
c98f0421 168
3cdda6cd
RR
169 --without-optimise Do not optimise the code. Can
170 sometimes be useful for debugging
171 and is required on some architectures
172 such as Sun with gcc 2.8.X which
173 would otherwise produce segvs.
c98f0421
RR
174
175 --with-profile Add profiling info to the object
176 files. Currently broken, I think.
177
178 --with-mem_tracing Add built-in memory tracing.
c98f0421
RR
179
180 --with-dmalloc Use the dmalloc memory debugger.
181 Read more at www.letters.com/dmalloc/
182
183 --with-debug_info Add debug info to object files and
3cdda6cd
RR
184 executables for use with debuggers
185 such as gdb (or its many frontends).
c98f0421
RR
186
187 --with-debug_flag Define __DEBUG__ and __WXDEBUG__ when
3cdda6cd
RR
188 compiling. This enable wxWindows' very
189 useful internal debugging tricks (such
190 as automatically reporting illegal calls)
191 to work. Note that program and library
192 must be compiled with the same debug
193 options.
c98f0421
RR
194
195* Feature Options
196-------------------
197
3cdda6cd
RR
198When producing an executable that is linked statically with wxGTK
199you'll be surprised at its immense size. This can sometimes be
200drastically reduced by removing features from wxWindows that
201are not used in your program. The most relevant such features
202are
203
204 --without-libpng Disables PNG image format code.
205
206 --without-libjpeg Disables JPEG image format code.
207
208 --without-odbc Disables ODBC code.
209
210 --without-wxresources Disables the use of *.wxr type
211 resources.
212
31276cb5
RR
213 --without-threads Disables threads. Will also
214 disable sockets.
3cdda6cd
RR
215
216 --without-sockets Disables sockets.
217
218 --without-dnd Disables Drag'n'Drop.
219
220 --without-clipboard Disables Clipboard.
221
222 --without-serial Disables object instance serialiasation.
223
224 --without-streams Disables the wxStream classes.
225
226Apart from disabling certain features you can very often "strip"
227the program of its debugging information resulting in a significant
228reduction in size.
c98f0421
RR
229
230* Compiling
231-------------
232
233The following must be done in the base directory (e.g. ~/wxGTK
cf7a7e13 234or ~/wxWin or whatever)
c98f0421 235
8710cf5c
RR
236Now the makefiles are created (by configure) and you can compile
237the library by typing:
c98f0421
RR
238
239 make
240
8710cf5c
RR
241make yourself some coffee, as it will take some time. On an old
242386SX possibly week. During compilation, you'll get a few
3cdda6cd 243warning messages depending in your compiler.
c98f0421
RR
244
245if you want to be more selective:
246
3cdda6cd 247 make will build only the base libraries
c98f0421 248 make samples will build the samples
c67d8618 249 make user will build everything in user
c98f0421 250
cf7a7e13
RR
251Then you may install the library and it's header files under
252/usr/local/include/wx and /usr/local/lib respectively. You
253have to log in as root (i.e. run "su" and enter the root
254password) and type
255
256 make install
257
c98f0421
RR
258Depending on the configuration of some files, the libraries
259and binaries will be placed in different directories.
260The "global" binaries and libraries will be placed in:
261
262 bin/$(OSTYPE) and
263 lib/$(OSTYPE) respectively
264
265"local" binaries and libraries will be placed in:
266
267 (basedir of that application)/$(OSTYPE).
268
269This is also the place where all the object-files will go.
8710cf5c 270(Currently there arent any global binaries).
c98f0421 271
3cdda6cd 272If you want to save disk space by removing unnecessary
c98f0421
RR
273object-files:
274
3cdda6cd 275 make clean
c98f0421 276
3cdda6cd 277in the various directories will do the work for you.
c98f0421
RR
278
279* Creating a new Project
280--------------------------
281
f3cb6592
RR
282There are two ways to create your own project:
283
2841) The first way uses the installed libraries and header files
285automatically using wx-config
286
287g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
288
289Using this way, a make file for the minimal sample would look
290like this
291
292CC = g++
293
294minimal: minimal.o
295 $(CC) -o minimal minimal.o `wx-config --libs`
296
297minimal.o: minimal.cpp mondrian.xpm
298 $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
299
300clean:
301 rm -f *.o minimal
302
303This is certain to become the standard way unless we decide
304to sitch to tmake.
305
3062) The other way creates a project within the source code
307directories of wxWindows: In this case I propose to put
308all contributed programs in the directory "/user", with a
309directory of its own.
c98f0421
RR
310
311This directory then should include the following files:
312
313Makefile (You can copy this one from any application in samples
314 probably you will not need to edit this one. There is
315 only one case where you might be interested in changing
316 this file, but about that see later.)
317Makefile.in (This is the base application-Makefile template, from
318 which the actual Makefile for each system is created.
319 More about this later)
320
321put ALL your source code along with all the other stuff you need for
322your application in this directory (subdirectories are welcome).
323
cf7a7e13 324
c98f0421
RR
325** Something about Makefiles
326------------------------------
327
328On general principle it should only contain ONE line, which is as follows:
329
330 include ../../setup/general/makeapp
331
332this will include all the necessary definitions for creating the applications
333
334the only case where you might want to add another line is the following:
335this version of configure also supports creation of source archives of the
336application for easy distribution and updates to newer version of wxWindows.
337 For this purpose all files in the application-directory will be put into
338a gziped tar-file in the full notation user/<your application>/*
339if you want to include some other files that you want "more visible", like
340a README.<yourApp> or a shell script for easy
341compilation/installation/distribution, then you have to add a variable
342
343 DISTRIBUTE_ADDITIONAL=<your files>
344
345to the Makefile.
346So it would look like this:
347
348 DISTRIBUTE_ADDITIONAL=README.TheApp
349 include ../../setup/general/makeapp
350
351As we have already talked about distribution the command to create a
352distribution is:
353
354 make distrib
355
356NOTE: If you are in the base directory of wxWindows it will create
357distribution packages for wxWindows as well as for all packages in the
358user directory.
359 So if you want to create only packages for the files in user,
360then go to the directory other and type:
361
362 make distrib
363
364or if you only want one application to be created then
365enter the specific directory and type there:
366make distrib
367
368All the distribution files will be put in the directory
369distrib at the base of the wxWindows-tree (where also configure
370and template.mak can be found).
371
372** Something about Makefile.in
373--------------------------------
374
375As you have already seen with Makefile, configure makes a lot of use
376if the include statement in make to keep the Makefiles as simple as
377possible.
378
379So basically there are only variables to define and then a include command.
380Exception to this rule is if you have special rules for some stuff...
381These rules should go AFTER the include statement!!!
382
383so the general header looks like this:
384
385 # wxWindows base directory
386 WXBASEDIR=@WXBASEDIR@
387 # set the OS type for compilation
388 OS=@OS@
389 # compile a library only
390 RULE=bin
391
392and the general footer will look like this:
393
394 # include the definitions now
395 include ../../../template.mak
396
397the key variable is RULE, which defines what make should create
398in this directory.
399
400here are some examples:
401
402 RULE description
403 ===========================================================================
404 bin creates a local binary (for a global binary prefix bin with g)
405 additional variables needed:
406 BIN_TARGET this gives the name of your application
407 BIN_OBJ this gives the object files needed to
408 link the application
409 optional variables are:
410 BIN_SRC this gives the list of c/c++ files for
411 which dependencies will be checked.
412 (This can be achieved with: make depend)
413 BIN_LINK this gives commands for additional
414 libraries needed to link the application
415 ---------------------------------------------------------------------------
416 bin2 creates two local binaries (for global binaries prefix bin2 with g)
417 in addition to the variables specified above you MUST also
418 provide the same variables with BIN2_ instead of BIN_
419 ---------------------------------------------------------------------------
420 lib creates a local library (for a global binary prefix bin with g)
421 additional variables needed:
422 LIB_TARGET this gives the name of your library
423 LIB_OBJ this gives the object files needed for
424 the library to be build.
425 optional variables are:
426 LIB_SRC this gives the list of c/c++ files for
427 which dependencies will be checked.
428 libbin and libgbin are also possible and will need in addition
429 the variables from bin
430 ---------------------------------------------------------------------------
431 gslib is similar to lib, but it creates a shared library if the system
432 supports it.
433 additional variables needed:
434 LIB_MAJOR major number of the shared library
435 LIB_MINOR minor number of the shared library
436 ---------------------------------------------------------------------------
437 other additional variables:
438
439 ADD_COMPILE define additional includes/defines that
440 are needed to compile the object files
441 (if you need to reference some directory
442 utils - like wxGrid -, then please
443 reference them with the variables defined
444 in template.mak - e.g.: $(SRCDIR),$(UTILS),
445 $(SAMPLES),$(OTHERS))
446
447 NEEDED_DEFINES lists all the defines that HAVE to be set in
448 /include/wx/setup.h to compile correctly.
449
450 SRC_DIR lists all directories that are needed to
451 compile. (i.e: lists all the directories,
452 where there are source-files.) But it is
453 also needed to clean an object and for
454 machines, for which make does not support
455 VPATH
456
457currently there are the following compiling rules provided:
458object files are created for the following file extensions:
459.c .cc .cpp
460
461Please have a closer look at the Makefiles in this distribution.
462
463* Platforms configure is working with
464---------------------------------------
465
466Please report build succes on any machine. Especially non-
467Linux operating systems (which I don't have).
468
469Original author of the autoconf system for wxxt-1.66 and for this INSTALL
470file:
471
472 Martin Sperl sperl@dsn.ast.univie.ac.at
473
474Ported to wxGTK 0.1:
475
476 Wolfram Gloger wmglo@dent.med.uni-muenchen.de
477
478Thanks alot to both of them.
479
480In the hope that it will be useful,
481
482 Robert Roebling roebling@sun2.ruf.uni-freiburg.de
483
484