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-03-08 16:51:41] 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 ===== | ||
- | **XXX** WIP (previous version worked fine for shared libraries, trying to get static libraries working) | + | Both the C and C++ interfaces build fine "out of the box" |
- | http://www.postgresql.org/ftp/source/v8.3.9/ | + | There is a problem when building static libraries, though. The C interface uses the Win32 SSPI authentication interface ('' |
- | There is a bug in '' | + | Keeping SSPI means a little more work right now (to build '' |
- | LDFLAGS=" | + | Another issue is that '' |
- | to this: | + | ==== libpq (C interface) ==== |
- | LDFLAGS=" | + | PostgreSQL includes its own implementations of certain functions which are not available in Win32, such as '' |
- | Next, open '' | + | **NOTE:** The PostgreSQL developers have [[http://thread.gmane.org/ |
- | ifeq ($(PORTNAME), | + | First, get the latest source |
- | LIBS += -lws2_32 -lshfolder -lsecur32 | + | |
- | endif | + | |
- | Take care to edit '' | + | 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: | Then configure: | ||
Line 29: | Line 129: | ||
$ LDFLAGS=-L/ | $ LDFLAGS=-L/ | ||
- | We don't want to install the entire package (server and all); we'll just install the library and headers and the '' | + | 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/port all | ||
Line 37: | Line 137: | ||
$ make -C src/ | $ make -C src/ | ||
$ make -C src/ | $ make -C src/ | ||
+ | $ cp COPYRIGHT / | ||
- | ===== '' | + | ==== libpqxx (C++ interface) ==== |
- | http:// | + | First, get the latest source (currently 3.0.2) from http:// |
- | $ LDFLAGS=-L/ | + | Then configure: |
- | $ make all install | + | |
+ | $ LIBS=-lsecur32 LDFLAGS=-L/ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | Finally, build and install: | ||
+ | |||
+ | $ make all install | ||
+ | $ cp AUTHORS / | ||
+ | $ cat COPYING >>/ |