brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

Build error on windows 8.1 #40

Closed devmetal closed 7 years ago

devmetal commented 8 years ago

Hi, i have an issue with this module install. I followed the manual, installed postgresql added to path and i checked the dll and config files.

I use windows 8.1, visual studio 2015 community with the latest npm and node version.

Here is the output of npm install pg-native -g --verbose > output.txt command:


> libpq@1.8.1 install C:\Users\Ádám\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq
> node-gyp rebuild

C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 2016.03.18. 15:39:28.
Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.Net.CoreRuntime.targets (68,11)" does not exist in the project, and will be ignored.
The target "_GeneratePrisForPortableLibraries" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.Net.CoreRuntime.targets (177,11)" does not exist in the project, and will be ignored.
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets (126,11)" does not exist in the project, and will be ignored.
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets (174,11)" does not exist in the project, and will be ignored.
The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (149,61)" does not exist in the project, and will be ignored.
Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (1) is building "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\addon\".
  Creating directory "Release\obj\addon\addon.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\addon\addon.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  E:\Programf�jlok (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.exe /c /I"C:\Users\�d�m\.node-gyp\5.0.0\include\node" /I"C:\Users\�d�m\.node-gyp\5.0.0\src" /I"C:\Users\�d�m\.node-gyp\5.0.0\deps\uv\include" /I"C:\Users\�d�m\.node-gyp\5.0.0\deps\v8\include" /IE:\Program /I..\Files\PostgreSQL\9.3\include /I..\..\nan /Zi /nologo /W3 /WX- /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=addon /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D BUILDING_V8_SHARED=1 /D BUILDING_UV_SHARED=1 /D BUILDING_NODE_EXTENSION /D _WINDLL /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\addon\\" /Fd"Release\obj\addon\vc140.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /errorReport:queue /MP ..\src\connection.cc "..\src\connect-async-worker.cc" ..\src\addon.cc
  connection.cc
  connect-async-worker.cc
  addon.cc
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connect-async-worker.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connection.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
Done Building Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (default target) (1) ->
"C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (default target) (2) ->
(ClCompile target) -> 
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connect-async-worker.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connection.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:02.03
C:\Users\Ádám\AppData\Roaming\npm
`-- (empty)
wingc-china commented 7 years ago

Not sure if you have solved this.

Seems like you are missing the libpq-dev on your Windows. The libpq-dev can be installed directly on Linux as a package. On Windows, I installed libpq-dev equivalent by the vcpkg (https://blogs.msdn.microsoft.com/vcblog/2016/09/19/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows/) like "vcpkg install libpq:x64-windows", and then set PATH to ensure the built pg_config.exe accessible.

Hope it helps.

devmetal commented 7 years ago

You will not belive what was the problem. I have two partitions, C, and D. The C holds the windows and the D is my data, games, programing stuffs. If i installed the postgresql to the D, the thing is not worked, but i tried to install to C, and its worked magically. I don't know what was the real problem. I use linux now, and all package working correctly, but on windows, my experience is something always broken with the npm packages.

So i think we can close this right now, just forgoted to open issue, thank you anyway :)

brianc commented 7 years ago

Glad you got it fixed! And yeah, building native packages on windows is difficult. 😬