Skip to content

编译通过,生成的时候提示“unistd.h“找不到,根据说明文件,删除后报错。 #5

@gxdyxh

Description

@gxdyxh

D:\desktop\node-images-master>node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@10.16.0 | win32 | x64
gyp info find Python using Python version 2.7.17 found at "E:\tool\Python27\python.exe"
gyp info find VS using VS2019 (16.3.29418.71) found at:
gyp info find VS "d:\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn E:\tool\Python27\python.exe
gyp info spawn args [ 'C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'D:\desktop\node-images-master\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\gqz\AppData\Local\node-gyp\Cache\10.16.0\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\gqz\AppData\Local\node-gyp\Cache\10.16.0',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\gqz\\AppData\\Local\\node-gyp\\Cache\\10.16.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\desktop\node-images-master',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\desktop\node-images-master\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info ok

编译通过

D:\desktop\node-images-master>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@10.16.0 | win32 | x64
gyp info spawn d:\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
libpng.vcxproj -> D:\desktop\node-images-master\build\Release\libpng.lib
libjpeg-turbo.vcxproj -> D:\desktop\node-images-master\build\Release\libjpeg-turbo.lib
dgif_lib.c
gif_err.c
D:\desktop\node-images-master\gyp\third-party\giflib\lib\gif_hash.h(10,10): fatal error C1083: 无法打开包括文件: “unistd.h”: No such file or directory (编译源文件 ......\gyp\third-party\giflib\lib\gif_err.c) [D:\desktop\node-images-master\build\gy
p\gyp\giflib.vcxproj]
D:\desktop\node-images-master\gyp\third-party\giflib\lib\dgif_lib.c(15,10): fatal error C1083: 无法打开包括文件: “unistd.h”: No such file or directory [D:\desktop\node-images-master\build\gyp\gyp\giflib.vcxproj]
zlib.vcxproj -> D:\desktop\node-images-master\build\Release\zlib.lib
gyp ERR! build error
gyp ERR! stack Error: d:\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "E:\tool\nodejs\node.exe" "C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "build"
gyp ERR! cwd D:\desktop\node-images-master
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok

build 失败 提示“unistd.h”: No such file or directory

删除后 重新编译 生成

D:\desktop\node-images-master>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@10.16.0 | win32 | x64
gyp info spawn d:\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
libpng.vcxproj -> D:\desktop\node-images-master\build\Release\libpng.lib
libjpeg-turbo.vcxproj -> D:\desktop\node-images-master\build\Release\libjpeg-turbo.lib
dgif_lib.c
gif_err.c
D:\desktop\node-images-master\gyp\third-party\giflib\lib\dgif_lib.c(383,23): warning C4018: “<”: 有符号/无符号不匹配 [D:\desktop\node-images-master\build\gyp\gyp\giflib.vcxproj]
giflib.vcxproj -> D:\desktop\node-images-master\build\Release\giflib.lib
zlib.vcxproj -> D:\desktop\node-images-master\build\Release\zlib.lib
Image.cc
D:\desktop\node-images-master\src\Image.cc(174,17): warning C4101: “status”: 未引用的局部变量 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(365,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(365,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(365,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(392,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(392,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(392,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(437,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(437,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(437,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(480,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(480,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(480,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(521,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(521,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(521,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(591,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(591,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(591,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(644,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(644,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(644,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(684,21): error C2131: 表达式的计算结果不是常数 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(684,21): message : 因读取超过生命周期的变量而失败 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(684,21): message : 请参见“argc”的用法 [D:\desktop\node-images-master\build\binding.vcxproj]
D:\desktop\node-images-master\src\Image.cc(855,9): warning C4146: 一元负运算符应用于无符号类型,结果仍为无符号类型 [D:\desktop\node-images-master\build\binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: d:\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "E:\tool\nodejs\node.exe" "C:\Users\gqz\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "build"
gyp ERR! cwd D:\desktop\node-images-master
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions