On Tue, May 2, 2017 at 4:49 AM, Igor Korot <ikoro...@gmail.com> wrote:
> John, > > On Mon, May 1, 2017 at 9:38 PM, John R Pierce <pie...@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) -- Magnus Hagander Me: https://www.hagander.net/ <http://www.hagander.net/> Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>