install.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. wxWidgets for GTK+ installation
  2. -------------------------------
  3. IMPORTANT NOTE:
  4. If you experience problems installing, please re-read these
  5. instructions and other related files (todo.txt, bugs.txt and
  6. osname.txt for your platform if it exists) carefully before
  7. mailing wxwin-users or the author. Preferably, try to fix the
  8. problem first and then send a patch to the author.
  9. When sending bug reports tell us what version of wxWidgets you are
  10. using (including the beta) and what compiler on what system. One
  11. example: wxGTK 3.0.0, GCC 4.8.1, Fedora 19
  12. * The simplest case
  13. -------------------
  14. If you compile wxWidgets on Linux for the first time and don't like to read
  15. install instructions just do (in the base dir):
  16. > mkdir buildgtk
  17. > cd buildgtk
  18. > ../configure --with-gtk
  19. > make
  20. > su <type root password>
  21. > make install
  22. > ldconfig
  23. [if you get "ldconfig: command not found", try using "/sbin/ldconfig"]
  24. If you don't do the 'make install' part, you can still use the libraries from
  25. the buildgtk directory, but they may not be available to other users.
  26. If you want to remove wxWidgets on Unix you can do this:
  27. > su <type root password>
  28. > make uninstall
  29. > ldconfig
  30. Note that by default, GTK+ 2.x is used. GTK+ 3 can be specified
  31. with --with-gtk=3.
  32. * The expert case
  33. -----------------
  34. If you want to do some more serious cross-platform programming with wxWidgets,
  35. such as for GTK+ and Motif, you can now build two complete libraries and use
  36. them concurrently. To do this, create a separate directory for each build
  37. of wxWidgets - you may also want to create different versions of wxWidgets
  38. and test them concurrently. Most typically, this would be a version configured
  39. with --enable-debug and one without.
  40. For building three versions (one GTK+, one Motif and a debug version of the GTK
  41. source) you'd do this:
  42. mkdir buildmotif
  43. cd buildmotif
  44. ../configure --with-motif
  45. make
  46. cd ..
  47. mkdir buildgtk
  48. cd buildgtk
  49. ../configure --with-gtk
  50. make
  51. cd ..
  52. mkdir buildgtkd
  53. cd buildgtkd
  54. ../configure --with-gtk --enable-debug
  55. make
  56. cd ..
  57. Note that you can install all those libraries concurrently, you just need to
  58. pass the appropriate flags when using them.
  59. * The simplest errors
  60. ---------------------
  61. For any configure errors: please look at config.log file which was generated
  62. during configure run, it usually contains some useful information.
  63. configure reports, that you don't have GTK+ 1.2/2.0/3.0 installed although you
  64. are very sure you have. Well, you have installed it, but you also have another
  65. version of the GTK+ installed, which you may need to remove including other
  66. versions of glib (and its headers). Or maybe you installed it in a non-default
  67. location and configure can't find it there, so please check that your PATH
  68. variable includes the path to the correct gtk-config/pkg-config. Also check
  69. that your LD_LIBRARY_PATH or equivalent variable contains the path to GTK+
  70. libraries if they were installed in a non-default location.
  71. You get errors from make: please use GNU make instead of the native make
  72. program. Currently wxWidgets can be built only with GNU make, BSD make and
  73. Solaris make. Other versions might work or not (any which don't have VPATH
  74. support definitely won't).
  75. You get errors during compilation: The reason is that you probably have a
  76. broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause
  77. problems due to incomplete support for C++ and optimisation bugs. Best to use
  78. GCC 2.95 or later.
  79. You get immediate segfault when starting any sample or application: This is
  80. either due to having compiled the library with different flags or options than
  81. your program - typically you might have the __WXDEBUG__ option set for the
  82. library but not for your program - or due to using a compiler with optimisation
  83. bugs.
  84. * The simplest program
  85. ----------------------
  86. Now create your super-application myfoo.cpp and compile anywhere with
  87. g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
  88. * GUI libraries
  89. ---------------
  90. wxWidgets/GTK+ requires the GTK+ library to be installed on your system. It has
  91. to be a stable version, preferably GTK+ 2.x.y, where x is an even number.
  92. GTK+ version 1.2 is highly discouraged, but if you decide to still use it,
  93. please use version 1.2.10 (at least 1.2.3 is required, 1.2.7 is strongly recommended).
  94. You can get the newest version of the GTK+ from the GTK+ homepage at:
  95. http://www.gtk.org
  96. We also mirror GTK+ at my ftp site. You'll find information about downloading
  97. at my homepage.
  98. * Additional libraries
  99. ----------------------
  100. wxWidgets/Gtk requires a thread library and X libraries known to work with
  101. threads. This is the case on all commercial Unix-Variants and all
  102. Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in
  103. many aspects. As of writing this, virtually all Linux distributions have
  104. correct glibc 2 support.
  105. You can disable thread support by running
  106. ./configure --disable-threads
  107. make
  108. su <type root password>
  109. make install
  110. ldconfig
  111. exit
  112. * Building wxGTK on OS/2
  113. ------------------------
  114. Please send comments and question about the OS/2 installation
  115. to Stefan Neis <Stefan.Neis@t-online.de> and patches to
  116. the wxWidgets mailing list.
  117. In the following list, the version numbers indicate the configuration that
  118. was actually used by myself, newer version should cause no problems and
  119. even older ones are expected to work most of the time.
  120. You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer),
  121. GTK+ (1.2.5 or newer), emx (0.9d fix 4), a Unix like shell (pdksh-5.2.14 or
  122. ash), Autoconf (2.57), GNU file utilities (3.13), GNU text utilities (1.19),
  123. GNU shell utilites (1.12), m4 (1.4), sed (2.05), grep (2.0), Awk (3.0.3),
  124. GNU Make (3.75).
  125. Preferably, you should have Posix/2 installed and C(PLUS)_INCLUDE_PATH and
  126. LIBRARY_PATH set up accordingly, however, wxGTK will even work without it.
  127. Presence of Posix/2 will be auto-detected.
  128. Open an OS/2 prompt and switch to the directory above.
  129. Set MAKESHELL or MAKE_SHELL (which one is needed depends on the version of
  130. make) to a Unix like shell, e.g.
  131. SET MAKESHELL=ash
  132. If you have a really deficient version of GNU make, it might even be
  133. necessary to set SHELL or even COMSPEC to a unix like shell as well.
  134. Depending on your installation you might want to also set INSTALL, for me
  135. it tends to try to use the system's tcpip\pcomos\install.exe which causes
  136. problems, e.g.
  137. SET INSTALL=<path_to_src_directory>/install-sh -c
  138. Notice that the delivered configure scripts are fully OS/2 aware, so you
  139. can simply run
  140. ash -c "configure --with-gtk=1"
  141. and make and possibly make install as described above.
  142. * Building wxGTK on SGI
  143. -----------------------
  144. Using the SGI native compilers, it is recommended that you
  145. also set CFLAGS and CXXFLAGS before running configure. These
  146. should be set to :
  147. CFLAGS="-mips3 -n32"
  148. CXXFLAGS="-mips3 -n32"
  149. This is essential if you want to use the resultant binaries
  150. on any other machine than the one it was compiled on. If you
  151. have a 64bit machine (Octane) you should also do this to ensure
  152. you don't accidently build the libraries as 64bit (which is
  153. untested).
  154. The SGI native compiler support has only been tested on Irix 6.5.
  155. * Building wxGTK on Cygwin
  156. --------------------------
  157. The normal build instructions should work fine on Cygwin. The one difference
  158. with Cygwin is that when using the "--enable-shared" configure option (which
  159. is the default) the API is exported explicitly using __declspec(dllexport)
  160. rather than all global symbols being available.
  161. This shouldn't make a difference using the library and should be a little
  162. more efficient. However if an export attribute has been missed somewhere you
  163. will see linking errors. If this happens then you can work around the
  164. problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know
  165. about it on the wx-dev mailing list.
  166. * Create your configuration
  167. ---------------------------
  168. Usage:
  169. ./configure options
  170. If you want to use system's C and C++ compiler,
  171. set environment variables CC and CXX as
  172. % setenv CC cc
  173. % setenv CXX CC
  174. % ./configure [options]
  175. to see all the options please use:
  176. ./configure --help
  177. It is recommended to build wxWidgets in another directory (maybe a
  178. subdirectory of your wxWidgets installation) as this allows you to
  179. have multiple configurations (for example, debug and release or GTK
  180. and Motif) simultaneously.
  181. * General options
  182. -----------------
  183. Given below are the commands to change the default behaviour,
  184. i.e. if it says "--disable-threads" it means that threads
  185. are enabled by default.
  186. Normally, you won't have to choose a toolkit, because when
  187. you download wxGTK, it will default to --with-gtk etc. But
  188. if you use all of our SVN repository you have to choose a
  189. toolkit. You must do this by running configure with either of:
  190. --with-gtk=2 Use the GTK+ 2.0. Default.
  191. --with-gtk=3 Use the GTK+ 3.
  192. --with-gtk=1 Use the GTK+ 1.2.
  193. The following options handle the kind of library you want to build.
  194. --disable-threads Compile without thread support.
  195. --disable-shared Do not create shared libraries, but
  196. build static libraries instead.
  197. --enable-monolithic Build wxWidgets as single library instead
  198. of as several smaller libraries (which is
  199. the default since wxWidgets 2.5.0).
  200. --disable-optimise Do not optimise the code. Can
  201. sometimes be useful for debugging
  202. and is required on some architectures
  203. such as Sun with gcc 2.8.X which
  204. would otherwise produce segvs.
  205. --enable-unicode Enable Unicode support.
  206. --enable-profile Add profiling info to the object
  207. files. Currently broken, I think.
  208. --enable-no_rtti Enable compilation without creation of
  209. C++ RTTI information in object files.
  210. This will speed-up compilation and reduce
  211. binary size.
  212. --enable-no_exceptions Enable compilation without creation of
  213. C++ exception information in object files.
  214. This will speed-up compilation and reduce
  215. binary size. Also fewer crashes during the
  216. actual compilation...
  217. --enable-no_deps Enable compilation without creation of
  218. dependency information.
  219. --enable-permissive Enable compilation without checking for strict
  220. ANSI conformance. Useful to prevent the build
  221. dying with errors as soon as you compile with
  222. Solaris' ANSI-defying headers.
  223. --enable-mem_tracing Add built-in memory tracing.
  224. --enable-dmalloc Use the dmalloc memory debugger.
  225. Read more at www.letters.com/dmalloc/
  226. --enable-debug_info Add debug info to object files and
  227. executables for use with debuggers
  228. such as gdb (or its many frontends).
  229. --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
  230. compiling. This enable wxWidgets' very
  231. useful internal debugging tricks (such
  232. as automatically reporting illegal calls)
  233. to work. Note that program and library
  234. must be compiled with the same debug
  235. options.
  236. --enable-debug Same as --enable-debug_info and
  237. --enable-debug_flag together. Unless you have
  238. some very specific needs, you should use this
  239. option instead of --enable-debug_info/flag ones
  240. separately.
  241. * Feature Options
  242. -----------------
  243. When producing an executable that is linked statically with wxGTK
  244. you'll be surprised at its immense size. This can sometimes be
  245. drastically reduced by removing features from wxWidgets that
  246. are not used in your program. The most relevant such features
  247. are
  248. --with-odbc Enables ODBC code. This is disabled
  249. by default because iODBC is under the
  250. L-GPL license which is less liberal than
  251. wxWindows licence.
  252. --without-libpng Disables PNG image format code.
  253. --without-libjpeg Disables JPEG image format code.
  254. --without-libtiff Disables TIFF image format code.
  255. --without-expat Disable XML classes based on Expat parser.
  256. --disable-pnm Disables PNM image format code.
  257. --disable-gif Disables GIF image format code.
  258. --disable-pcx Disables PCX image format code.
  259. --disable-iff Disables IFF image format code.
  260. --disable-resources Disables the use of *.wxr type resources.
  261. --disable-threads Disables threads. Will also disable sockets.
  262. --disable-sockets Disables sockets.
  263. --disable-dnd Disables Drag'n'Drop.
  264. --disable-clipboard Disables Clipboard.
  265. --disable-serial Disables object instance serialisation.
  266. --disable-streams Disables the wxStream classes.
  267. --disable-file Disables the wxFile class.
  268. --disable-textfile Disables the wxTextFile class.
  269. --disable-intl Disables the internationalisation.
  270. --disable-validators Disables validators.
  271. --disable-accel Disables accelerators support.
  272. Apart from disabling certain features you can very often "strip"
  273. the program of its debugging information resulting in a significant
  274. reduction in size.
  275. Please see the output of "./configure --help" for comprehensive list
  276. of all configurable options.
  277. * Compiling
  278. -----------
  279. The following must be done in the base directory (e.g. ~/wxGTK
  280. or ~/wxWin or whatever)
  281. Now the makefiles are created (by configure) and you can compile
  282. the library by typing:
  283. make
  284. make yourself some coffee, as it will take some time. On an old
  285. 386SX possibly two weeks. During compilation, you'll get a few
  286. warning messages depending in your compiler.
  287. If you want to be more selective, you can change into a specific
  288. directory and type "make" there.
  289. Then you may install the library and its header files under
  290. /usr/local/include/wx and /usr/local/lib respectively. You
  291. have to log in as root (i.e. run "su" and enter the root
  292. password) and type
  293. make install
  294. You can remove any traces of wxWidgets by typing
  295. make uninstall
  296. If you want to save disk space by removing unnecessary
  297. object-files:
  298. make clean
  299. in the various directories will do the work for you.
  300. * Creating a new Project
  301. --------------------------
  302. 1) The first way uses the installed libraries and header files
  303. automatically using wx-config
  304. g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo
  305. Using this way, a make file for the minimal sample would look
  306. like this
  307. CXX = g++
  308. minimal: minimal.o
  309. $(CXX) -o minimal minimal.o `wx-config --libs`
  310. minimal.o: minimal.cpp
  311. $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
  312. clean:
  313. rm -f *.o minimal
  314. If your application uses only some of wxWidgets libraries, you can
  315. specify required libraries when running wx-config. For example,
  316. `wx-config --libs=html,core` will only output link command to link
  317. with libraries required by core GUI classes and wxHTML classes. See
  318. the manual for more information on the libraries.
  319. 2) The other way creates a project within the source code
  320. directories of wxWidgets. For this endeavour, you'll need
  321. GNU autoconf version 2.14 and add an entry to your Makefile.in
  322. to the bottom of the configure.in script and run autoconf
  323. and configure before you can type make.
  324. ----------------------
  325. In the hope that it will be useful,
  326. Robert Roebling