Обсуждение: [GENERAL] Compatibility of libpg

Поиск
Список
Период
Сортировка

[GENERAL] Compatibility of libpg

От
Igor Korot
Дата:
Hi,
I just downloaded a latest (9.6.2) version of libpg.

I am wondering - what is the lowest version of PostgreSQL it will be able
to connect?

Also - I want to create a project inside my MSVC 2010 solution and compile.
Is there anything I need besides src/include and src/interface/libpg?

Thank you.


Re: [GENERAL] Compatibility of libpg

От
John R Pierce
Дата:
On 5/1/2017 3:08 PM, Igor Korot wrote:
> Also - I want to create a project inside my MSVC 2010 solution and compile.
> Is there anything I need besides src/include and src/interface/libpg?

if you're using .NET stuff like adodb or oledb, you'll want the npgsql
.net stuff for postgres.

if you're directly calling libpq functions,  libpq.dll and libpq-fe.h
should be all you need, along with the couple .h files libpq-fe
references, afaik, thats just pg_config_ext.h and postgres_ext.h


--
john r pierce, recycling bits in santa cruz



Re: [GENERAL] Compatibility of libpg

От
Igor Korot
Дата:
Hi, Jihn,

On Mon, May 1, 2017 at 6:33 PM, John R Pierce <pierce@hogranch.com> wrote:
> On 5/1/2017 3:08 PM, Igor Korot wrote:
>>
>> Also - I want to create a project inside my MSVC 2010 solution and
>> compile.
>> Is there anything I need besides src/include and src/interface/libpg?
>
>
> if you're using .NET stuff like adodb or oledb, you'll want the npgsql .net
> stuff for postgres.
>
> if you're directly calling libpq functions,  libpq.dll and libpq-fe.h should
> be all you need, along with the couple .h files libpq-fe references, afaik,
> thats just pg_config_ext.h and postgres_ext.h

Like I said, I don't have dll, I downloaded a source files and would
like to compile
the code myself from the MSVC.

And I will use libpg calls directly.

Thank you.

>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Compatibility of libpg

От
John R Pierce
Дата:
On 5/1/2017 4:28 PM, Igor Korot wrote:
> Like I said, I don't have dll, I downloaded a source files and would
> like to compile
> the code myself from the MSVC.
>
> And I will use libpg calls directly.

build the  postgres server, and it will generate the DLL, then link to
that with your own apps.

static linking to runtime libraries like this is strongly discouraged.


--
john r pierce, recycling bits in santa cruz



Re: [GENERAL] Compatibility of libpg

От
Igor Korot
Дата:
Hi, John,



On May 1, 2017 8:00 PM, "John R Pierce" <pierce@hogranch.com> wrote:
On 5/1/2017 4:28 PM, Igor Korot wrote:
Like I said, I don't have dll, I downloaded a source files and would
like to compile
the code myself from the MSVC.

And I will use libpg calls directly.

build the  postgres server, and it will generate the DLL, then link to that with your own apps.

Trouble is - I don't need the server,  client only.

Server is already built.



static linking to runtime libraries like this is strongly discouraged.

Yes, dynamic linking is planned.

But I want to build from MSVC. I already have a solution for it. All I need is to create a project inside that solution which will build the dll and lib files for me.

Or I have to use nmake?

Thank you.




--
john r pierce, recycling bits in santa cruz



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Compatibility of libpg

От
John R Pierce
Дата:
On 5/1/2017 5:44 PM, Igor Korot wrote:
>
> But I want to build from MSVC. I already have a solution for it. All I
> need is to create a project inside that solution which will build the
> dll and lib files for me.
>
> Or I have to use nmake?

pretty sure you need to run the top level config script to generate all
the right stuff, then you probably can have MSVC run the makefile in the
libpq directory.   I find it easier to just build the whole server, then
just use the libpq.dll rather than trying to build pieces seperately, as
it really doesn't take very long.   i believe there are notes on
building with MSVC on Windows,
https://www.postgresql.org/docs/current/static/install-windows-full.html
...   I see there are instructions for building libpq only,
https://www.postgresql.org/docs/current/static/install-windows-libpq.html
but I believe you still need most of the prerequisites as outlined in
17.1.1 ...   17.1.3 discusses a mkvcbuild.pl which makes a pgsql.sln
project(?) for Visual Studio




--
john r pierce, recycling bits in santa cruz



Re: [GENERAL] Compatibility of libpg

От
Igor Korot
Дата:
John,

On Mon, May 1, 2017 at 9:38 PM, John R Pierce <pierce@hogranch.com> wrote:
> On 5/1/2017 5:44 PM, Igor Korot wrote:
>>
>>
>> But I want to build from MSVC. I already have a solution for it. All I
>> need is to create a project inside that solution which will build the dll
>> and lib files for me.
>>
>> Or I have to use nmake?
>
>
> pretty sure you need to run the top level config script to generate all the
> right stuff, then you probably can have MSVC run the makefile in the libpq
> directory.   I find it easier to just build the whole server, then just use
> the libpq.dll rather than trying to build pieces seperately, as it really
> doesn't take very long.   i believe there are notes on building with MSVC on
> Windows,
> https://www.postgresql.org/docs/current/static/install-windows-full.html ...
> I see there are instructions for building libpq only,
> https://www.postgresql.org/docs/current/static/install-windows-libpq.html
> but I believe you still need most of the prerequisites as outlined in 17.1.1
> ...   17.1.3 discusses a mkvcbuild.pl which makes a pgsql.sln project(?) for
> Visual Studio

Ok, I tried to build with nmake as suggested by the official documentation.

Two issues:
1. On the build window I got:

[quote]
        link.exe -lib @C:\Users\Igor\AppData\Local\Temp\nm4696.tmp
        rc.exe /l 0x409 /fo".\Release\libpq.res" libpq-dist.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation.  All rights reserved.

        link.exe @C:\Users\Igor\AppData\Local\Temp\nm48F9.tmp
   Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp
        mt -manifest .\Release\libpq.dll.manifest -outputresource:.\Release\libp
q.dll;2
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

.\Release\libpq.dll.manifest : general error c1010070: Failed to load and parse
the manifest. The system cannot find the file specified.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
\bin\mt.EXE"' : return code '0x1f'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
[/quote]

2. Nevertheless, I did get the libpg.{dll,lib} files.
However, it looks like they are Release mode.

Is there a way to build a Debug version of the libraries?
I'm building my app in Debug mode right now and prefer not to mix the libraries.
Especially since I know Debug and Release version with MSVC link to a
different run-time.

Thank you.


>
>
>
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Compatibility of libpg

От
Magnus Hagander
Дата:
On Tue, May 2, 2017 at 4:49 AM, Igor Korot <ikorot01@gmail.com> wrote:
John,

On Mon, May 1, 2017 at 9:38 PM, John R Pierce <pierce@hogranch.com> wrote:
> On 5/1/2017 5:44 PM, Igor Korot wrote:
>>
>>
>> But I want to build from MSVC. I already have a solution for it. All I
>> need is to create a project inside that solution which will build the dll
>> and lib files for me.
>>
>> Or I have to use nmake?
>
>
> pretty sure you need to run the top level config script to generate all the
> right stuff, then you probably can have MSVC run the makefile in the libpq
> directory.   I find it easier to just build the whole server, then just use
> the libpq.dll rather than trying to build pieces seperately, as it really
> doesn't take very long.   i believe there are notes on building with MSVC on
> Windows,
> https://www.postgresql.org/docs/current/static/install-windows-full.html ...
> I see there are instructions for building libpq only,
> https://www.postgresql.org/docs/current/static/install-windows-libpq.html
> but I believe you still need most of the prerequisites as outlined in 17.1.1
> ...   17.1.3 discusses a mkvcbuild.pl which makes a pgsql.sln project(?) for
> Visual Studio

Ok, I tried to build with nmake as suggested by the official documentation.

Two issues:
1. On the build window I got:

[quote]
        link.exe -lib @C:\Users\Igor\AppData\Local\Temp\nm4696.tmp
        rc.exe /l 0x409 /fo".\Release\libpq.res" libpq-dist.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation.  All rights reserved.

        link.exe @C:\Users\Igor\AppData\Local\Temp\nm48F9.tmp
   Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp
        mt -manifest .\Release\libpq.dll.manifest -outputresource:.\Release\libp
q.dll;2
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

.\Release\libpq.dll.manifest : general error c1010070: Failed to load and parse
the manifest. The system cannot find the file specified.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
\bin\mt.EXE"' : return code '0x1f'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
[/quote]

2. Nevertheless, I did get the libpg.{dll,lib} files.
However, it looks like they are Release mode.

Yes, this is a known issue.

Please note that this method of building libpq has been removed from Postgres 10, so it's considered to be deprecated for quite some time.

 
Is there a way to build a Debug version of the libraries?
I'm building my app in Debug mode right now and prefer not to mix the libraries.
Especially since I know Debug and Release version with MSVC link to a
different run-time.

Yes, using the MSVC build system in src/tools/msvc. See section 17.1.3 on https://www.postgresql.org/docs/current/static/install-windows-full.html 

(You should be able to build "libpq" as the project - I haven't tested it, but I'm pretty sure that should work)

--

Re: [GENERAL] Compatibility of libpg

От
John R Pierce
Дата:
On 5/3/2017 2:20 PM, Magnus Hagander wrote:
>
> Please note that this method of building libpq has been removed from
> Postgres 10, so it's considered to be deprecated for quite some time.
>

this page
https://www.postgresql.org/docs/current/static/install-windows-libpq.html
probably should be updated then.



--
john r pierce, recycling bits in santa cruz



Re: [GENERAL] Compatibility of libpg

От
Igor Korot
Дата:
Hi, Magnus,

On Wed, May 3, 2017 at 5:20 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Tue, May 2, 2017 at 4:49 AM, Igor Korot <ikorot01@gmail.com> wrote:
>>
>> John,
>>
>> On Mon, May 1, 2017 at 9:38 PM, John R Pierce <pierce@hogranch.com> wrote:
>> > On 5/1/2017 5:44 PM, Igor Korot wrote:
>> >>
>> >>
>> >> But I want to build from MSVC. I already have a solution for it. All I
>> >> need is to create a project inside that solution which will build the
>> >> dll
>> >> and lib files for me.
>> >>
>> >> Or I have to use nmake?
>> >
>> >
>> > pretty sure you need to run the top level config script to generate all
>> > the
>> > right stuff, then you probably can have MSVC run the makefile in the
>> > libpq
>> > directory.   I find it easier to just build the whole server, then just
>> > use
>> > the libpq.dll rather than trying to build pieces seperately, as it
>> > really
>> > doesn't take very long.   i believe there are notes on building with
>> > MSVC on
>> > Windows,
>> > https://www.postgresql.org/docs/current/static/install-windows-full.html
>> > ...
>> > I see there are instructions for building libpq only,
>> >
>> > https://www.postgresql.org/docs/current/static/install-windows-libpq.html
>> > but I believe you still need most of the prerequisites as outlined in
>> > 17.1.1
>> > ...   17.1.3 discusses a mkvcbuild.pl which makes a pgsql.sln project(?)
>> > for
>> > Visual Studio
>>
>> Ok, I tried to build with nmake as suggested by the official
>> documentation.
>>
>> Two issues:
>> 1. On the build window I got:
>>
>> [quote]
>>         link.exe -lib @C:\Users\Igor\AppData\Local\Temp\nm4696.tmp
>>         rc.exe /l 0x409 /fo".\Release\libpq.res" libpq-dist.rc
>> Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
>> Copyright (C) Microsoft Corporation.  All rights reserved.
>>
>>         link.exe @C:\Users\Igor\AppData\Local\Temp\nm48F9.tmp
>>    Creating library .\Release\libpqdll.lib and object
>> .\Release\libpqdll.exp
>>         mt -manifest .\Release\libpq.dll.manifest
>> -outputresource:.\Release\libp
>> q.dll;2
>> Microsoft (R) Manifest Tool version 5.2.3790.2076
>> Copyright (c) Microsoft Corporation 2005.
>> All rights reserved.
>>
>> .\Release\libpq.dll.manifest : general error c1010070: Failed to load and
>> parse
>> the manifest. The system cannot find the file specified.
>> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft
>> SDKs\Windows\v7.0A
>> \bin\mt.EXE"' : return code '0x1f'
>> Stop.
>> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
>> Studio 10.0
>> \VC\BIN\nmake.EXE"' : return code '0x2'
>> Stop.
>> [/quote]
>>
>> 2. Nevertheless, I did get the libpg.{dll,lib} files.
>> However, it looks like they are Release mode.
>
>
> Yes, this is a known issue.

Does this mean it will be fixed in the next release?

>
> Please note that this method of building libpq has been removed from
> Postgres 10, so it's considered to be deprecated for quite some time.
>
>
>>
>> Is there a way to build a Debug version of the libraries?
>> I'm building my app in Debug mode right now and prefer not to mix the
>> libraries.
>> Especially since I know Debug and Release version with MSVC link to a
>> different run-time.
>
>
> Yes, using the MSVC build system in src/tools/msvc. See section 17.1.3 on
> https://www.postgresql.org/docs/current/static/install-windows-full.html
>
> (You should be able to build "libpq" as the project - I haven't tested it,
> but I'm pretty sure that should work)

I will need to install ActivePerl? ;-)
Why not generate the solution and supply them with the source?

No, for now I will live with the one I built without manifest file and
supplying DEBUG=1.

Thank you.

>
> --
>  Magnus Hagander
>  Me: https://www.hagander.net/
>  Work: https://www.redpill-linpro.com/


Re: [GENERAL] Compatibility of libpg

От
Magnus Hagander
Дата:
On Wed, May 3, 2017 at 11:31 PM, John R Pierce <pierce@hogranch.com> wrote:
On 5/3/2017 2:20 PM, Magnus Hagander wrote:

Please note that this method of building libpq has been removed from Postgres 10, so it's considered to be deprecated for quite some time.


this page https://www.postgresql.org/docs/current/static/install-windows-libpq.html probably should be updated then.


That page is completely gone in version 10. If you look at https://www.postgresql.org/docs/devel/static/install-windows.html you will notice the entire 17.2 section has been removed, as well as the text on the root page referring to it.

--

Re: [GENERAL] Compatibility of libpg

От
Magnus Hagander
Дата:
On Thu, May 4, 2017 at 12:06 AM, Igor Korot <ikorot01@gmail.com> wrote:

On Wed, May 3, 2017 at 5:20 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Tue, May 2, 2017 at 4:49 AM, Igor Korot <ikorot01@gmail.com> wrote:
>>
>> John,
>>
>> On Mon, May 1, 2017 at 9:38 PM, John R Pierce <pierce@hogranch.com> wrote:
>> > On 5/1/2017 5:44 PM, Igor Korot wrote:
>> >>
>> >>
>> >> But I want to build from MSVC. I already have a solution for it. All I
>> >> need is to create a project inside that solution which will build the
>> >> dll
>> >> and lib files for me.
>> >>
>> >> Or I have to use nmake?
>> >
>> >
>> > pretty sure you need to run the top level config script to generate all
>> > the
>> > right stuff, then you probably can have MSVC run the makefile in the
>> > libpq
>> > directory.   I find it easier to just build the whole server, then just
>> > use
>> > the libpq.dll rather than trying to build pieces seperately, as it
>> > really
>> > doesn't take very long.   i believe there are notes on building with
>> > MSVC on
>> > Windows,
>> > https://www.postgresql.org/docs/current/static/install-windows-full.html
>> > ...
>> > I see there are instructions for building libpq only,
>> >
>> > https://www.postgresql.org/docs/current/static/install-windows-libpq.html
>> > but I believe you still need most of the prerequisites as outlined in
>> > 17.1.1
>> > ...   17.1.3 discusses a mkvcbuild.pl which makes a pgsql.sln project(?)
>> > for
>> > Visual Studio
>>
>> Ok, I tried to build with nmake as suggested by the official
>> documentation.
>>
>> Two issues:
>> 1. On the build window I got:
>>
>> [quote]
>>         link.exe -lib @C:\Users\Igor\AppData\Local\Temp\nm4696.tmp
>>         rc.exe /l 0x409 /fo".\Release\libpq.res" libpq-dist.rc
>> Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
>> Copyright (C) Microsoft Corporation.  All rights reserved.
>>
>>         link.exe @C:\Users\Igor\AppData\Local\Temp\nm48F9.tmp
>>    Creating library .\Release\libpqdll.lib and object
>> .\Release\libpqdll.exp
>>         mt -manifest .\Release\libpq.dll.manifest
>> -outputresource:.\Release\libp
>> q.dll;2
>> Microsoft (R) Manifest Tool version 5.2.3790.2076
>> Copyright (c) Microsoft Corporation 2005.
>> All rights reserved.
>>
>> .\Release\libpq.dll.manifest : general error c1010070: Failed to load and
>> parse
>> the manifest. The system cannot find the file specified.
>> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft
>> SDKs\Windows\v7.0A
>> \bin\mt.EXE"' : return code '0x1f'
>> Stop.
>> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
>> Studio 10.0
>> \VC\BIN\nmake.EXE"' : return code '0x2'
>> Stop.
>> [/quote]
>>
>> 2. Nevertheless, I did get the libpg.{dll,lib} files.
>> However, it looks like they are Release mode.
>
>
> Yes, this is a known issue.

Does this mean it will be fixed in the next release?

No. It will be removed in the next major release (postgres 10).

It could be fixed in a minor release, but nobody has shown interest in providing a proper fix for years for it. But if you want to contribute a fix for it, we could certainly apply it to existing releases, but given that the method will be gone in version 10 it's doubtful if it's worth it.

 
> Please note that this method of building libpq has been removed from
> Postgres 10, so it's considered to be deprecated for quite some time.
>
>
>>
>> Is there a way to build a Debug version of the libraries?
>> I'm building my app in Debug mode right now and prefer not to mix the
>> libraries.
>> Especially since I know Debug and Release version with MSVC link to a
>> different run-time.
>
>
> Yes, using the MSVC build system in src/tools/msvc. See section 17.1.3 on
> https://www.postgresql.org/docs/current/static/install-windows-full.html
>
> (You should be able to build "libpq" as the project - I haven't tested it,
> but I'm pretty sure that should work)

I will need to install ActivePerl? ;-)

You will need some level of perl - I believe it works with the upstream perl as well.


Why not generate the solution and supply them with the source?

Because it has to be maintained by people who do not have Visual Studio, or even Windows. We need it to be auto-generated from the core build system if there is going to be any chance for it to stay up to date.

-- 

Re: [GENERAL] Compatibility of libpg

От
John R Pierce
Дата:
On 5/4/2017 2:19 AM, Magnus Hagander wrote:
On Wed, May 3, 2017 at 11:31 PM, John R Pierce <pierce@hogranch.com> wrote:
On 5/3/2017 2:20 PM, Magnus Hagander wrote:

Please note that this method of building libpq has been removed from Postgres 10, so it's considered to be deprecated for quite some time.


this page https://www.postgresql.org/docs/current/static/install-windows-libpq.html probably should be updated then.


That page is completely gone in version 10. If you look at https://www.postgresql.org/docs/devel/static/install-windows.html you will notice the entire 17.2 section has been removed, as well as the text on the root page referring to it.


well, dropped in the latest not-yet-released version doesn't really make it 'deprecated for quite some time'.     if this has been the long term intention, the docs should have reflected this some revisions back.      

I still think the Windows packagers (<cough>EnterpriseDB</cough>) should have a client-only package which has options to just install the libs, or the libs + client utils (psql, pg_dump/restore/dumpall and optionally pg_admin).   I realize that this wouldn't be /that/ much smaller than the whole 9 yards, but its a psychological thing for the end user, they think of the server as 'heavy', also would be good for automated client deployments in business envirnoments.


-- 
john r pierce, recycling bits in santa cruz

Re: [GENERAL] Compatibility of libpg

От
Magnus Hagander
Дата:
On Thu, May 4, 2017 at 7:32 PM, John R Pierce <pierce@hogranch.com> wrote:
On 5/4/2017 2:19 AM, Magnus Hagander wrote:
On Wed, May 3, 2017 at 11:31 PM, John R Pierce <pierce@hogranch.com> wrote:
On 5/3/2017 2:20 PM, Magnus Hagander wrote:

Please note that this method of building libpq has been removed from Postgres 10, so it's considered to be deprecated for quite some time.


this page https://www.postgresql.org/docs/current/static/install-windows-libpq.html probably should be updated then.


That page is completely gone in version 10. If you look at https://www.postgresql.org/docs/devel/static/install-windows.html you will notice the entire 17.2 section has been removed, as well as the text on the root page referring to it.


well, dropped in the latest not-yet-released version doesn't really make it 'deprecated for quite some time'.     if this has been the long term intention, the docs should have reflected this some revisions back.      


True. The fact that the reported issue has been around for a very long time without anybody caring to fix it is though.

 

I still think the Windows packagers (<cough>EnterpriseDB</cough>) should have a client-only package which has options to just install the libs, or the libs + client utils (psql, pg_dump/restore/dumpall and optionally pg_admin).   I realize that this wouldn't be /that/ much smaller than the whole 9 yards, but its a psychological thing for the end user, they think of the server as 'heavy', also would be good for automated client deployments in business envirnoments.



That's a different thing though, and I agree that this would be useful.
 


--