Closed ms-genpub closed 10 months ago
Managed to persuade it to compile by adding
to "zconf.h".
Now why does your build define Z_HAVE_UNISTD_H
? This macro is used to indicate the presence of unistd.h
. Normally this header isn't present in MSVC installations, and obviously it isn't in the include path at them zconf.h
is included.
I'm using vcpkg in classic mode; i.e. not building my own software, just building fltk and mathgl via the command line.
The Z_HAVE_UNISTD_H macro will be defined by cmake if it finds unistd.h somewhere. I assume that is what is occurring, but where on its search path cmake locates the file, I can't tell. There are plenty of copies in the vcpkg buildtrees directory.
The ansatz works, and the issue likely depends on the history of vcpkg operations particular to my installation, so I'm not all that inclined to investigate further.
The Z_HAVE_UNISTD_H macro will be defined by cmake if it finds unistd.h somewhere.
It is fairly controlled. zlib doesn't search so many external directories, in particular not the vcpkg installed tree and not other packages in the buildtrees directory.
I assume that is what is occurring, but where on its search path cmake locates the file, I can't tell. There are plenty of copies in the vcpkg buildtrees directory.
Those copies don't matter to the build and usage of zlib. They are not installed.
We have seen similar issues before. Some remained unclear. Sometimes they could be tracked down to the user copying an arbitrary unistd.h
to the MSVC or SDK dirs (for convenience, or because the web told them so), and later removing them. This is how it breaks dependency tracking.
It is probably possible to harden zlib against this issue, but the same users will probably find and report just other issues from the same trigger.
Operating system
Windows
Compiler
MSVC
Steps to reproduce the behavior
Failure logs
Failure logs
X:\vcpkg\buildtrees\mathgl\install-x64-windows-dbg-out.log
``` Change Dir: 'X:/vcpkg/buildtrees/mathgl/x64-windows-dbg' Run Build Command(s): "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v -v -j5 install [1/65] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\base_cf.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\base_cf.cpp FAILED: src/CMakeFiles/mgl.dir/base_cf.cpp.obj C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\base_cf.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\base_cf.cpp X:\vcpkg\installed\x64-windows\include\zconf.h(495): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [2/65] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\axis.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\axis.cpp FAILED: src/CMakeFiles/mgl.dir/axis.cpp.obj C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\axis.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\axis.cpp X:\vcpkg\installed\x64-windows\include\zconf.h(495): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [3/65] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\canvas_cf.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\canvas_cf.cpp FAILED: src/CMakeFiles/mgl.dir/canvas_cf.cpp.obj C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\canvas_cf.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\canvas_cf.cpp X:\vcpkg\installed\x64-windows\include\zconf.h(495): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [4/65] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\addon.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\addon.cpp FAILED: src/CMakeFiles/mgl.dir/addon.cpp.obj C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\addon.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\addon.cpp X:\vcpkg\installed\x64-windows\include\zconf.h(495): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [5/65] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\base.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\base.cpp FAILED: src/CMakeFiles/mgl.dir/base.cpp.obj C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\cl.exe /TP -DBUILDING_mgl_LIB -DH5_BUILT_AS_DYNAMIC_LIB -DMGL_HAVE_GSL2 -DMGL_LIB_MSVC -DMGL_SRC -DWIN32 -Dmgl_EXPORTS -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\include -IX:\vcpkg\buildtrees\mathgl\x64-windows-dbg\include -IX:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\prc -external:IX:\vcpkg\installed\x64-windows\include -external:W0 /EHsc -DVCPKG_MSVC_WPRINTF /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP -openmp /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -openmp /showIncludes /Fosrc\CMakeFiles\mgl.dir\base.cpp.obj /Fdsrc\CMakeFiles\mgl.dir\ /FS -c X:\vcpkg\buildtrees\mathgl\src\mathgl-8-48d9dbf9d6.clean\src\base.cpp X:\vcpkg\installed\x64-windows\include\zconf.h(495): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory ninja: build stopped: subcommand failed. ```Additional context
The problem is the attempt to include 'unistd.h'.