version 1.1.1.1, 2012/10/09 09:19:17
|
version 1.1.1.2, 2013/07/22 08:25:55
|
Line 9 This document contains the following sections:
|
Line 9 This document contains the following sections:
|
Building for virtual Pascal |
Building for virtual Pascal |
Stack size in Windows environments |
Stack size in Windows environments |
Linking programs in Windows environments |
Linking programs in Windows environments |
|
Calling conventions in Windows environments |
Comments about Win32 builds |
Comments about Win32 builds |
Building PCRE on Windows with CMake |
Building PCRE on Windows with CMake |
Use of relative paths with CMake on Windows |
Use of relative paths with CMake on Windows |
Testing with RunTest.bat |
Testing with RunTest.bat |
|
Building under Windows CE with Visual Studio 200x |
Building under Windows with BCC5.5 |
Building under Windows with BCC5.5 |
|
Building using Borland C++ Builder 2007 (CB2007) and higher |
Building PCRE on OpenVMS |
Building PCRE on OpenVMS |
Building PCRE on Stratus OpenVOS |
Building PCRE on Stratus OpenVOS |
|
Building PCRE on native z/OS and z/VM |
|
|
|
|
GENERAL |
GENERAL |
Line 50 the .generic versions are not used.
|
Line 54 the .generic versions are not used.
|
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY |
|
|
The following are generic instructions for building the PCRE C library "by |
The following are generic instructions for building the PCRE C library "by |
hand": | hand". If you are going to use CMake, this section does not apply to you; you |
| can skip ahead to the CMake section. |
|
|
(1) Copy or rename the file config.h.generic as config.h, and edit the macro |
(1) Copy or rename the file config.h.generic as config.h, and edit the macro |
settings that it contains to whatever is appropriate for your environment. |
settings that it contains to whatever is appropriate for your environment. |
In particular, if you want to force a specific value for newline, you can |
|
define the NEWLINE macro. When you compile any of the PCRE modules, you |
|
must specify -DHAVE_CONFIG_H to your compiler so that config.h is included |
|
in the sources. |
|
|
|
|
In particular, you can alter the definition of the NEWLINE macro to |
|
specify what character(s) you want to be interpreted as line terminators. |
|
In an EBCDIC environment, you MUST change NEWLINE, because its default |
|
value is 10, an ASCII LF. The usual EBCDIC newline character is 21 (0x15, |
|
NL), though in some cases it may be 37 (0x25). |
|
|
|
When you compile any of the PCRE modules, you must specify -DHAVE_CONFIG_H |
|
to your compiler so that config.h is included in the sources. |
|
|
An alternative approach is not to edit config.h, but to use -D on the |
An alternative approach is not to edit config.h, but to use -D on the |
compiler command line to make any changes that you need to the |
compiler command line to make any changes that you need to the |
configuration options. In this case -DHAVE_CONFIG_H must not be set. |
configuration options. In this case -DHAVE_CONFIG_H must not be set. |
Line 106 hand":
|
Line 116 hand":
|
pcre_fullinfo.c |
pcre_fullinfo.c |
pcre_get.c |
pcre_get.c |
pcre_globals.c |
pcre_globals.c |
|
pcre_jit_compile.c |
pcre_maketables.c |
pcre_maketables.c |
pcre_newline.c |
pcre_newline.c |
pcre_ord2utf8.c |
pcre_ord2utf8.c |
Line 123 hand":
|
Line 134 hand":
|
sought in the current directory. Otherwise you run the risk of picking up |
sought in the current directory. Otherwise you run the risk of picking up |
a previously-installed file from somewhere else. |
a previously-installed file from somewhere else. |
|
|
(6) If you have defined SUPPORT_JIT in config.h, you must also compile | Note that you must still compile pcre_jit_compile.c, even if you have not |
| defined SUPPORT_JIT in config.h, because when JIT support is not |
| configured, dummy functions are compiled. When JIT support IS configured, |
| pcre_jit_compile.c #includes sources from the sljit subdirectory, where |
| there should be 16 files, all of whose names begin with "sljit". |
|
|
pcre_jit_compile.c | (6) Now link all the compiled code into an object library in whichever form |
| |
This file #includes sources from the sljit subdirectory, where there | |
should be 16 files, all of whose names begin with "sljit". | |
| |
(7) Now link all the compiled code into an object library in whichever form | |
your system keeps such libraries. This is the basic PCRE C 8-bit library. |
your system keeps such libraries. This is the basic PCRE C 8-bit library. |
If your system has static and shared libraries, you may have to do this |
If your system has static and shared libraries, you may have to do this |
once for each type. |
once for each type. |
|
|
(8) If you want to build a 16-bit library (as well as, or instead of the 8-bit | (7) If you want to build a 16-bit library (as well as, or instead of the 8-bit |
library) repeat steps 5-7 with the following files: | or 32-bit libraries) repeat steps 5-6 with the following files: |
|
|
pcre16_byte_order.c |
pcre16_byte_order.c |
pcre16_chartables.c |
pcre16_chartables.c |
Line 147 hand":
|
Line 157 hand":
|
pcre16_fullinfo.c |
pcre16_fullinfo.c |
pcre16_get.c |
pcre16_get.c |
pcre16_globals.c |
pcre16_globals.c |
pcre16_jit_compile.c (if SUPPORT_JIT is defined) | pcre16_jit_compile.c |
pcre16_maketables.c |
pcre16_maketables.c |
pcre16_newline.c |
pcre16_newline.c |
pcre16_ord2utf16.c |
pcre16_ord2utf16.c |
Line 161 hand":
|
Line 171 hand":
|
pcre16_version.c |
pcre16_version.c |
pcre16_xclass.c |
pcre16_xclass.c |
|
|
|
(8) If you want to build a 16-bit library (as well as, or instead of the 8-bit |
|
or 32-bit libraries) repeat steps 5-6 with the following files: |
|
|
|
pcre32_byte_order.c |
|
pcre32_chartables.c |
|
pcre32_compile.c |
|
pcre32_config.c |
|
pcre32_dfa_exec.c |
|
pcre32_exec.c |
|
pcre32_fullinfo.c |
|
pcre32_get.c |
|
pcre32_globals.c |
|
pcre32_jit_compile.c |
|
pcre32_maketables.c |
|
pcre32_newline.c |
|
pcre32_ord2utf32.c |
|
pcre32_refcount.c |
|
pcre32_string_utils.c |
|
pcre32_study.c |
|
pcre32_tables.c |
|
pcre32_ucd.c |
|
pcre32_utf32_utils.c |
|
pcre32_valid_utf32.c |
|
pcre32_version.c |
|
pcre32_xclass.c |
|
|
(9) If you want to build the POSIX wrapper functions (which apply only to the |
(9) If you want to build the POSIX wrapper functions (which apply only to the |
8-bit library), ensure that you have the pcreposix.h file and then compile |
8-bit library), ensure that you have the pcreposix.h file and then compile |
pcreposix.c (remembering -DHAVE_CONFIG_H if necessary). Link the result |
pcreposix.c (remembering -DHAVE_CONFIG_H if necessary). Link the result |
(on its own) as the pcreposix library. |
(on its own) as the pcreposix library. |
|
|
(10) The pcretest program can be linked with either or both of the 8-bit and | (10) The pcretest program can be linked with any combination of the 8-bit, |
16-bit libraries (depending on what you selected in config.h). Compile | 16-bit and 32-bit libraries (depending on what you selected in config.h). |
pcretest.c and pcre_printint.c (again, don't forget -DHAVE_CONFIG_H) and | Compile pcretest.c and pcre_printint.c (again, don't forget |
link them together with the appropriate library/ies. If you compiled an | -DHAVE_CONFIG_H) and link them together with the appropriate library/ies. |
8-bit library, pcretest also needs the pcreposix wrapper library unless | If you compiled an 8-bit library, pcretest also needs the pcreposix |
you compiled it with -DNOPOSIX. | wrapper library unless you compiled it with -DNOPOSIX. |
|
|
(11) Run pcretest on the testinput files in the testdata directory, and check |
(11) Run pcretest on the testinput files in the testdata directory, and check |
that the output matches the corresponding testoutput files. There are |
that the output matches the corresponding testoutput files. There are |
comments about what each test does in the section entitled "Testing PCRE" |
comments about what each test does in the section entitled "Testing PCRE" |
in the README file. If you compiled both an 8-bit and a 16-bit library, | in the README file. If you compiled more than one of the 8-bit, 16-bit and |
you need to run pcretest with the -16 option to do 16-bit tests. | 32-bit libraries, you need to run pcretest with the -16 option to do |
| 16-bit tests and with the -32 option to do 32-bit tests. |
|
|
Some tests are relevant only when certain build-time options are selected. |
Some tests are relevant only when certain build-time options are selected. |
For example, test 4 is for UTF-8 or UTF-16 support, and will not run if | For example, test 4 is for UTF-8/UTF-16/UTF-32 support, and will not run |
you have built PCRE without it. See the comments at the start of each | if you have built PCRE without it. See the comments at the start of each |
testinput file. If you have a suitable Unix-like shell, the RunTest script |
testinput file. If you have a suitable Unix-like shell, the RunTest script |
will run the appropriate tests for you. | will run the appropriate tests for you. The command "RunTest list" will |
| output a list of all the tests. |
|
|
Note that the supplied files are in Unix format, with just LF characters |
Note that the supplied files are in Unix format, with just LF characters |
as line terminators. You may need to edit them to change this if your |
as line terminators. You may need to edit them to change this if your |
Line 195 hand":
|
Line 233 hand":
|
|
|
(12) If you have built PCRE with SUPPORT_JIT, the JIT features will be tested |
(12) If you have built PCRE with SUPPORT_JIT, the JIT features will be tested |
by the testdata files. However, you might also like to build and run |
by the testdata files. However, you might also like to build and run |
the JIT test program, pcre_jit_test.c. | the freestanding JIT test program, pcre_jit_test.c. |
|
|
(13) If you want to use the pcregrep command, compile and link pcregrep.c; it |
(13) If you want to use the pcregrep command, compile and link pcregrep.c; it |
uses only the basic 8-bit PCRE library (it does not need the pcreposix |
uses only the basic 8-bit PCRE library (it does not need the pcreposix |
Line 336 BUILDING PCRE ON WINDOWS WITH CMAKE
|
Line 374 BUILDING PCRE ON WINDOWS WITH CMAKE
|
CMake is an alternative configuration facility that can be used instead of |
CMake is an alternative configuration facility that can be used instead of |
"configure". CMake creates project files (make files, solution files, etc.) |
"configure". CMake creates project files (make files, solution files, etc.) |
tailored to numerous development environments, including Visual Studio, |
tailored to numerous development environments, including Visual Studio, |
Borland, Msys, MinGW, NMake, and Unix. If possible, use short paths with no | Borland, Msys, MinGW, NMake, and Unix. If possible, use short paths with no |
spaces in the names for your CMake installation and your PCRE source and build |
spaces in the names for your CMake installation and your PCRE source and build |
directories. |
directories. |
|
|
The following instructions were contributed by a PCRE user. | The following instructions were contributed by a PCRE user. If they are not |
| followed exactly, errors may occur. In the event that errors do occur, it is |
| recommended that you delete the CMake cache before attempting to repeat the |
| CMake build process. In the CMake GUI, the cache can be deleted by selecting |
| "File > Delete Cache". |
|
|
1. Install the latest CMake version available from http://www.cmake.org/, and |
1. Install the latest CMake version available from http://www.cmake.org/, and |
ensure that cmake\bin is on your path. |
ensure that cmake\bin is on your path. |
Line 354 The following instructions were contributed by a PCRE
|
Line 396 The following instructions were contributed by a PCRE
|
source dir. For example, C:\pcre\pcre-xx\build. |
source dir. For example, C:\pcre\pcre-xx\build. |
|
|
4. Run cmake-gui from the Shell envirornment of your build tool, for example, |
4. Run cmake-gui from the Shell envirornment of your build tool, for example, |
Msys for Msys/MinGW or Visual Studio Command Prompt for VC/VC++. | Msys for Msys/MinGW or Visual Studio Command Prompt for VC/VC++. Do not try |
| to start Cmake from the Windows Start menu, as this can lead to errors. |
|
|
5. Enter C:\pcre\pcre-xx and C:\pcre\pcre-xx\build for the source and build |
5. Enter C:\pcre\pcre-xx and C:\pcre\pcre-xx\build for the source and build |
directories, respectively. |
directories, respectively. |
Line 389 The following instructions were contributed by a PCRE
|
Line 432 The following instructions were contributed by a PCRE
|
|
|
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS |
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS |
|
|
A PCRE user comments as follows: | A PCRE user comments as follows: I thought that others may want to know the |
| current state of CMAKE_USE_RELATIVE_PATHS support on Windows. Here it is: |
|
|
I thought that others may want to know the current state of |
|
CMAKE_USE_RELATIVE_PATHS support on Windows. |
|
|
|
Here it is: |
|
-- AdditionalIncludeDirectories is only partially modified (only the |
-- AdditionalIncludeDirectories is only partially modified (only the |
first path - see below) | first path - see below) |
-- Only some of the contained file paths are modified - shown below for |
-- Only some of the contained file paths are modified - shown below for |
pcre.vcproj | pcre.vcproj |
-- It properly modifies |
-- It properly modifies |
|
|
I am sure CMake people can fix that if they want to. Until then one will |
I am sure CMake people can fix that if they want to. Until then one will |
Line 410 deal.
|
Line 450 deal.
|
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" |
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" |
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" |
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" |
|
|
RelativePath="pcre.h"> | RelativePath="pcre.h" |
RelativePath="pcre_chartables.c"> | RelativePath="pcre_chartables.c" |
RelativePath="pcre_chartables.c.rule"> | RelativePath="pcre_chartables.c.rule" |
|
|
|
|
TESTING WITH RUNTEST.BAT |
TESTING WITH RUNTEST.BAT |
Line 450 To test pcrecpp, run pcrecpp_unittest.exe, pcre_string
|
Line 490 To test pcrecpp, run pcrecpp_unittest.exe, pcre_string
|
pcre_scanner_unittest.exe. |
pcre_scanner_unittest.exe. |
|
|
|
|
|
BUILDING UNDER WINDOWS CE WITH VISUAL STUDIO 200x |
|
|
|
Vincent Richomme sent a zip archive of files to help with this process. They |
|
can be found in the file "pcre-vsbuild.zip" in the Contrib directory of the FTP |
|
site. |
|
|
|
|
BUILDING UNDER WINDOWS WITH BCC5.5 |
BUILDING UNDER WINDOWS WITH BCC5.5 |
|
|
Michael Roy sent these comments about building PCRE under Windows with BCC5.5: |
Michael Roy sent these comments about building PCRE under Windows with BCC5.5: |
|
|
Some of the core BCC libraries have a version of PCRE from 1998 built in, | Some of the core BCC libraries have a version of PCRE from 1998 built in, which |
which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a | can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a version |
version mismatch. I'm including an easy workaround below, if you'd like to | mismatch. I'm including an easy workaround below, if you'd like to include it |
include it in the non-unix instructions: | in the non-unix instructions: |
|
|
When linking a project with BCC5.5, pcre.lib must be included before any of | When linking a project with BCC5.5, pcre.lib must be included before any of the |
the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command | libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command line. |
line. | |
|
|
|
|
BUILDING UNDER WINDOWS CE WITH VISUAL STUDIO 200x | BUILDING USING BORLAND C++ BUILDER 2007 (CB2007) AND HIGHER |
|
|
Vincent Richomme sent a zip archive of files to help with this process. They | A PCRE user sent these comments about this environment (see also the comment |
can be found in the file "pcre-vsbuild.zip" in the Contrib directory of the FTP | from another user that follows them): |
site. | |
|
|
|
The XE versions of C++ Builder come with a RegularExpressionsCore class which |
|
contain a version of TPerlRegEx. However, direct use of the C PCRE library may |
|
be desirable. |
|
|
|
The default makevp.bat, however, supplied with PCRE builds a version of PCRE |
|
that is not usable with any version of C++ Builder because the compiler ships |
|
with an embedded version of PCRE, version 2.01 from 1998! [See also the note |
|
about BCC5.5 above.] If you want to use PCRE you'll need to rename the |
|
functions (pcre_compile to pcre_compile_bcc, etc) or do as I have done and just |
|
use the 16 bit versions. I'm using std::wstring everywhere anyway. Since the |
|
embedded version of PCRE does not have the 16 bit function names, there is no |
|
conflict. |
|
|
|
Building PCRE using a C++ Builder static library project file (recommended): |
|
|
|
1. Rename or remove pcre.h, pcreposi.h, and pcreposix.h from your C++ Builder |
|
original include path. |
|
|
|
2. Download PCRE from pcre.org and extract to a directory. |
|
|
|
3. Rename pcre_chartables.c.dist to pcre_chartables.c, pcre.h.generic to |
|
pcre.h, and config.h.generic to config.h. |
|
|
|
4. Edit pcre.h and pcre_config.c so that they include config.h. |
|
|
|
5. Edit config.h like so: |
|
|
|
Comment out the following lines: |
|
#define PACKAGE "pcre" |
|
#define PACKAGE_BUGREPORT "" |
|
#define PACKAGE_NAME "PCRE" |
|
#define PACKAGE_STRING "PCRE 8.32" |
|
#define PACKAGE_TARNAME "pcre" |
|
#define PACKAGE_URL "" |
|
#define PACKAGE_VERSION "8.32" |
|
|
|
Add the following lines: |
|
#ifndef SUPPORT_UTF |
|
#define SUPPORT_UTF 100 // any value is fine |
|
#endif |
|
|
|
#ifndef SUPPORT_UCP |
|
#define SUPPORT_UCP 101 // any value is fine |
|
#endif |
|
|
|
#ifndef SUPPORT_UCP |
|
#define SUPPORT_PCRE16 102 // any value is fine |
|
#endif |
|
|
|
#ifndef SUPPORT_UTF8 |
|
#define SUPPORT_UTF8 103 // any value is fine |
|
#endif |
|
|
|
6. Build a C++ Builder project using the IDE. Go to File / New / Other and |
|
choose Static Library. You can name it pcre.cbproj or whatever. Now set your |
|
paths by going to Project / Options. Set the Include path. Do this from the |
|
"Base" option to apply to both Release and Debug builds. Now add the following |
|
files to the project: |
|
|
|
pcre.h |
|
pcre16_byte_order.c |
|
pcre16_chartables.c |
|
pcre16_compile.c |
|
pcre16_config.c |
|
pcre16_dfa_exec.c |
|
pcre16_exec.c |
|
pcre16_fullinfo.c |
|
pcre16_get.c |
|
pcre16_globals.c |
|
pcre16_maketables.c |
|
pcre16_newline.c |
|
pcre16_ord2utf16.c |
|
pcre16_printint.c |
|
pcre16_refcount.c |
|
pcre16_string_utils.c |
|
pcre16_study.c |
|
pcre16_tables.c |
|
pcre16_ucd.c |
|
pcre16_utf16_utils.c |
|
pcre16_valid_utf16.c |
|
pcre16_version.c |
|
pcre16_xclass.c |
|
|
|
//Optional |
|
pcre_version.c |
|
|
|
7. After compiling the .lib file, copy the .lib and header files to a project |
|
you want to use PCRE with. Enjoy. |
|
|
|
Optional ... Building PCRE using the makevp.bat file: |
|
|
|
1. Edit makevp_c.txt and makevp_l.txt and change all the names to the 16 bit |
|
versions. |
|
|
|
2. Edit makevp.bat and set the path to C++ Builder. Run makevp.bat. |
|
|
|
Another PCRE user added this comment: |
|
|
|
Another approach I successfully used for some years with BCB 5 and 6 was to |
|
make sure that include and library paths of PCRE are configured before the |
|
default paths of the IDE in the dialogs where one can manage those paths. |
|
Afterwards one can open the project files using a text editor and manually add |
|
the self created library for pcre itself, pcrecpp doesn't ship with the IDE, in |
|
the library nodes where the IDE manages its own libraries to link against in |
|
front of the IDE-own libraries. This way one can use the default PCRE function |
|
names without getting access violations on runtime. |
|
|
|
<ALLLIB value="libpcre.lib $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/> |
|
|
|
|
BUILDING PCRE ON OPENVMS |
BUILDING PCRE ON OPENVMS |
|
|
Dan Mooney sent the following comments about building PCRE on OpenVMS. They | Stephen Hoffman sent the following, in December 2012: |
relate to an older version of PCRE that used fewer source files, so the exact | |
commands will need changing. See the current list of source files above. | |
|
|
|
"Here <http://labs.hoffmanlabs.com/node/1847> is a very short write-up on the |
|
OpenVMS port and here |
|
|
|
<http://labs.hoffmanlabs.com/labsnotes/pcre-vms-8_32.zip> |
|
|
|
is a zip with the OpenVMS files, and with one modified testing-related PCRE |
|
file." This is a port of PCRE 8.32. |
|
|
|
Earlier, Dan Mooney sent the following comments about building PCRE on OpenVMS. |
|
They relate to an older version of PCRE that used fewer source files, so the |
|
exact commands will need changing. See the current list of source files above. |
|
|
"It was quite easy to compile and link the library. I don't have a formal |
"It was quite easy to compile and link the library. I don't have a formal |
make file but the attached file [reproduced below] contains the OpenVMS DCL |
make file but the attached file [reproduced below] contains the OpenVMS DCL |
commands I used to build the library. I had to add #define |
commands I used to build the library. I had to add #define |
Line 581 appear to be related to the port itself, please let me
|
Line 745 appear to be related to the port itself, please let me
|
build.log file in the root of the package also. |
build.log file in the root of the package also. |
|
|
|
|
|
BUILDING PCRE ON NATIVE Z/OS AND Z/VM |
|
|
|
z/OS and z/VM are operating systems for mainframe computers, produced by IBM. |
|
The character code used is EBCDIC, not ASCII or Unicode. In z/OS, UNIX APIs and |
|
applications can be supported through UNIX System Services, and in such an |
|
environment PCRE can be built in the same way as in other systems. However, in |
|
native z/OS (without UNIX System Services) and in z/VM, special ports are |
|
required. For details, please see this web site: |
|
|
|
http://www.zaconsultants.net |
|
|
|
There is also a mirror here: |
|
|
|
http://www.vsoft-software.com/downloads.html |
|
|
========================== |
========================== |
Last Updated: 18 June 2012 | Last Updated: 14 May 2013 |