microsoft / vcpkg

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

[gmp: x64-windows-static-md] build failure #19650

Closed abortabort closed 2 years ago

abortabort commented 3 years ago

Host Environment

To Reproduce Steps to reproduce the behavior: 'vcpkg install gmp:x64-windows-static-md`

Failure logs

Computing installation plan...
The following packages will be built and installed:
    gmp[core]:x64-windows-static-md -> 6.2.1#6
Detecting compiler hash for triplet x64-windows-static-md...
Could not locate cached archive: C:\Users\86135\AppData\Local\vcpkg\archives\e6\e68c5360c7a77057678f284267168fd4a6122a47fd9783c3381d0abd8c28f264.zip
Starting package 1/1: gmp:x64-windows-static-md
Building package gmp[core]:x64-windows-static-md...
-- Using community triplet x64-windows-static-md. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: D:\work\libs\vcpkg\triplets\community\x64-windows-static-md.cmake
-- Downloading https://github.com.cnpmjs.org/ShiftMediaProject/gmp/archive/0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0.tar.gz -> ShiftMediaProject-gmp-0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0.tar.gz...
-- Cleaning sources at D:/work/libs/vcpkg/buildtrees/gmp/src/19f0b65fd0-9b395bc164.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/work/libs/vcpkg/downloads/ShiftMediaProject-gmp-0018c44e8dfcc3b64b43e0aea4b3f419f0b65fd0.tar.gz
-- Applying patch vs.build.patch
-- Applying patch runtime.patch
-- Applying patch adddef.patch
-- Using source at D:/work/libs/vcpkg/buildtrees/gmp/src/19f0b65fd0-9b395bc164.clean
-- Building SMP/libgmp.sln for Release
-- Building SMP/libgmp.sln for Debug
-- Installing: D:/work/libs/vcpkg/packages/gmp_x64-windows-static-md/share/gmp/copyright
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/i686/mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst -> msys-mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst...
-- Downloading https://repo.msys2.org/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirror.bit.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst;https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/i686/mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst -> msys-mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst...
-- Using msys root at D:/work/libs/vcpkg/downloads/tools/msys2/aa5af7b2aa7e90e8
-- Fixing pkgconfig file: D:/work/libs/vcpkg/packages/gmp_x64-windows-static-md/lib/pkgconfig/gmp.pc
-- Fixing pkgconfig file: D:/work/libs/vcpkg/packages/gmp_x64-windows-static-md/lib/pkgconfig/gmpxx.pc
-- Fixing pkgconfig file: D:/work/libs/vcpkg/packages/gmp_x64-windows-static-md/debug/lib/pkgconfig/gmp.pc
-- Fixing pkgconfig file: D:/work/libs/vcpkg/packages/gmp_x64-windows-static-md/debug/lib/pkgconfig/gmpxx.pc
-- Performing post-build validation
Invalid crt linkage. Expected Debug,Dynamic, but the following libs had:

    D:\work\libs\vcpkg\packages\gmp_x64-windows-static-md\debug/lib\gmpd.lib: Debug,Static

To inspect the lib files, use:
    dumpbin.exe /directives mylibfile.lib
Invalid crt linkage. Expected Release,Dynamic, but the following libs had:

    D:\work\libs\vcpkg\packages\gmp_x64-windows-static-md\lib\gmp.lib: Release,Static

To inspect the lib files, use:
    dumpbin.exe /directives mylibfile.lib
Found 2 error(s). Please correct the portfile:
    D:\work\libs\vcpkg\ports\gmp\portfile.cmake
-- Performing post-build validation done
Error: Building package gmp:x64-windows-static-md failed with: POST_BUILD_CHECKS_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: gmp:x64-windows-static-md
  Vcpkg version: 2021-08-12-85ab112d5ee102bc6eac8cdbbfdd173a71374e04

Additionally, attach any relevant sections from the log files above.
O-Tom commented 3 years ago

Hi,

I stumbled across this issue today as I tried to compile cgal with the same triplet. I modified the ./ports/gmp/portfile.cmake file so that the appropriate runtime library is selected according to the VCPKG_CRT_LINKAGE value (see attached patch file). I saw that there already was a patch to push RuntimeLibrary in the .props file so I guess there is a more elegant way to handle VCPKG_CRT_LINKAGE and VCPKG_LIBRARY_LINKAGE at the same time.

Hope this helps

portfile.cmake.patch.zip

JackBoosY commented 2 years ago

@O-Tom Can you please make a PR to fix that?

Thanks.

JackBoosY commented 2 years ago

This issue hasn’t been updated in 3 month, if it is still an issue, please reopen this issue.