[29] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
| 2 | <html> |
---|
| 3 | <head> |
---|
| 4 | <title>Boost.Regex: Installation</title> |
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 6 | <LINK href="../../../boost.css" type="text/css" rel="stylesheet"></head> |
---|
| 7 | <body> |
---|
| 8 | <P> |
---|
| 9 | <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="0"> |
---|
| 10 | <TR> |
---|
| 11 | <td vAlign="top" width="300"> |
---|
| 12 | <h3><A href="../../../index.htm"><IMG height="86" alt="C++ Boost" src="../../../boost.png" width="277" border="0"></A></h3> |
---|
| 13 | </td> |
---|
| 14 | <TD width="353"> |
---|
| 15 | <H1 align="center">Boost.Regex</H1> |
---|
| 16 | <H2 align="center">Installation</H2> |
---|
| 17 | </TD> |
---|
| 18 | <td width="50"> |
---|
| 19 | <h3><A href="index.html"><IMG height="45" alt="Boost.Regex Index" src="uarrow.gif" width="43" border="0"></A></h3> |
---|
| 20 | </td> |
---|
| 21 | </TR> |
---|
| 22 | </TABLE> |
---|
| 23 | </P> |
---|
| 24 | <HR> |
---|
| 25 | <P>When you extract the library from its zip file, you must preserve its internal |
---|
| 26 | directory structure (for example by using the -d option when extracting). If |
---|
| 27 | you didn't do that when extracting, then you'd better stop reading this, delete |
---|
| 28 | the files you just extracted, and try again! |
---|
| 29 | </P> |
---|
| 30 | <P>This library should not need configuring before use; most popular |
---|
| 31 | compilers/standard libraries/platforms are already supported "as is". If you do |
---|
| 32 | experience configuration problems, or just want to test the configuration with |
---|
| 33 | your compiler, then the process is the same as for all of boost; see the <A href="../../config/config.htm"> |
---|
| 34 | configuration library documentation</A>.</P> |
---|
| 35 | <P>The library will encase all code inside namespace boost. |
---|
| 36 | </P> |
---|
| 37 | <P>Unlike some other template libraries, this library consists of a mixture of |
---|
| 38 | template code (in the headers) and static code and data (in cpp files). |
---|
| 39 | Consequently it is necessary to build the library's support code into a library |
---|
| 40 | or archive file before you can use it, instructions for specific platforms are |
---|
| 41 | as follows: |
---|
| 42 | </P> |
---|
| 43 | <H3><A name="bjam"></A>Building with bjam</H3> |
---|
| 44 | <P>This is now the preferred method for building and installing this library, |
---|
| 45 | please refer to the <A href="../../../more/getting_started.html">getting started |
---|
| 46 | guide</A> for more information.</P> |
---|
| 47 | <H3><A name="unicode"></A>Building With Unicode and ICU Support</H3> |
---|
| 48 | <P>A default build of this library does not enable <A href="unicode.html">Unciode |
---|
| 49 | support</A> via ICU. There is no need to enable this support if you |
---|
| 50 | don't need it, but if you use ICU for your Unicode support already, and want to |
---|
| 51 | work with Unicode-aware regular expressions then read on.</P> |
---|
| 52 | <P>Most of the information you will need is in the <A href="../../../more/getting_started.html"> |
---|
| 53 | getting started guide</A>, the only additional step you need to take is to |
---|
| 54 | tell bjam that you want Boost.Regex to use ICU and optionally to tell bjam |
---|
| 55 | where ICU is located.</P> |
---|
| 56 | <P>If you're building on a Unix-like platform, and ICU is already installed in |
---|
| 57 | you're compilers search path (with an install prefix of /usr or /usr/local |
---|
| 58 | for example), then set the environment variable HAVE_ICU to enable ICU |
---|
| 59 | support. For example you might build with the command line:</P> |
---|
| 60 | <PRE>bjam -sHAVE_ICU=1 --toolset=<A href="../../../more/getting_started/windows.html#toolset-name">toolset-name</A> install</PRE> |
---|
| 61 | <P>If ICU is not already in your compilers path then you need to set the |
---|
| 62 | environment variable ICU_PATH to point to the route directory of your ICU |
---|
| 63 | installation, for example if ICU was installed to /usr/local/icu/3.3 you might |
---|
| 64 | use:</P> |
---|
| 65 | <PRE>bjam -sICU_PATH=/usr/local/icu/3.3 --toolset=<A href="../../../more/getting_started/windows.html#toolset-name">toolset-name</A> install</PRE> |
---|
| 66 | <P>Note that ICU is a C++ library just like Boost is, as such your copy of ICU |
---|
| 67 | must have been built with the same C++ compiler (and compiler version) that you |
---|
| 68 | are using to build Boost. <STRONG>Boost.Regex will not work correctly unless |
---|
| 69 | you ensure that this is the case:</STRONG> it is up to you to ensure that |
---|
| 70 | the version of ICU you are using is binary compatible with the toolset you use |
---|
| 71 | to build Boost.</P> |
---|
| 72 | <H2><A name="make"></A>Building via makefiles</H2> |
---|
| 73 | <H3><A name="bcb"></A>Borland C++ Builder: |
---|
| 74 | </H3> |
---|
| 75 | <UL> |
---|
| 76 | <LI> |
---|
| 77 | Open up a console window and change to the <boost>\libs\regex\build |
---|
| 78 | directory. |
---|
| 79 | <LI> |
---|
| 80 | Select the appropriate makefile (bcb4.mak for C++ Builder 4, bcb5.mak for C++ |
---|
| 81 | Builder 5, and bcb6.mak for C++ Builder 6). |
---|
| 82 | <LI> |
---|
| 83 | Invoke the makefile (pass the full path to your version of make if you have |
---|
| 84 | more than one version installed, the makefile relies on the path to make to |
---|
| 85 | obtain your C++ Builder installation directory and tools) for example: |
---|
| 86 | </LI> |
---|
| 87 | </UL> |
---|
| 88 | <PRE>make -fbcb5.mak</PRE> |
---|
| 89 | <P>The build process will build a variety of .lib and .dll files (the exact number |
---|
| 90 | depends upon the version of Borland's tools you are using) the .lib and dll |
---|
| 91 | files will be in a sub-directory called bcb4 or bcb5 depending upon the |
---|
| 92 | makefile used. To install the libraries into your development system use:</P> |
---|
| 93 | <PRE>make -fbcb5.mak install</PRE> |
---|
| 94 | <P>library files will be copied to <BCROOT>/lib and the dll's to |
---|
| 95 | <BCROOT>/bin, where <BCROOT> corresponds to the install path of |
---|
| 96 | your Borland C++ tools. |
---|
| 97 | </P> |
---|
| 98 | <P>You may also remove temporary files created during the build process (excluding |
---|
| 99 | lib and dll files) by using:</P> |
---|
| 100 | <PRE>make -fbcb5.mak clean</PRE> |
---|
| 101 | <P>Finally when you use regex++ it is only necessary for you to add the |
---|
| 102 | <boost> root director to your list of include directories for that |
---|
| 103 | project. It is not necessary for you to manually add a .lib file to the |
---|
| 104 | project; the headers will automatically select the correct .lib file for your |
---|
| 105 | build mode and tell the linker to include it. There is one caveat however: the |
---|
| 106 | library can not tell the difference between VCL and non-VCL enabled builds when |
---|
| 107 | building a GUI application from the command line, if you build from the command |
---|
| 108 | line with the 5.5 command line tools then you must define the pre-processor |
---|
| 109 | symbol _NO_VCL in order to ensure that the correct link libraries are selected: |
---|
| 110 | the C++ Builder IDE normally sets this automatically. Hint, users of the 5.5 |
---|
| 111 | command line tools may want to add a -D_NO_VCL to bcc32.cfg in order to set |
---|
| 112 | this option permanently. |
---|
| 113 | </P> |
---|
| 114 | <P>If you would prefer to do a dynamic link to the regex libraries when using the |
---|
| 115 | dll runtime then define BOOST_REGEX_DYN_LINK (you must do this if you want to |
---|
| 116 | use boost.regex in multiple dll's), otherwise Boost.regex will be statically |
---|
| 117 | linked by default. </P> |
---|
| 118 | <P>If you want to suppress automatic linking altogether (and supply your own |
---|
| 119 | custom build of the lib) then define BOOST_REGEX_NO_LIB.</P> |
---|
| 120 | <P>If you are building with C++ Builder 6, you will find that |
---|
| 121 | <boost/regex.hpp> can not be used in a pre-compiled header (the actual |
---|
| 122 | problem is in <locale> which gets included by <boost/regex.hpp>), |
---|
| 123 | if this causes problems for you, then try defining BOOST_NO_STD_LOCALE when |
---|
| 124 | building, this will disable some features throughout boost, but may save you a |
---|
| 125 | lot in compile times!</P> |
---|
| 126 | <H3><A name="vc"></A>Microsoft Visual C++ 6, 7, 7.1 and 8</H3> |
---|
| 127 | <P>You need version 6 of MSVC to build this library. If you are using VC5 then you |
---|
| 128 | may want to look at one of the previous releases of this <A href="http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm"> |
---|
| 129 | library</A> |
---|
| 130 | </P> |
---|
| 131 | <P>Open up a command prompt, which has the necessary MSVC environment variables |
---|
| 132 | defined (for example by using the batch file Vcvars32.bat installed by the |
---|
| 133 | Visual Studio installation), and change to the <boost>\libs\regex\build |
---|
| 134 | directory. |
---|
| 135 | </P> |
---|
| 136 | <P>Select the correct makefile - vc6.mak for "vanilla" Visual C++ 6 or |
---|
| 137 | vc6-stlport.mak if you are using STLPort.</P> |
---|
| 138 | <P>Invoke the makefile like this:</P> |
---|
| 139 | <PRE>nmake -fvc6.mak</PRE> |
---|
| 140 | <P>You will now have a collection of lib and dll files in a "vc6" subdirectory, to |
---|
| 141 | install these into your development system use:</P> |
---|
| 142 | <PRE>nmake -fvc6.mak install</PRE> |
---|
| 143 | <P>The lib files will be copied to your <VC6>\lib directory and the dll |
---|
| 144 | files to <VC6>\bin, where <VC6> is the root of your Visual C++ 6 |
---|
| 145 | installation.</P> |
---|
| 146 | <P>You can delete all the temporary files created during the build (excluding lib |
---|
| 147 | and dll files) using:</P> |
---|
| 148 | <PRE>nmake -fvc6.mak clean </PRE> |
---|
| 149 | <P>If you want to build with ICU support, then you need to pass the path to your |
---|
| 150 | ICU directory to the makefile, for example with: |
---|
| 151 | </P> |
---|
| 152 | <PRE>nmake ICU_PATH=c:\open-source\icu -fvc71.mak install</PRE> |
---|
| 153 | <P>Finally when you use regex++ it is only necessary for you to add the |
---|
| 154 | <boost> root directory to your list of include directories for that |
---|
| 155 | project. It is not necessary for you to manually add a .lib file to the |
---|
| 156 | project; the headers will automatically select the correct .lib file for your |
---|
| 157 | build mode and tell the linker to include it. |
---|
| 158 | </P> |
---|
| 159 | <P>Note that if you want to dynamically link to the regex library when using the |
---|
| 160 | dynamic C++ runtime, define BOOST_REGEX_DYN_LINK when building your project.</P> |
---|
| 161 | <P>If you want to add the source directly to your project then define |
---|
| 162 | BOOST_REGEX_NO_LIB to disable automatic library selection.</P> |
---|
| 163 | <P>There are several important caveats to remember when using boost.regex with |
---|
| 164 | Microsoft's Compiler:</P> |
---|
| 165 | <UL> |
---|
| 166 | <LI> |
---|
| 167 | There have been some reports of compiler-optimization bugs affecting this |
---|
| 168 | library, (particularly with VC6 versions prior to service patch 5) the |
---|
| 169 | workaround is to build the library using /Oityb1 rather than /O2. That is to |
---|
| 170 | use all optimization settings except /Oa. This problem is reported to affect |
---|
| 171 | some standard library code as well (in fact I'm not sure if the problem is with |
---|
| 172 | the regex code or the underlying standard library), so it's probably worthwhile |
---|
| 173 | applying this workaround in normal practice in any case. |
---|
| 174 | <LI> |
---|
| 175 | If you have replaced the C++ standard library that comes with VC6, then when |
---|
| 176 | you build the library you must ensure that the environment variables "INCLUDE" |
---|
| 177 | and "LIB" have been updated to reflect the include and library paths for the |
---|
| 178 | new library - see vcvars32.bat (part of your Visual Studio installation) for |
---|
| 179 | more details. |
---|
| 180 | <LI> |
---|
| 181 | If you are building with the full STLPort v4.x, then use the vc6-stlport.mak |
---|
| 182 | file provided and set the environment variable STLPORT_PATH to point to the |
---|
| 183 | location of your STLPort installation (Note that the full STLPort libraries |
---|
| 184 | appear not to support single-thread static builds). |
---|
| 185 | <LI> |
---|
| 186 | If you are building your application with /Zc:wchar_t then you will need to |
---|
| 187 | modify the makefile to add /Zc:wchar_t before building the library. |
---|
| 188 | </LI> |
---|
| 189 | </UL> |
---|
| 190 | <H3><A name="gcc"></A>GCC(2.95 and 3.x) |
---|
| 191 | </H3> |
---|
| 192 | <P>You can build with gcc using the normal boost Jamfile in |
---|
| 193 | <boost>/libs/regex/build, alternatively there is a conservative makefile |
---|
| 194 | for the g++ compiler. From the command prompt change to the |
---|
| 195 | <boost>/libs/regex/build directory and type: |
---|
| 196 | </P> |
---|
| 197 | <PRE>make -fgcc.mak </PRE> |
---|
| 198 | <P>At the end of the build process you should have a gcc sub-directory containing |
---|
| 199 | release and debug versions of the library (libboost_regex.a and |
---|
| 200 | libboost_regex_debug.a). When you build projects that use regex++, you will |
---|
| 201 | need to add the boost install directory to your list of include paths and add |
---|
| 202 | <boost>/libs/regex/build/gcc/libboost_regex.a to your list of library |
---|
| 203 | files. |
---|
| 204 | </P> |
---|
| 205 | <P>There is also a makefile to build the library as a shared library:</P> |
---|
| 206 | <PRE>make -fgcc-shared.mak</PRE> |
---|
| 207 | <P>which will build libboost_regex.so and libboost_regex_debug.so.</P> |
---|
| 208 | <P>Both of the these makefiles support the following environment variables:</P> |
---|
| 209 | <P>ICU_PATH: tells the makefile to build with Unicode support, set to the path |
---|
| 210 | where your ICU installation is located, for example with: <code>make |
---|
| 211 | ICU_PATH=/usr/local install -fgcc.mak</code></P> |
---|
| 212 | <P>CXXFLAGS: extra compiler options - note that this applies to both the debug and |
---|
| 213 | release builds.</P> |
---|
| 214 | <P>INCLUDES: additional include directories.</P> |
---|
| 215 | <P>LDFLAGS: additional linker options.</P> |
---|
| 216 | <P>LIBS: additional library files.</P> |
---|
| 217 | <P>For the more adventurous there is a configure script in |
---|
| 218 | <boost>/libs/config; see the <A href="../../config/config.htm">config |
---|
| 219 | library documentation</A>.</P> |
---|
| 220 | <H3><A name="sun"></A>Sun Workshop 6.1</H3> |
---|
| 221 | <P>There is a makefile for the sun (6.1) compiler (C++ version 3.12). From the |
---|
| 222 | command prompt change to the <boost>/libs/regex/build directory and type: |
---|
| 223 | </P> |
---|
| 224 | <PRE>dmake -f sunpro.mak </PRE> |
---|
| 225 | <P>At the end of the build process you should have a sunpro sub-directory |
---|
| 226 | containing single and multithread versions of the library (libboost_regex.a, |
---|
| 227 | libboost_regex.so, libboost_regex_mt.a and libboost_regex_mt.so). When you |
---|
| 228 | build projects that use regex++, you will need to add the boost install |
---|
| 229 | directory to your list of include paths and add |
---|
| 230 | <boost>/libs/regex/build/sunpro/ to your library search path. |
---|
| 231 | </P> |
---|
| 232 | <P>Both of the these makefiles support the following environment variables:</P> |
---|
| 233 | <P>CXXFLAGS: extra compiler options - note that this applies to both the single |
---|
| 234 | and multithreaded builds.</P> |
---|
| 235 | <P>INCLUDES: additional include directories.</P> |
---|
| 236 | <P>LDFLAGS: additional linker options.</P> |
---|
| 237 | <P>LIBS: additional library files.</P> |
---|
| 238 | <P>LIBSUFFIX: a suffix to mangle the library name with (defaults to nothing).</P> |
---|
| 239 | <P>This makefile does not set any architecture specific options like -xarch=v9, |
---|
| 240 | you can set these by defining the appropriate macros, for example:</P> |
---|
| 241 | <PRE>dmake CXXFLAGS="-xarch=v9" LDFLAGS="-xarch=v9" LIBSUFFIX="_v9" -f sunpro.mak</PRE> |
---|
| 242 | <P>will build v9 variants of the regex library named libboost_regex_v9.a etc.</P> |
---|
| 243 | <H3><A name="other"></A>Makefiles for Other compilers: |
---|
| 244 | </H3> |
---|
| 245 | <P>There is a generic makefile (<A href="../build/generic.mak">generic.mak</A> ) |
---|
| 246 | provided in <boost-root>/libs/regex/build - see that makefile for details |
---|
| 247 | of environment variables that need to be set before use. |
---|
| 248 | <HR> |
---|
| 249 | <P></P> |
---|
| 250 | <p>Revised |
---|
| 251 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
---|
| 252 | 09 Jan 2005 |
---|
| 253 | <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p> |
---|
| 254 | <p><i>© Copyright John Maddock 1998- |
---|
| 255 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2005<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p> |
---|
| 256 | <P><I>Use, modification and distribution are subject to the Boost Software License, |
---|
| 257 | Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> |
---|
| 258 | or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P> |
---|
| 259 | </body> |
---|
| 260 | </html> |
---|