Merge branch 'gtk-install-docs'

Improve wxGTK install docs: document prerequisites, improve formatting,
remove obsolete parts.

See https://github.com/wxWidgets/wxWidgets/pull/2510
This commit is contained in:
Vadim Zeitlin
2021-09-07 19:25:45 +02:00

View File

@@ -13,38 +13,67 @@ The simplest case {#gtk_simple}
If you compile wxWidgets on Linux for the first time and don't like to read If you compile wxWidgets on Linux for the first time and don't like to read
install instructions just do the following in wxWidgets directory: install instructions just do the following in wxWidgets directory:
> mkdir buildgtk $ mkdir buildgtk
> cd buildgtk $ cd buildgtk
> ../configure --with-gtk $ ../configure --with-gtk
> make $ make
> sudo make install $ sudo make install
> sudo ldconfig $ sudo ldconfig
[if you get "ldconfig: command not found", try using "/sbin/ldconfig"] (if you get "ldconfig: command not found", try using `/sbin/ldconfig`)
If you don't do the 'make install' part, you can still use the libraries from If you don't do the `make install` part, you can still use the libraries from
the buildgtk directory, but they may not be available to other users. the `buildgtk` directory, but they may not be available to other users.
If you want to remove wxWidgets on Unix you can do this:
> sudo make uninstall
> sudo ldconfig
Note that by default, GTK 3 is used. GTK 2 can be specified Note that by default, GTK 3 is used. GTK 2 can be specified
with --with-gtk=2. with `--with-gtk=2` configure option.
If you use CMake, please see @ref overview_cmake for If you want to use CMake, please see @ref overview_cmake for
building wxWidgets using it. building wxWidgets using it.
Prerequisites {#gtk_prereq}
-------------
To build wxWidgets, you need to have a number of libraries on your system.
While all of them may be compiled from source, under Linux systems it is much
more common to install the development packages containing the headers and
library files.
At the very least, you will need GTK libraries themselves. Unfortunately the
exact package names differ between different Linux distributions, but for
Debian and Debian-based distribution these libraries are part of `libgtk-3-dev`
package, while in Fedora and other RPM-based distributions the same package is
known as `gtk3-devel`.
For OpenGL support, you need `libgl1-mesa-dev` and `libglu1-mesa-dev` packages
under Debian and `mesa-libGL-devel` and `mesa-libGLU-devel` under Fedora. For
EGL support, `libegl1-mesa-dev` or `mesa-libEGL-devel` is needed.
wxMediaCtrl implementation requires GStreamer and its plugins development
packages, i.e. either `libgstreamer-plugins-baseVERSION-dev` or
`gstreamerVERSION-plugins-base-devel`, where `VERSION` should be 1.0, but 0.10
is still supported as well for compatibility with old systems.
wxWebRequest requites libcurl development package, e.g. `libcurl4-openssl-dev`
or `libcurl-devel`.
wxWebView requires `libwebkit2gtk-4.0-dev` under Debian and `webkit2gtk3-devel`
under Fedora.
For the different image format libraries (PNG, JPEG, TIFF) as well as zlib, you
may install the corresponding `libNAME-dev` or `-devel` libraries or use the
built-in versions of them, i.e. the same libraries compiled as part of
wxWidgets, instead if you prefer.
Troubleshooting {#gtk_errors_simple} Troubleshooting {#gtk_errors_simple}
--------------- ---------------
IMPORTANT NOTE: *IMPORTANT NOTE:* When sending bug reports tell us the exact version of
wxWidgets you are using as well as what compiler on what system. One example:
When sending bug reports tell us what version of wxWidgets you are wxGTK 3.0.5, GCC 9.3.1, Fedora 31.
using (including the beta) and what compiler on what system. One
example: wxGTK 3.0.5, GCC 9.3.1, Fedora 31.
For any configure errors: please look at `config.log` file which was generated For any configure errors: please look at `config.log` file which was generated
during configure run, it usually contains some useful information. during configure run, it usually contains some useful information.
@@ -76,20 +105,6 @@ Now create your super-application myfoo.cpp and compile anywhere with
Building wxGTK on Cygwin {#gtk_cygwin}
--------------------------
The normal build instructions should work fine on Cygwin. The one difference
with Cygwin is that when using the "--enable-shared" configure option (which
is the default) the API is exported explicitly using `__declspec(dllexport)`
rather than all global symbols being available.
This shouldn't make a difference using the library and should be a little
more efficient. However if an export attribute has been missed somewhere you
will see linking errors. If this happens then you can work around the
problem by setting `LDFLAGS=-Wl,--export-all-symbols`. Please also let us know
about it on the wx-dev mailing list.
Configure options {#gtk_options} Configure options {#gtk_options}
----------------- -----------------
@@ -112,132 +127,128 @@ more information).
The following options can be used to specify the kind and number The following options can be used to specify the kind and number
of libraries to build: of libraries to build:
--disable-shared Do not create shared libraries, but * `--disable-shared` \n
build static libraries instead. Do not create shared libraries, but build static libraries instead.
--enable-monolithic Build wxWidgets as single library instead * `--enable-monolithic` \n
of as several smaller libraries (which is Build wxWidgets as single library instead of as several smaller libraries
the default since wxWidgets 2.5.0). (which is the default since wxWidgets 2.5.0).
Options for third party dependencies: wxWidgets may use other Options for third party dependencies: wxWidgets may use other
libraries present on the current system. For some of these libraries present on the current system, see the @ref gtk_prereq
libraries, wxWidgets also provides built-in versions, that can be "prerequisites section above". For some of these libraries,
wxWidgets also provides built-in versions, that can be
linked into wx libraries themselves, which can be useful to linked into wx libraries themselves, which can be useful to
minimize external dependencies. minimize external dependencies. By default, system versions will be
used if available, but `--with-xxx=builtin` configure option may be
used to override this.
--disable-sys-libs Don't use system libraries when there is * `--disable-sys-libs` \n
a built-in version included in wxWidgets. Don't use system libraries when there is a built-in version included in
Note that other system libraries can, wxWidgets. This is equivalent to using --with-xxx=builtin for all libraries
and typically will, still be used if that have built-in versions. Note that other system libraries can, and
found. typically will, still be used if found.
--without-libpng Disables PNG image format code. * `--without-libpng` \n
Don't use libpng (although GTK Disables PNG image format code. Don't use neither the system nor the builtin
itself still uses it). libpng (although GTK itself still uses it).
--without-libjpeg Disables JPEG image format code. * `--without-libjpeg` \n
Don't use libjpeg. Disables JPEG image format code. Don't use libjpeg.
--without-libtiff Disables TIFF image format code. * `--without-libtiff` \n
Don't use libtiff. Disables TIFF image format code. Don't use libtiff.
--without-expat Disable XML classes based on Expat parser. * `--without-expat` \n
Don't use expat library. Disable XML classes based on Expat parser. Don't use expat library.
--without-liblzma Disable LZMA compression support. * `--without-liblzma` \n
Don't use liblzma. Disable LZMA compression support. Don't use liblzma.
--without-libcurl Don't use libcurl even if it's available. * `--without-libcurl` \n
Disables wxWebRequest. Don't use libcurl even if it's available. Disables wxWebRequest.
--without-opengl Disable OpenGL integration with wxGLCanvas. * `--without-opengl` \n
Don't use OpenGL or EGL libraries. Disable OpenGL integration with wxGLCanvas. Don't use OpenGL or EGL libraries.
--disable-glcanvasegl Disable EGL support even if it is available * `--disable-glcanvasegl` \n
(it would be used if it is, by default). Disable EGL support even if it is available (it would be used if it is, by default).
--disable-mediactrl Disable wxMediaCtrl. * `--disable-mediactrl` \n
Don't use GStreamer libraries. Disable wxMediaCtrl. Don't use GStreamer libraries.
--disable-webview Disable wxWebView. * `--disable-webview` \n
Don't use webkit2gtk and its multiple Disable wxWebView. Don't use webkit2gtk and its multiple dependencies.
dependencies.
Normally, you won't have to choose a toolkit, because configure Normally, you won't have to choose a toolkit, because configure
defaults to wxGTK anyhow. However you need to use this option to defaults to wxGTK anyhow. However you need to use this option to
explicitly specify the version of GTK to use, e.g.: explicitly specify the version of GTK to use, e.g.:
--with-gtk=3 Use GTK 3. Default. * `--with-gtk=3` \n Use GTK 3. Default.
--with-gtk=2 Use GTK 2. * `--with-gtk=2` \n Use GTK 2.
--with-gtk=1 Use GTK 1.2. Obsolete. * `--with-gtk=1` \n Use GTK 1.2. Obsolete.
Some other general compilation options: Some other general compilation options:
--disable-optimise Do not optimise the code. Can be useful * `--disable-optimise` \n
for debugging but shouldn't be used Do not optimise the code. Can be useful for debugging but shouldn't be used
for production builds. for production builds.
--disable-unicode Disable Unicode support. Not recommended. * `--disable-unicode` \n
Disable Unicode support. Not recommended.
--enable-no_rtti Enable compilation without creation of * `--enable-no_rtti` \n
C++ RTTI information in object files. Enable compilation without creation of C++ RTTI information in object files.
This will speed-up compilation and reduce This will speed-up compilation and reduce binary size.
binary size.
--enable-no_exceptions Enable compilation without creation of * `--enable-no_exceptions` \n
C++ exception information in object files. Enable compilation without creation of C++ exception information in object
This will speed-up compilation and reduce files. This will speed-up compilation and reduce binary size.
binary size.
--enable-debug_info Add debug info to object files and * `--enable-debug_info` \n
executables for use with debuggers Add debug info to object files and executables for use with debuggers such
such as gdb (or its many frontends). as gdb (or its many frontends).
--enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when * `--enable-debug_flag` \n
compiling. This enable wxWidgets' very Enable internal debugging checks, that are very useful during development
useful internal debugging tricks (such and allow to diagnose illegal parameters to wxWidgets functions as long as
as automatically reporting illegal calls) the application doesn't predefine `NDEBUG` (see @ref overview_debugging).
to work. Note that program and library
must be compiled with the same debug
options.
--enable-debug Same as --enable-debug_info and * `--enable-debug` \n
--enable-debug_flag together. Unless you have Same as `--enable-debug_info` and `--enable-debug_flag` together. Typically
some very specific needs, you should use this this is the option you want to use.
option instead of --enable-debug_info/flag ones
separately.
To reduce the final libraries (or executables, when linking To reduce the final libraries (or executables, when linking
statically) size, many wxWidgets features may be disabled. Here statically) size, many wxWidgets features may be disabled. Here
is a list of some of them: is a list of some of them:
--disable-pnm Disables PNM image format code. * `--disable-pnm` \n Disables PNM image format code.
--disable-gif Disables GIF image format code. * `--disable-gif` \n Disables GIF image format code.
--disable-pcx Disables PCX image format code. * `--disable-pcx` \n Disables PCX image format code.
--disable-iff Disables IFF image format code. * `--disable-iff` \n Disables IFF image format code.
--disable-resources Disables the use of *.wxr type resources. * `--disable-resources` \n Disables the use of *.wxr type resources.
--disable-threads Disables threads. Will also disable sockets. * `--disable-threads` \n Disables threads. Will also disable sockets.
--disable-sockets Disables sockets. * `--disable-sockets` \n Disables sockets.
--disable-dnd Disables Drag'n'Drop. * `--disable-dnd` \n Disables Drag'n'Drop.
--disable-clipboard Disables Clipboard. * `--disable-clipboard` \n Disables Clipboard.
--disable-streams Disables the wxStream classes. * `--disable-streams` \n Disables the wxStream classes.
--disable-file Disables the wxFile class. * `--disable-file` \n Disables the wxFile class.
--disable-textfile Disables the wxTextFile class. * `--disable-textfile` \n Disables the wxTextFile class.
--disable-intl Disables the internationalisation. * `--disable-intl` \n Disables the internationalisation.
--disable-validators Disables validators. * `--disable-validators` \n Disables validators.
Please remember that the full list of options can be seen in Please remember that the full list of options can be seen in
`configure --help` output. `configure --help` output.
@@ -257,7 +268,7 @@ Then you may install the library and its header files under
have to perform the following command as root, using either `su` have to perform the following command as root, using either `su`
or `sudo`: or `sudo`:
make install $ make install
After installing, you can run `make clean` in the original After installing, you can run `make clean` in the original
directory or just remove it entirely if you don't plan to build directory or just remove it entirely if you don't plan to build
@@ -283,17 +294,15 @@ in the following way (note that if you are copying and pasting
this into your makefile, the leading spaces must be replaced by a this into your makefile, the leading spaces must be replaced by a
`TAB` character): `TAB` character):
```make program: program.o
program: program.o $(CXX) -o program program.o `wx-config --libs`
$(CXX) -o program program.o `wx-config --libs`
program.o: program.cpp program.o: program.cpp
$(CXX) `wx-config --cxxflags` -c program.cpp -o program.o $(CXX) `wx-config --cxxflags` -c program.cpp -o program.o
clean: clean:
$(RM) program.o program $(RM) program.o program
.PHONY: clean .PHONY: clean
```
If your application uses only some of wxWidgets libraries, you can If your application uses only some of wxWidgets libraries, you can
specify required libraries when running wx-config. For example, specify required libraries when running wx-config. For example,