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