Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
diana:windows:building:sql [2010-02-18 13:55:17] dages |
diana:windows:building:sql [2022-05-31 09:29:31] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Building the MySQL and PostgreSQL libraries on Windows ====== | ====== Building the MySQL and PostgreSQL libraries on Windows ====== | ||
+ | |||
+ | ===== MySQL ===== | ||
MySQL does not support gcc on Windows, only MSVC. Moved to a [[windows: | MySQL does not support gcc on Windows, only MSVC. Moved to a [[windows: | ||
Line 5: | Line 7: | ||
===== PostgreSQL ===== | ===== PostgreSQL ===== | ||
- | http:// | + | Both the C and C++ interfaces build fine "out of the box" (except for the '' |
+ | |||
+ | There is a problem when building static libraries, though. | ||
+ | |||
+ | Keeping SSPI means a little more work right now (to build '' | ||
+ | |||
+ | Another issue is that '' | ||
+ | |||
+ | ==== libpq (C interface) ==== | ||
+ | |||
+ | PostgreSQL includes its own implementations of certain functions which are not available in Win32, such as '' | ||
+ | |||
+ | **NOTE:** The PostgreSQL developers have [[http:// | ||
+ | |||
+ | First, get the latest source (currently 8.3.9 for the 8.3 branch) from http:// | ||
+ | |||
+ | Next, apply the patch below. | ||
+ | |||
+ | $ patch -b -l -p0 | ||
+ | |||
+ | then copy & paste the patch. | ||
+ | |||
+ | |||
+ | --- src/ | ||
+ | +++ src/ | ||
+ | @@ -337,6 +337,7 @@ | ||
+ | * When necessary, these routines are provided by files in src/ | ||
+ | */ | ||
+ | # | ||
+ | +#define crypt pq_crypt | ||
+ | | ||
+ | # | ||
+ | |||
+ | @@ -351,44 +352,60 @@ | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define getopt pq_getopt | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define isinf pq_isinf | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define rint pq_rint | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | +#define inet_aton pq_inet_aton | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define strdup pq_strdup | ||
+ | | ||
+ | # | ||
+ | |||
+ | +#ifndef HAVE_STRLCAT | ||
+ | +#define strlcat pq_strlcat | ||
+ | +#endif | ||
+ | + | ||
+ | #if !HAVE_DECL_STRLCAT | ||
+ | | ||
+ | # | ||
+ | |||
+ | +#ifndef HAVE_STRLCPY | ||
+ | +#define strlcpy pq_strlcpy | ||
+ | +#endif | ||
+ | + | ||
+ | #if !HAVE_DECL_STRLCPY | ||
+ | | ||
+ | # | ||
+ | |||
+ | #if !defined(HAVE_RANDOM) && !defined(__BORLANDC__) | ||
+ | +#define random pq_random | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define unsetenv pq_unsetenv | ||
+ | | ||
+ | # | ||
+ | |||
+ | # | ||
+ | +#define srandom pq_srandom | ||
+ | | ||
+ | # | ||
+ | |||
+ | --- src/ | ||
+ | +++ src/ | ||
+ | @@ -435,9 +435,10 @@ | ||
+ | | ||
+ | |||
+ | # to make ws2_32.lib the last library, and always link with shfolder, | ||
+ | -# so SHGetFolderName isn't picked up from shell32.dll | ||
+ | +# so SHGetFolderName isn't picked up from shell32.dll. | ||
+ | +# with secur32 for SSPI. | ||
+ | ifeq ($(PORTNAME), | ||
+ | -LIBS += -lws2_32 -lshfolder | ||
+ | +LIBS += -lws2_32 -lshfolder -lsecur32 | ||
+ | | ||
+ | |||
+ | # Not really standard libc functions, used by the backend. | ||
+ | --- src/ | ||
+ | +++ src/ | ||
+ | @@ -1,4 +1,4 @@ | ||
+ | # This is required to link pg_dump because it finds pg_toupper() in | ||
+ | # libpq and pgport | ||
+ | -LDFLAGS=" | ||
+ | +LDFLAGS=" | ||
+ | |||
+ | |||
+ | Then configure: | ||
+ | |||
+ | $ LDFLAGS=-L/ | ||
+ | |||
+ | We don't want to install the entire package (server and all); we'll just install the library and headers and the '' | ||
+ | |||
+ | $ make -C src/port all | ||
+ | $ make -C src/backend utils/ | ||
+ | $ make -C src/backend ../ | ||
+ | $ make -C src/include all install | ||
+ | $ make -C src/ | ||
+ | $ make -C src/ | ||
+ | $ cp COPYRIGHT / | ||
+ | |||
+ | ==== libpqxx (C++ interface) ==== | ||
+ | |||
+ | First, get the latest source (currently 3.0.2) from http:// | ||
+ | |||
+ | Then configure: | ||
- | $ LDFLAGS=-no-undefined | + | $ LIBS=-lsecur32 |
- | $ make | + | |
- | $ make -C src/ | + | |
- | $ make -C src/ | + | |
- | $ make -C src/include install | + | |
- | http:// | + | The '' |
- | $ PG_CONFIG=/ | + | Finally, build and install: |
- | | + | |
- | $ make && make install | + | |
+ | $ make all install | ||
+ | $ cp AUTHORS / | ||
+ | $ cat COPYING >>/ |