install.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. wxWidgets for X11 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: wxX11 2.8.0, gcc 2.95.4, Redhat 6.2
  12. First steps
  13. -----------
  14. - Download wxX11-x.y.z.tgz, where x.y.z is the version number.
  15. Download documentation in a preferred format, such as
  16. wxWidgets-HTML.zip or wxWidgets-PDF.zip.
  17. - Make a directory such as ~/wx and unarchive the files into this
  18. directory.
  19. - It is recommended that you install bison and flex; using yacc
  20. and lex may require tweaking of the makefiles. You also need
  21. libXpm if you want to have XPM support in wxWidgets (recommended).
  22. - You can now use configure to build wxWidgets and the samples.
  23. Using configure is the recommended way to build the library. If it doesn't
  24. work for you for whatever reason, please report it (together with detailed
  25. information about your platform and the (relevant part of) contents of
  26. config.log file) to wx-dev@lists.wxwidgets.org.
  27. COMPILING USING CONFIGURE
  28. =========================
  29. * The simplest case
  30. -------------------
  31. If you compile wxWidgets on Linux for the first time and don't like to read
  32. install instructions just do (in the base dir):
  33. > ./configure --with-x11
  34. > make
  35. > su <type root password>
  36. > make install
  37. > ldconfig
  38. > exit
  39. Afterwards you can continue with
  40. > make
  41. > su <type root password>
  42. > make install
  43. > ldconfig
  44. > exit
  45. If you want to remove wxWidgets on Unix you can do this:
  46. > su <type root password>
  47. > make uninstall
  48. > ldconfig
  49. > exit
  50. * The expert case
  51. -----------------
  52. If you want to do some more serious cross-platform programming with wxWidgets,
  53. such as for GTK and X11, you can now build two complete libraries and use
  54. them concurrently. For this end, you have to create a directory for each build
  55. of wxWidgets - you may also want to create different versions of wxWidgets
  56. and test them concurrently. Most typically, this would be a version configured
  57. with --enable-debug_flag and one without. Note, that only one build can
  58. currently be installed, so you'd have to use local version of the library for
  59. that purpose.
  60. For building three versions (one GTK, one X11 and a debug version of the GTK
  61. source) you'd do this:
  62. md buildx11
  63. cd buildx11
  64. ../configure --with-x11
  65. make
  66. cd ..
  67. md buildgtk
  68. cd buildgtk
  69. ../configure --with-gtk
  70. make
  71. cd ..
  72. md buildgtkd
  73. cd buildgtkd
  74. ../configure --with-gtk --enable-debug_flag
  75. make
  76. cd ..
  77. * The simplest errors
  78. ---------------------
  79. You get errors during compilation: The reason is that you probably have a
  80. broken compiler. GCC 2.8 and earlier versions and egcs are likely to cause
  81. problems due to incomplete support for C++ and optimisation bugs. Best to use
  82. GCC 2.95 or later.
  83. You get immediate segfault when starting any sample or application: This is
  84. either due to having compiled the library with different flags or options than
  85. your program - typically you might have the __WXDEBUG__ option set for the
  86. library but not for your program - or due to using a compiler with optimisation
  87. bugs.
  88. * The simplest program
  89. ----------------------
  90. Now create your super-application myfoo.cpp and compile anywhere with
  91. g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
  92. * General
  93. ---------
  94. The Unix variants of wxWidgets use GNU configure. If you have problems with
  95. your make use GNU make instead.
  96. If you have general problems with installation, see the wxWidgets website at
  97. http://www.wxwidgets.org/
  98. for newest information. If you still don't have any success, please send a bug
  99. report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF
  100. YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF X, WHAT DISTRIBUTION
  101. YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried...
  102. * GUI libraries
  103. ---------------
  104. wxWidgets/X11 requires the X11 library to be installed on your system.
  105. * Additional libraries
  106. ----------------------
  107. wxWidgets/X11 requires a thread library and X libraries known to work with
  108. threads. This is the case on all commercial Unix-Variants and all
  109. Linux-Versions that are based on glibc 2 except RedHat 5.0 which is broken in
  110. many aspects. As of writing this, virtually all Linux distributions have
  111. +correct glibc 2 support.
  112. You can disable thread support by running
  113. ./configure --disable-threads
  114. make
  115. su <type root password>
  116. make install
  117. ldconfig
  118. exit
  119. * Building wxX11 on OS/2
  120. ------------------------
  121. Please send comments and question about the OS/2 installation
  122. to Stefan Neis <Stefan.Neis@t-online.de> and patches to
  123. the wxWidgets mailing list.
  124. In the following list, the version numbers indicate the configuration that
  125. was actually used by myself, newer version should cause no problems and
  126. even older ones are expected to work most of the time.
  127. You'll need OS/2 Warp (4.51) or eCS(1.0), X-Free86/2 (3.3.6 or newer),
  128. emx (0.9d fix 4), flex (2.5.4), yacc (1.8) or bison (1.25),
  129. a Unix like shell (pdksh-5.2.14 or ash), Autoconf (2.57), GNU file
  130. utilities (3.13), GNU text utilities (1.19), GNU shell utilites (1.12),
  131. m4 (1.4), sed (2.05), grep (2.0), Awk (3.0.3), GNU Make (3.75).
  132. Preferably, you should have Posix/2 installed and C(PLUS)_INCLUDE_PATH and
  133. LIBRARY_PATH set up accordingly, however, wxGTK will even work without it.
  134. Presence of Posix/2 will be auto-detected.
  135. Open an OS/2 prompt and switch to the directory above.
  136. Set MAKESHELL (and depending on your installation also INSTALL, for me
  137. it tends to try to use the system's tcpip\pcomos\install.exe which causes
  138. problems...) to a Unix like shell, e.g.
  139. SET MAKESHELL=ash
  140. Be warned that depending on the precise version of your make, the
  141. variable that needs to be set might be MAKE_SHELL instead of MAKESHELL.
  142. If you have a really deficient version of GNU make, it might even be
  143. necessary to set SHELL or even COMSPEC to a unix like shell as well.
  144. Notice that the delivered configure scripts are fully OS/2 aware, so you
  145. can simply run
  146. ash -c "configure --with-x11"
  147. and make and possibly make install as described above.
  148. To verify X11 installation, configure will try to compile a
  149. sample program that requires X headers/libraries to be either
  150. available via C_INCLUDE_PATH and LIBRARY_PATH or you need to
  151. explicitly set CFLAGS prior to running configure.
  152. * Building wxX11 on SGI
  153. -----------------------
  154. Using the SGI native compilers, it is recommended that you
  155. also set CFLAGS and CXXFLAGS before running configure. These
  156. should be set to :
  157. CFLAGS="-mips3 -n32"
  158. CXXFLAGS="-mips3 -n32"
  159. This is essential if you want to use the resultant binaries
  160. on any other machine than the one it was compiled on. If you
  161. have a 64bit machine (Octane) you should also do this to ensure
  162. you don't accidently build the libraries as 64bit (which is
  163. untested).
  164. The SGI native compiler support has only been tested on Irix 6.5.
  165. * Building wxX11 on Cygwin
  166. --------------------------
  167. The normal build instructions should work fine on Cygwin. The one difference
  168. with Cygwin is that when using the "--enable-shared" configure option (which
  169. is the default) the API is exported explicitly using __declspec(dllexport)
  170. rather than all global symbols being available.
  171. This shouldn't make a difference using the library and should be a little
  172. more efficient. However if an export attribute has been missed somewhere you
  173. will see linking errors. If this happens then you can work around the
  174. problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know
  175. about it on the wx-dev mailing list.
  176. * Create your configuration
  177. ---------------------------
  178. Usage:
  179. ./configure [options]
  180. If you want to use system's C and C++ compiler,
  181. set environment variables CXX and CC as
  182. % setenv CC cc
  183. % setenv CXX CC
  184. % ./configure [options]
  185. to see all the options please use:
  186. ./configure --help
  187. The basic philosophy is that if you want to use different
  188. configurations, like a debug and a release version,
  189. or use the same source tree on different systems,
  190. you have only to change the environment variable OSTYPE.
  191. (Sadly this variable is not set by default on some systems
  192. in some shells - on SGI's for example). So you will have to
  193. set it there. This variable HAS to be set before starting
  194. configure, so that it knows which system it tries to
  195. configure for.
  196. Configure will complain if the system variable OSTYPE has
  197. not been defined. And Make in some circumstances as well...
  198. * General options
  199. -----------------
  200. Given below are the commands to change the default behaviour,
  201. i.e. if it says "--disable-threads" it means that threads
  202. are enabled by default.
  203. You have to add --with-x11 on platforms, where X11 is
  204. not the default (on Linux, configure will default to GTK).
  205. --with-x11 Use X11.
  206. The following options handle the kind of library you want to build.
  207. --disable-threads Compile without thread support. Threads
  208. support is also required for the
  209. socket code to work.
  210. --disable-shared Do not create shared libraries.
  211. --enable-monolithic Build wxWidgets as single library instead
  212. of as several smaller libraries (which is
  213. the default since wxWidgets 2.5.0).
  214. --disable-optimise Do not optimise the code. Can
  215. sometimes be useful for debugging
  216. and is required on some architectures
  217. such as Sun with gcc 2.8.X which
  218. would otherwise produce segvs.
  219. --enable-profile Add profiling info to the object
  220. files. Currently broken, I think.
  221. --enable-no_rtti Enable compilation without creation of
  222. C++ RTTI information in object files.
  223. This will speed-up compilation and reduce
  224. binary size.
  225. --enable-no_exceptions Enable compilation without creation of
  226. C++ exception information in object files.
  227. This will speed-up compilation and reduce
  228. binary size. Also fewer crashes during the
  229. actual compilation...
  230. --enable-no_deps Enable compilation without creation of
  231. dependency information.
  232. --enable-permissive Enable compilation without checking for strict
  233. ANSI conformance. Useful to prevent the build
  234. dying with errors as soon as you compile with
  235. Solaris' ANSI-defying headers.
  236. --enable-mem_tracing Add built-in memory tracing.
  237. --enable-dmalloc Use the dmalloc memory debugger.
  238. Read more at www.letters.com/dmalloc/
  239. --enable-debug_info Add debug info to object files and
  240. executables for use with debuggers
  241. such as gdb (or its many frontends).
  242. --enable-debug_flag Define __DEBUG__ and __WXDEBUG__ when
  243. compiling. This enable wxWidgets' very
  244. useful internal debugging tricks (such
  245. as automatically reporting illegal calls)
  246. to work. Note that program and library
  247. must be compiled with the same debug
  248. options.
  249. * Feature Options
  250. -----------------
  251. Many of the configure options have been thoroughly tested
  252. in wxWidgets snapshot 6, but not yet all (ODBC not).
  253. When producing an executable that is linked statically with wxX11
  254. you'll be surprised at its immense size. This can sometimes be
  255. drastically reduced by removing features from wxWidgets that
  256. are not used in your program. The most relevant such features
  257. are
  258. --without-libpng Disables PNG image format code.
  259. --without-libjpeg Disables JPEG image format code.
  260. { --without-odbc Disables ODBC code. Not yet. }
  261. --without-expat Disable XML classes based on Expat parser.
  262. --disable-resources Disables the use of *.wxr type
  263. resources.
  264. --disable-threads Disables threads. Will also
  265. disable sockets.
  266. --disable-sockets Disables sockets.
  267. --disable-dnd Disables Drag'n'Drop.
  268. --disable-clipboard Disables Clipboard.
  269. --disable-serial Disables object instance serialisation.
  270. --disable-streams Disables the wxStream classes.
  271. --disable-file Disables the wxFile class.
  272. --disable-textfile Disables the wxTextFile class.
  273. --disable-intl Disables the internationalisation.
  274. --disable-validators Disables validators.
  275. --disable-accel Disables accel.
  276. Apart from disabling certain features you can very often "strip"
  277. the program of its debugging information resulting in a significant
  278. reduction in size.
  279. Please see the output of "./configure --help" for comprehensive list
  280. of all configurable options.
  281. * Compiling
  282. -----------
  283. The following must be done in the base directory (e.g. ~/wxX11
  284. or whatever)
  285. Now the makefiles are created (by configure) and you can compile
  286. the library by typing:
  287. make
  288. make yourself some coffee, as it will take some time. On an old
  289. 386SX possibly two weeks. During compilation, you'll get a few
  290. warning messages depending in your compiler.
  291. If you want to be more selective, you can change into a specific
  292. directory and type "make" there.
  293. Then you may install the library and its header files under
  294. /usr/local/include/wx and /usr/local/lib respectively. You
  295. have to log in as root (i.e. run "su" and enter the root
  296. password) and type
  297. make install
  298. You can remove any traces of wxWidgets by typing
  299. make uninstall
  300. If you want to save disk space by removing unnecessary
  301. object-files:
  302. make clean
  303. in the various directories will do the work for you.
  304. * Creating a new Project
  305. ------------------------
  306. 1) The first way uses the installed libraries and header files
  307. automatically using wx-config
  308. g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo
  309. Using this way, a make file for the minimal sample would look
  310. like this
  311. CXX = g++
  312. minimal: minimal.o
  313. $(CXX) -o minimal minimal.o `wx-config --libs`
  314. minimal.o: minimal.cpp
  315. $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o
  316. clean:
  317. rm -f *.o minimal
  318. This is certain to become the standard way unless we decide
  319. to stick to tmake.
  320. If your application uses only some of wxWidgets libraries, you can
  321. specify required libraries when running wx-config. For example,
  322. `wx-config --libs=html,core` will only output link command to link
  323. with libraries required by core GUI classes and wxHTML classes. See
  324. the manual for more information on the libraries.
  325. 2) The other way creates a project within the source code
  326. directories of wxWidgets. For this endeavour, you'll need
  327. GNU autoconf version 2.14 and add an entry to your Makefile.in
  328. to the bottom of the configure.in script and run autoconf
  329. and configure before you can type make.
  330. * Further notes by Julian Smart
  331. -------------------------------
  332. - You may find the following script useful for compiling wxX11,
  333. especially if installing from zips (which don't preserve file
  334. permissions). Make this script executable with the command
  335. chmod a+x makewxx11.
  336. -------:x-----Cut here-----:x-----
  337. # makewxx11
  338. # Sets permissions (in case we extracted wxX11 from zip files)
  339. # and makes wxX11.
  340. # Call from top-level wxWidgets directory.
  341. # Note that this uses standard (but commonly-used) configure options;
  342. # if you're feeling brave, you may wish to compile with threads:
  343. # if they're not supported by the target platform, they will be disabled
  344. # anyhow
  345. # -- Julian Smart
  346. chmod a+x configure config.sub config.guess
  347. ./configure --with-x11 --with-shared --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc
  348. make
  349. -------:x-----Cut here-----:x-----
  350. This script will build wxX11 using shared libraries. If you want to build
  351. a static wxWidgets library, use --disable-shared.
  352. Troubleshooting
  353. ---------------
  354. - Solaris compilation with gcc: if the compiler has problems with the variable
  355. argument functions, try putting the gcc fixinclude file paths early in the
  356. include path.
  357. - If you operator-related compile errors or strange memory problems
  358. (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
  359. and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
  360. - If you get an internal compiler error in gcc, turn off optimisations.
  361. - Some compilers, such as Sun C++, may give a lot of warnings about
  362. virtual functions being hidden. Please ignore these, it's correct C++ syntax.
  363. If you find any incorrect instances, though, such as a
  364. missing 'const' in an overridden function, please let us know.
  365. Other Notes
  366. -----------
  367. - Debugging mode is switched on by default in the makefiles, but using
  368. configure will create a release build of the library by default: it's
  369. recommended to use --with-debug_info and --with-debug_flag configure
  370. switches while developing your application. To compile in non-debug
  371. mode, remove the -D__WXDEBUG__ switch in make.env (or if using the
  372. configure system, change --with-debug_flag to --without-debug_flag
  373. and --with-debug_info to --without-debug_info in the makewxx11
  374. script).
  375. Bug reports
  376. -----------
  377. Please send bug reports with a description of your environment,
  378. compiler and the error message(s) to the wxwin-developers mailing list at:
  379. wx-dev@lists.wxwidgets.org