microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.99k stars 6.34k forks source link

mathgl build failure #35563

Closed ms-genpub closed 10 months ago

ms-genpub commented 10 months ago

Operating system

Windows

Compiler

MSVC

Steps to reproduce the behavior

Package: mathgl[arma,core,gif,glut,gsl,hdf5,jpeg,opengl,png,zlib]:x64-windows -> 8.0.1#5

**Host Environment**

- Host: x64-windows
- Compiler: MSVC 19.29.30153.0
-    vcpkg-tool version: 2023-11-16-4c1df40a3c5c5e18de299a99e9accb03c2a82e1e
    vcpkg-scripts version: 45f6e57d3e 2023-12-06 (2 days ago)

**To Reproduce**

`vcpkg install mathgl[arma,gif,glut,gsl,hdf5,jpeg,opengl,png]`

Failure logs

Failure logs

-- Using cached mathgl-8.0.1.tar.gz.
-- Cleaning sources at X:/vcpkg/buildtrees/mathgl/src/mathgl-8-48d9dbf9d6.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source X:/vcpkg/downloads/mathgl-8.0.1.tar.gz
-- Applying patch cmake-config.patch
-- Applying patch dependencies.patch
-- Applying patch linkage.patch
-- Applying patch enable-examples.patch
-- Applying patch fix-examples.patch
-- Applying patch fix-cross-builds.patch
-- Applying patch fix-format-specifiers.patch
-- Applying patch fix-glut.patch
-- Applying patch fix-mgllab.patch
-- Applying patch include_functional.patch
-- Applying patch fix-include-property.patch
-- Applying patch fix_link_gsl.patch
-- Using source at X:/vcpkg/buildtrees/mathgl/src/mathgl-8-48d9dbf9d6.clean
-- Found external ninja('1.10.2').
-- Configuring x64-windows
-- Building x64-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: X:/vcpkg/downloads/tools/cmake-3.27.1-windows/cmake-3.27.1-windows-i386/bin/cmake.exe --build . --config Debug --target install -- -v -j5
    Working Directory: X:/vcpkg/buildtrees/mathgl/x64-windows-dbg
    See logs for more information:
      X:\vcpkg\buildtrees\mathgl\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/mathgl/portfile.cmake:62 (vcpkg_cmake_install)
  scripts/ports.cmake:170 (include)
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'.

ms-genpub commented 10 months ago

Managed to persuade it to compile by adding

if defined(Z_HAVE_UNISTD_H) && defined(_MSC_VER)

undef(Z_HAVE_UNISTD_H)

endif

to "zconf.h".

dg0yt commented 10 months ago

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.

ms-genpub commented 10 months ago

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.

dg0yt commented 10 months ago

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.