Thread: Regarding installation of FDW on Windows

Regarding installation of FDW on Windows

From
Atri Sharma
Date:
Hi all,

I am trying to install my FDW project on windows.I did some research
and I believe I shall be requiring pre compiled binaries(dll files).I
tried cross compiling using MinGW on my Ubuntu.I am using PGXS for
compiling and making my project.I tried overriding CC and setting it
to the MinGW C compiler,but I am getting header file not found errors.

How can I compile binaries for windows with PGXS?

Atri

-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
Dave Page
Date:
On Fri, Jul 13, 2012 at 9:31 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
> Hi all,
>
> I am trying to install my FDW project on windows.I did some research
> and I believe I shall be requiring pre compiled binaries(dll files).I
> tried cross compiling using MinGW on my Ubuntu.I am using PGXS for
> compiling and making my project.I tried overriding CC and setting it
> to the MinGW C compiler,but I am getting header file not found errors.
>
> How can I compile binaries for windows with PGXS?

Are you trying to build them to use with the EDB distribution, or your
own builds? If the former, then you'll likely need to build with VC++
which means you cannot use PGXS. If it's your own build, then as long
as you used Mingw/Msys in the first place, you should be able to use
PGXS as you would on Linux.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 2:11 PM, Dave Page <dpage@pgadmin.org> wrote:
> On Fri, Jul 13, 2012 at 9:31 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>> Hi all,
>>
>> I am trying to install my FDW project on windows.I did some research
>> and I believe I shall be requiring pre compiled binaries(dll files).I
>> tried cross compiling using MinGW on my Ubuntu.I am using PGXS for
>> compiling and making my project.I tried overriding CC and setting it
>> to the MinGW C compiler,but I am getting header file not found errors.
>>
>> How can I compile binaries for windows with PGXS?
>
> Are you trying to build them to use with the EDB distribution, or your
> own builds? If the former, then you'll likely need to build with VC++
> which means you cannot use PGXS. If it's your own build, then as long
> as you used Mingw/Msys in the first place, you should be able to use
> PGXS as you would on Linux.
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company

Hi Dave,

I am sorry,I am not too sure about EDB.Cannot I cross compile even for
EnterpriseDB version?

I am not too good with windows.I downloaded PostgreSQL 9.1 for windows
from PostgreSQL website.

What should I be doing?

Atri
-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
Dave Page
Date:
On Fri, Jul 13, 2012 at 9:46 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>
> Hi Dave,
>
> I am sorry,I am not too sure about EDB.Cannot I cross compile even for
> EnterpriseDB version?

I doubt it. The EDB builds are compiled with VC++ 2008 (for 9.0/9.1).
If you cross-compile with GCC, you'll be using a different version of
the runtime library.

> I am not too good with windows.I downloaded PostgreSQL 9.1 for windows
> from PostgreSQL website.
>
> What should I be doing?

You'll need to get a copy of VC++ 2008 (the express version is a free
download), and create a VC++ project file to compile your FDW. I'd
suggest you actually try building PostgreSQL first, as that will cause
a number of project files to be generated which you could use as a
reference.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:

Sent from my iPad

On 13-Jul-2012, at 2:23 PM, Dave Page <dpage@pgadmin.org> wrote:

> On Fri, Jul 13, 2012 at 9:46 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>>
>> Hi Dave,
>>
>> I am sorry,I am not too sure about EDB.Cannot I cross compile even for
>> EnterpriseDB version?
>
> I doubt it. The EDB builds are compiled with VC++ 2008 (for 9.0/9.1).
> If you cross-compile with GCC, you'll be using a different version of
> the runtime library.
>
>> I am not too good with windows.I downloaded PostgreSQL 9.1 for windows
>> from PostgreSQL website.
>>
>> What should I be doing?
>
> You'll need to get a copy of VC++ 2008 (the express version is a free
> download), and create a VC++ project file to compile your FDW. I'd
> suggest you actually try building PostgreSQL first, as that will cause
> a number of project files to be generated which you could use as a
> reference.
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company


Hi Dave,

Thanks for the advice.i shall build PostgreSQL from sources in windows,then,try to get vc++ installed and configured"?

Atri

Re: Regarding installation of FDW on Windows

From
Dave Page
Date:
On Fri, Jul 13, 2012 at 10:04 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>
> Thanks for the advice.i shall build PostgreSQL from sources in windows,then,try to get vc++ installed and
configured"?

No, the other way round - that'll prove VC++ is setup correctly.

Note that you don't actually need to build PG from source (or
shouldn't do) - the reasons I suggest it are that it'll prove your
VC++ environment is setup well, and it'll give you some project files
to use as templates.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 3:21 PM, Dave Page <dpage@pgadmin.org> wrote:
> On Fri, Jul 13, 2012 at 10:04 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>>
>> Thanks for the advice.i shall build PostgreSQL from sources in windows,then,try to get vc++ installed and
configured"?
>
> No, the other way round - that'll prove VC++ is setup correctly.
>
> Note that you don't actually need to build PG from source (or
> shouldn't do) - the reasons I suggest it are that it'll prove your
> VC++ environment is setup well, and it'll give you some project files
> to use as templates.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company

Okies,thanks.

Another thing,could you please help me in installation of my FDW
project in packaged installations of PostgreSQL in Debian and Red
hat?I did source based installations.

Atri

-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
Dave Page
Date:
On Fri, Jul 13, 2012 at 11:03 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>
> Okies,thanks.
>
> Another thing,could you please help me in installation of my FDW
> project in packaged installations of PostgreSQL in Debian and Red
> hat?I did source based installations.

I'm not really involved with the native packages for those platforms
so cannot help I'm afraid. Building against the EDB installers for
Linux should be as simple as using PGXS though.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 3:35 PM, Dave Page <dpage@pgadmin.org> wrote:
> On Fri, Jul 13, 2012 at 11:03 AM, Atri Sharma <atri.jiit@gmail.com> wrote:
>>
>> Okies,thanks.
>>
>> Another thing,could you please help me in installation of my FDW
>> project in packaged installations of PostgreSQL in Debian and Red
>> hat?I did source based installations.
>
> I'm not really involved with the native packages for those platforms
> so cannot help I'm afraid. Building against the EDB installers for
> Linux should be as simple as using PGXS though.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company

Ok,Thanks a ton!

Atri

-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
"Albe Laurenz"
Date:
Atri Sharma wrote:
> On Fri, Jul 13, 2012 at 2:11 PM, Dave Page <dpage@pgadmin.org> wrote:
>> On Fri, Jul 13, 2012 at 9:31 AM, Atri Sharma <atri.jiit@gmail.com>
wrote:
>>> I am trying to install my FDW project on windows.I did some research
>>> and I believe I shall be requiring pre compiled binaries(dll
files).I
>>> tried cross compiling using MinGW on my Ubuntu.I am using PGXS for
>>> compiling and making my project.I tried overriding CC and setting it
>>> to the MinGW C compiler,but I am getting header file not found
errors.
>>>
>>> How can I compile binaries for windows with PGXS?

>> Are you trying to build them to use with the EDB distribution, or
your
>> own builds? If the former, then you'll likely need to build with VC++
>> which means you cannot use PGXS. If it's your own build, then as long
>> as you used Mingw/Msys in the first place, you should be able to use
>> PGXS as you would on Linux.

> I am sorry,I am not too sure about EDB.Cannot I cross compile even for
> EnterpriseDB version?
>
> I am not too good with windows.I downloaded PostgreSQL 9.1 for windows
> from PostgreSQL website.
>
> What should I be doing?

I have never tried cross compiling PostgreSQL for Windows, and I
don't know if it works.  If you have a Windows machine, do it there,
if not, forget it since you cannot even test your binaries :^)

You can either use PGXS with MinGW, which should work just like
building on UNIX, or use Microsoft Visual C++ / Windows SDK.

If you use EnterpriseDB's binary downloads, which are built
with MSVC, you'll have to compile your extension "by hand".

I have read a report that extensions built with MinGW are
compatible with EDB's binaries if you use --disable-float8-byval
(http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
apper-odbc_fdw-on-windows.html).

Yours,
Laurenz Albe


Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 5:37 PM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
> Atri Sharma wrote:
>> On Fri, Jul 13, 2012 at 2:11 PM, Dave Page <dpage@pgadmin.org> wrote:
>>> On Fri, Jul 13, 2012 at 9:31 AM, Atri Sharma <atri.jiit@gmail.com>
> wrote:
>>>> I am trying to install my FDW project on windows.I did some research
>>>> and I believe I shall be requiring pre compiled binaries(dll
> files).I
>>>> tried cross compiling using MinGW on my Ubuntu.I am using PGXS for
>>>> compiling and making my project.I tried overriding CC and setting it
>>>> to the MinGW C compiler,but I am getting header file not found
> errors.
>>>>
>>>> How can I compile binaries for windows with PGXS?
>
>>> Are you trying to build them to use with the EDB distribution, or
> your
>>> own builds? If the former, then you'll likely need to build with VC++
>>> which means you cannot use PGXS. If it's your own build, then as long
>>> as you used Mingw/Msys in the first place, you should be able to use
>>> PGXS as you would on Linux.
>
>> I am sorry,I am not too sure about EDB.Cannot I cross compile even for
>> EnterpriseDB version?
>>
>> I am not too good with windows.I downloaded PostgreSQL 9.1 for windows
>> from PostgreSQL website.
>>
>> What should I be doing?
>
> I have never tried cross compiling PostgreSQL for Windows, and I
> don't know if it works.  If you have a Windows machine, do it there,
> if not, forget it since you cannot even test your binaries :^)
>
> You can either use PGXS with MinGW, which should work just like
> building on UNIX, or use Microsoft Visual C++ / Windows SDK.
>
> If you use EnterpriseDB's binary downloads, which are built
> with MSVC, you'll have to compile your extension "by hand".
>
> I have read a report that extensions built with MinGW are
> compatible with EDB's binaries if you use --disable-float8-byval
> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
> apper-odbc_fdw-on-windows.html).
>
> Yours,
> Laurenz Albe

Laurenz,

How do I use PGXS with MinGW)?

Atri


-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
"Albe Laurenz"
Date:
Atri Sharma wrote:
> How do I use PGXS with MinGW)?

Just as described in
http://www.postgresql.org/docs/9.1/static/extend-pgxs.html

Build PostgreSQL with MinGW
(./configure && make && make install)
and use a Makefile as shown in the documentation.

Yours,
Laurenz Albe


Re: Regarding installation of FDW on Windows

From
Andrew Dunstan
Date:
On 07/13/2012 08:07 AM, Albe Laurenz wrote:
> I have read a report that extensions built with MinGW are compatible 
> with EDB's binaries if you use --disable-float8-byval 
> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr 
> apper-odbc_fdw-on-windows.html).


Unfortunately, not always.

I had to change how file_fixed_length_record_fdw did its IO before this 
would work.

cheers

andrew




Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 6:13 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>
> On 07/13/2012 08:07 AM, Albe Laurenz wrote:
>>
>> I have read a report that extensions built with MinGW are compatible with
>> EDB's binaries if you use --disable-float8-byval
>> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
>> apper-odbc_fdw-on-windows.html).
>
>
>
> Unfortunately, not always.
>
> I had to change how file_fixed_length_record_fdw did its IO before this
> would work.
>
> cheers
>
> andrew
>
>

Andrew,

I am trying to make pre compiled binaries so that,in case users of my
project(on windows) do not have a build environment configured,they
can use the pre compiled binaries to use my project.The best way to do
this seems to be cross compile.

I tried overriding CC in makefile of my project and setting the value
of CC to MinGW C compiler,but,it gave errors(header files not found).

What changes should I make?

Atri

-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
Andrew Dunstan
Date:
On 07/13/2012 08:57 AM, Atri Sharma wrote:
> On Fri, Jul 13, 2012 at 6:13 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>> On 07/13/2012 08:07 AM, Albe Laurenz wrote:
>>> I have read a report that extensions built with MinGW are compatible with
>>> EDB's binaries if you use --disable-float8-byval
>>> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
>>> apper-odbc_fdw-on-windows.html).
>>
>>
>> Unfortunately, not always.
>>
>> I had to change how file_fixed_length_record_fdw did its IO before this
>> would work.
>>
>> cheers
>>
>> andrew
>>
>>
> Andrew,
>
> I am trying to make pre compiled binaries so that,in case users of my
> project(on windows) do not have a build environment configured,they
> can use the pre compiled binaries to use my project.The best way to do
> this seems to be cross compile.
>
> I tried overriding CC in makefile of my project and setting the value
> of CC to MinGW C compiler,but,it gave errors(header files not found).
>
> What changes should I make?
>


Don't cross-compile. Build on Windows.

cheers

andrew





Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 6:40 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>
> On 07/13/2012 08:57 AM, Atri Sharma wrote:
>>
>> On Fri, Jul 13, 2012 at 6:13 PM, Andrew Dunstan <andrew@dunslane.net>
>> wrote:
>>>
>>> On 07/13/2012 08:07 AM, Albe Laurenz wrote:
>>>>
>>>> I have read a report that extensions built with MinGW are compatible
>>>> with
>>>> EDB's binaries if you use --disable-float8-byval
>>>> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
>>>> apper-odbc_fdw-on-windows.html).
>>>
>>>
>>>
>>> Unfortunately, not always.
>>>
>>> I had to change how file_fixed_length_record_fdw did its IO before this
>>> would work.
>>>
>>> cheers
>>>
>>> andrew
>>>
>>>
>> Andrew,
>>
>> I am trying to make pre compiled binaries so that,in case users of my
>> project(on windows) do not have a build environment configured,they
>> can use the pre compiled binaries to use my project.The best way to do
>> this seems to be cross compile.
>>
>> I tried overriding CC in makefile of my project and setting the value
>> of CC to MinGW C compiler,but,it gave errors(header files not found).
>>
>> What changes should I make?
>>
>
>
> Don't cross-compile. Build on Windows.
>
> cheers
>
> andrew
>
>
>

So,I should set up the build environment on windows and then install my FDW?

Atri

-- 
Regards,

Atri
l'apprenant


Re: Regarding installation of FDW on Windows

From
Andrew Dunstan
Date:
On 07/13/2012 09:12 AM, Atri Sharma wrote:
> On Fri, Jul 13, 2012 at 6:40 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>> On 07/13/2012 08:57 AM, Atri Sharma wrote:
>>> On Fri, Jul 13, 2012 at 6:13 PM, Andrew Dunstan <andrew@dunslane.net>
>>> wrote:
>>>> On 07/13/2012 08:07 AM, Albe Laurenz wrote:
>>>>> I have read a report that extensions built with MinGW are compatible
>>>>> with
>>>>> EDB's binaries if you use --disable-float8-byval
>>>>> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
>>>>> apper-odbc_fdw-on-windows.html).
>>>>
>>>>
>>>> Unfortunately, not always.
>>>>
>>>> I had to change how file_fixed_length_record_fdw did its IO before this
>>>> would work.
>>>>
>>>> cheers
>>>>
>>>> andrew
>>>>
>>>>
>>> Andrew,
>>>
>>> I am trying to make pre compiled binaries so that,in case users of my
>>> project(on windows) do not have a build environment configured,they
>>> can use the pre compiled binaries to use my project.The best way to do
>>> this seems to be cross compile.
>>>
>>> I tried overriding CC in makefile of my project and setting the value
>>> of CC to MinGW C compiler,but,it gave errors(header files not found).
>>>
>>> What changes should I make?
>>>
>>
>> Don't cross-compile. Build on Windows.
>>
>> cheers
>>
>> andrew
>>
>>
>>
> So,I should set up the build environment on windows and then install my FDW?
>


Yes.


cheers

andrew



Re: Regarding installation of FDW on Windows

From
Atri Sharma
Date:
On Fri, Jul 13, 2012 at 7:03 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>
> On 07/13/2012 09:12 AM, Atri Sharma wrote:
>>
>> On Fri, Jul 13, 2012 at 6:40 PM, Andrew Dunstan <andrew@dunslane.net>
>> wrote:
>>>
>>> On 07/13/2012 08:57 AM, Atri Sharma wrote:
>>>>
>>>> On Fri, Jul 13, 2012 at 6:13 PM, Andrew Dunstan <andrew@dunslane.net>
>>>> wrote:
>>>>>
>>>>> On 07/13/2012 08:07 AM, Albe Laurenz wrote:
>>>>>>
>>>>>> I have read a report that extensions built with MinGW are compatible
>>>>>> with
>>>>>> EDB's binaries if you use --disable-float8-byval
>>>>>>
>>>>>> (http://www.postgresonline.com/journal/archives/246-ODBC-Foreign-Data-wr
>>>>>> apper-odbc_fdw-on-windows.html).
>>>>>
>>>>>
>>>>>
>>>>> Unfortunately, not always.
>>>>>
>>>>> I had to change how file_fixed_length_record_fdw did its IO before this
>>>>> would work.
>>>>>
>>>>> cheers
>>>>>
>>>>> andrew
>>>>>
>>>>>
>>>> Andrew,
>>>>
>>>> I am trying to make pre compiled binaries so that,in case users of my
>>>> project(on windows) do not have a build environment configured,they
>>>> can use the pre compiled binaries to use my project.The best way to do
>>>> this seems to be cross compile.
>>>>
>>>> I tried overriding CC in makefile of my project and setting the value
>>>> of CC to MinGW C compiler,but,it gave errors(header files not found).
>>>>
>>>> What changes should I make?
>>>>
>>>
>>> Don't cross-compile. Build on Windows.
>>>
>>> cheers
>>>
>>> andrew
>>>
>>>
>>>
>> So,I should set up the build environment on windows and then install my
>> FDW?
>>
>
>
> Yes.
>
>
> cheers
>
> andrew
>

Thanks Andrew!


-- 
Regards,

Atri
l'apprenant