Thanks for all of the help.
Here, is the summary that I had promised.
In addition to the documentation here
https://www.postgresql.org/docs/manuals/
and
https://wiki.postgresql.org/wiki/Main_Page
I will explain how I install PostgreSQL using
on Windows using Mingw with zlib, pltcl, plperl, and plpython.
This information presented here is only meant to explain
solutions to things that are a little 'more difficult' on Windows.
Begin acquiring the software.
Get already compiled zlib here
ftp://ftp.zlatkovic.com/libxml/64bit/
Specifically, get exactly zlib from here.
ftp://ftp.zlatkovic.com/libxml/64bit/zlib-1.2.8-win32-x86_64.7z
(Note, the zlib home is actually here: http://www.zlib.net/)
Extract, those folders and files to a folder on disk.
For example.
C:\Users\TargetUser\Documents\zlib-1.2.8-win32-x86_64
Identify the header(include) and lib directories.
C:\Users\TargetUser\Documents\zlib-1.2.8-win32-x86_64\include
C:\Users\TargetUser\Documents\zlib-1.2.8-win32-x86_64\lib
Note those locations, and save that information for later
Information about the languages follow.
Get to know what the needed library versions from here.
(1) TCL with TK; 8.5
(2) Perl; 5.20
(3) Python; 3.3
http://get.enterprisedb.com/docs/README-languagepack-950.txt
(1) TCL with TK; 8.5
(2) Perl; 5.20
(3) Python; 3.3
http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt
Get Python and Perl from the Graphical installer from here.
http://www.enterprisedb.com/products-services-training/pgdownload#windows
Download the graphical installer and
install (1) Python and (2) PERL
Make a note of where the perl.exe and python.exe files are located.
C:\EnterpriseDB\LanguagePack\9.5\x64\Perl-5.20\bin\perl.exe
C:\EnterpriseDB\LanguagePack\9.5\x64\Python-3.3\python.exe
Do not install TCL from EnterpriseDB.
If one were TOO install the TCL from EnterpriseDB and
if one were to inspect the tclConfig.sh file that is found in the 'lib' directory,
a surprise may be seen.
The EnterpriseDB TCL tclConfig.sh file has a hard coded TCL_LIB_SPEC
TCL_LIB_SPEC='C:\EnterpriseDB\LanguagePack\9.5\x64\Tcl-8.5\lib\tcl85.lib'
But the TCL_LIB_SPEC actually needs to be something like
TCL_LIB_SPEC='-LC:/Path/To/folder/lib -ltcl85'
So EnterpriseDB TCL can not be used in the compiling
of the TCL language into PostgreSQL.
I found that to be surprising.
Download TCL from here.
https://www.tcl.tk/software/tcltk/
Specifically here
https://www.tcl.tk/software/tcltk/8.5.html
Install those files to a convenient place.
C:\Tcl.8.5.18.0
Inspect the tclConfig.sh file that is found in the 'lib' directory
This line
TCL_LIB_SPEC='-LC:/Tcl.8.5.18.0/lib -ltcl85'
is the form
TCL_LIB_SPEC='-LC:/Path/To/folder/lib -ltcl85'
So, this TCL is useful
Make a note of where the tclsh.exe executable is located
C:\Tcl.8.5.18.0\bin\tclsh.exe
The pexports.exe file is needed. This is NOT included in the
standard Mingw distribution ( but the dlltool.exe is in Mingw ).
This pexports.exe file is called a Mingw Extension.
For each language:Tcl, Perl, and Python,
pexports ( driven and done in 'make' later ) will run the following.
pexports LANGUAGE.dll > LANGUAGE.def
dlltool --dllname LANGUAGE.dll --def LANGUAGE.def --output-lib LANGUAGE.a
Specifically,
pexports /c/Tcl.8.5.18.0/bin//tcl85.dll > tcl85.def
dlltool --dllname tcl85.dll --def tcl85.def --output-lib libtcl85.a
pexports /c/EnterpriseDB/LanguagePack/9.5/x64/Perl-5.20/bin/perl520.dll > perl520.def
dlltool --dllname perl520.dll --def perl520.def --output-lib libperl520.a
pexports C:/Windows/system32/python33.dll > python33.def
dlltool --dllname python33.dll --def python33.def --output-lib libpython33.a
Notice, that the Python33.dll comes from the C:\Windows\system32 folder
and NOT the 'same directory as the executable' that Perl and TCL use.
I found that to be surprising.
Get pexports.exe from one of two places.
In one place, a compiled pexports.exe can found with
the Strawberry Perl distribution.
Specifically it is in here.
C:\Strawberry\c\bin
The other place is the source.
A person would have to manually compile and make the pexports.exe file.
The source is here.
https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/
Copy the pexports.exe to the same place where
the Mingw dlltool.exe is located ( this is already in the Mingw PATH ).
That is specifically here.
C:\x86_64-6.2.0-release-posix-seh-rt_v5-rev0\mingw64\bin
That was the end of acquiring the software.
This is the beginning of compiling.
Prepare to start an msys shell.
Edit the msys.bat file: C:\MinGW\msys\1.0\msys.bat
Near the top of the msys.bat file add the simple line that
removes anything not important to the compiling process from the PATH.
set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
In the MSYS shell at the command prompt($),
place the LANGUAGE .exes in the path.
export PATH=/c/Tcl.8.5.18.0/bin:$PATH
export PATH=/c/EnterpriseDB/LanguagePack/9.5/x64/Perl-5.20/bin:$PATH
export PATH=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3:$PATH
Configure.
Below are the options I use and why.
Start configuration.
./configure
Languages: their .exe files are in the path.
The ./lib and ./include locations
seems to be picked up from the location of the .exe in the PATH.
So no other ./include nor ./lib information are needed.
I found that to be slightly surprising.
-with-tcl --with-python --with-perl
zlib
--with-includes=/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/include --with-libraries=/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/lib
Compile target
--host=x86_64-w64-mingw32
Install location ( files are copied here as a result of 'make install' )
--prefix=/usr/local/pgsql_0ab9c56_debug
Make PostgreSQL relocatable, so I can move the binaries
to a different folder later and PostgreSQL will still start up.
--disable-rpath
For development, if a change is done such that something is re-compiled,
then dependent objects also get re-compiled.
--enable-depend
Debugging help
--enable-cassert --enable-debug
So, I can track exactly which github mirror version I have.
Also, I can track how much debugging information I have.
--with-extra-version=_CFLAGS_O_0ab9c56
For development, turn off optimizations,
so I can see the values of 'more' variables to aid in debugging.
CFLAGS="-O -fno-omit-frame-pointer"
So the configure line would approximately look like this.
However running it would still require it all to be on one very very long line.
./configure -with-tcl --with-python --with-perl
--with-includes=/c/Users/AnonymousUser/Documents/zlib-1.2.8-win32-x86_64/include --with-libraries=/c/Users/AnonymousUser/Documents/zlib-1.2.8-win32-x86_64/lib
--host=x86_64-w64-mingw32 --prefix=/usr/local/pgsql_0ab9c56_debug
--disable-rpath --enable-depend --enable-cassert --enable-debug
--with-extra-version=_CFLAGS_O_0ab9c56 CFLAGS="-O -fno-omit-frame-pointer"
After configuring, do the following.
Clean up with
make clean
Make with
make
Check with
make check
(Above) 'make check' actually makes a mini PostgreSQL,
so I make sure that I do not have another PostgreSQL up and
listening on the same ( default ) port of 5432.
Install with
make install
That was the end of compiling.
This is the beginning of extension creation.
Plan to startup PostgreSQL.
Get Portable PostgreSQL from here.
https://sourceforge.net/projects/postgresqlportable/
Extract the 'startup batch' file.
Customize the startup batch as necessary.
In the 'startup batch',
put the tclsh.exe, perl.exe,and python.exe 'paths' in the PATH.
Also, set the PYTHONHOME environment variable.
It is all explained in here.
http://get.enterprisedb.com/docs/README-languagepack-950.txt
http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt
Place the 'startup batch' file in the parent folder,
of the ./bin directory of PostgreSQL.
Modify the 'startup batch' environment variables including PG* postgreSQL
environment variables.
Execute the batch to start PostgreSQL.
Run the following SQL
create extension pltcl;
create extension plperl;
create extension plpython3u; ( or sometimes ... plythonu; )
Follow the rest of the instructions here.
https://www.postgresql.org/docs/current/static/pltcl-functions.html
https://www.postgresql.org/docs/current/static/plperl-funcs.html
https://www.postgresql.org/docs/current/static/plpython-funcs.html
This is the end of extension creation.
Consider more powerful Language distributions
( other than the ones that were mentioned earlier )
Activestate TCL
ACTIVETCL COMMUNITY EDITION DOWNLOAD
http://www.activestate.com/activetcl/downloads
Strawberry Perl
http://strawberryperl.com/
WinPython
https://winpython.github.io/
Andre Mikulec
Andre_Mikulec@xxxxxxxxxxx
|