microsoft / vcpkg

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

[fmt] build failure while cygwin is installed and having a PATH variable to it #9109

Open toboRlivE opened 4 years ago

toboRlivE commented 4 years ago

Host Environment

To Reproduce Steps to reproduce the behavior: .\vcpkg.exe install fmt

Failure logs PS C:\dev\tools\vcpkg> .\vcpkg.exe install fmt The following packages will be built and installed: fmt[core]:x86-windows Starting package 1/1: fmt:x86-windows Building package fmt[core]:x86-windows... -- Downloading https://github.com/fmtlib/fmt/archive/6.0.0.tar.gz... CMake Error at C:/dev/tools/vcpkg/scripts/cmake/vcpkg_download_distfile.cmake:185 (file): file RENAME failed to rename

/cygdrive/c/dev/tools/vcpkg/C:/dev/tools/vcpkg/downloads/temp/fmtlib-fmt-6.0.0.tar.gz

to

/cygdrive/c/dev/tools/vcpkg/C:/dev/tools/vcpkg/downloads/fmtlib-fmt-6.0.0.tar.gz

because: No such file or directory

Call Stack (most recent call first): C:/dev/tools/vcpkg/scripts/cmake/vcpkg_from_github.cmake:132 (vcpkg_download_distfile) C:/dev/tools/vcpkg/ports/fmt/portfile.cmake:2 (vcpkg_from_github) C:/dev/tools/vcpkg/scripts/ports.cmake:94 (include)

Error: Building package fmt:x86-windows failed with: BUILD_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: fmt:x86-windows Vcpkg version: 2019.09.12-nohash

Additionally, attach any relevant sections from the log files above. PS C:\dev\tools\vcpkg> .\vcpkg update Using local portfile versions. To update the local portfiles, use git pull. No packages need updating.

Additional context PS was run as admin, 98GBs free on C:\, I'll stand by for any requests for info.

toboRlivE commented 4 years ago

x86-windows.vcpkg_abi_info.txt was created in a "C:\dev\tools\vcpkg\buildtrees\fmt" directory

Content of the file: CONTROL 9cebf357c183e641caa402126ebc6d6688d1a771 portfile.cmake b2434022329236462cc9304b9e3c3a19ef69faa8 cmake 3.14.5 powershell ab1effc926b000a6adc12198a1886514ec203621a53b0cd7ec1cd9a8225dccda7e857feaabcfba4004bea73129b986abaad777c4573f44e0af70411226ce08b0 vcpkg_fixup_cmake_targets 0ddb96472da00d45d10e0b0bf037bfb744164d0a triplet e8dc96fd479b53bb0e6748625827c8268017e35a features core

toboRlivE commented 4 years ago

Looks like the cygdrive created a wierd directory for C:

`PS C:\dev\tools\vcpkg> ls

Directory: C:\dev\tools\vcpkg

Mode LastWriteTime Length Name


d----- 11/27/2019 3:01 AM .github d----- 11/27/2019 3:06 AM buildtrees d----- 11/27/2019 3:06 AM C d----- 11/27/2019 3:01 AM docs d----- 11/27/2019 3:06 AM downloads d----- 11/27/2019 3:06 AM installed d----- 11/27/2019 3:06 AM packages d----- 11/27/2019 3:01 AM ports d----- 11/27/2019 3:03 AM scripts d----- 11/27/2019 3:03 AM toolsrc d----- 11/27/2019 3:01 AM triplets -a---- 11/27/2019 3:01 AM 8 .gitattributes -a---- 11/27/2019 3:01 AM 5625 .gitignore -a---- 11/27/2019 3:01 AM 0 .vcpkg-root -a---- 11/27/2019 3:01 AM 100 bootstrap-vcpkg.bat -a---- 11/27/2019 3:01 AM 109 bootstrap-vcpkg.sh -a---- 11/27/2019 3:01 AM 368962 CHANGELOG.md -a---- 11/27/2019 3:01 AM 2432 CONTRIBUTING.md -a---- 11/27/2019 3:01 AM 1096 LICENSE.txt -a---- 11/27/2019 3:01 AM 2334 NOTICE.txt -a---- 11/27/2019 3:01 AM 4345 README.md -a---- 11/27/2019 3:01 AM 3282 README_zh_CN.md -a---- 11/27/2019 3:03 AM 1014272 vcpkg.exe`

toboRlivE commented 4 years ago

The same thing just occurred for me while installing SDL2

toboRlivE commented 4 years ago

OK, I already have an install of cygwin on my computer. I renamed the "c:\cygwin64" directory (which "C:\cygwin64\bin" is in my PATH env) to "c:\cygwin64BAK" and all the packages install.

I don't know if it's because of cygwin being there, git, or the CMake in that install conflicting, but it looks like it has something to do with that. Should be enough for you guys to reproduce the issue.

AlvinZhangH commented 4 years ago

Duplicated to #3205, #5856.

toboRlivE commented 4 years ago

I don't know if you'd like me to edit the title of this issue, there is no problem installing fmt. My problem appears to be installing any package via vcpkg while cygwin is installed and having a PATH variable to it.

toboRlivE commented 4 years ago

Also, I am not behind a proxy... Just FYI for setting up an environment to replicate.

AlvinZhangH commented 4 years ago

Hi, @toboRlivE You can use Visual Studio 2019, not cygwin, link https://visualstudio.microsoft.com/zh-hans/vs/?rr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DSVTex4JDby4HUtB3gxXDHqArrMBZVveLt-rW0hhxWp2B6Yr7zThG_Oyd8vLX72rg%26wd%3D%26eqid%3De1838db7000095d9000000065de47f03 Community 2019 is free. Professionnal 2019 and Enterprise 2019 need to pay.

Install any package, see https://devblogs.microsoft.com/cppblog/vcpkg-introducing-export-command/

toboRlivE commented 4 years ago

Thanks, I am using VS2019 already. I just have an install of cygwin on my computer previously, and when I installed and started using vcpkg, I came across that issue. I read through a few of the issues that seem to have the same symptoms, so I added as much detail as I could so you could replicate the problem.

toboRlivE commented 4 years ago

I don't think this is a port bug, I'm pretty sure it has to do with vcpkg internals conflicting with cygwin being in my PATH env. Just wanted to leave a reminder that if I mangle the path to my cygwin install, or remove the PATH variable, vcpkg installs packages with no problem. I don't know how to change the tag on this issue. Would you like me to change the Label or Title of the issue?

PhoebeHui commented 4 years ago

@toboRlivE, thanks for reporting this issue and providing us details about this issue! We will try to repro it.

PhoebeHui commented 4 years ago

Confirmed, this issue caused by using cmake under cygwin.

Repro steps:

  1. git clone https://github.com/microsoft/vcpkg
  2. ./bootstrap-vcpkg.bat
  3. Installed cygwin(select cmake)
  4. Add C:\cygwin64\bin to PATH
  5. ./vcpkg install fmt

VCPKG try to find cmake that installed by system first, if it doesn't exist, it will download a new one. If it exist, then it will use that one. Using cmake under cygwin looks has some issues here.

Cheney-W commented 3 years ago

This issue current disappears in the latest vcpkg(2021-08-03-1a6d67b8150e94b7f473c6ab1c0cfd), it's due to the camke version used in vcpkg(3.20.2) is large than the version of cygwin(3.20.0), If set the cmake version used by vcpkg to 3.20.0, this issue will appear again.

dg0yt commented 3 years ago

Oh, I should record this issue number, given the many duplicate issues. The cygwin cmake needs to be recognized. IIRC one indicator is the list of generators. @Cheney-W can you share the output of cmake -G for cygwin's cmake?

Cheney-W commented 3 years ago

C:\cygwin64\bin>cmake.exe -G CMake Error: No generator specified for -G

Generators
* Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Ninja Multi-Config           = Generates build-<Config>.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
dg0yt commented 3 years ago

Thanks! This confirms that there are no Windows generators (not even MinGW). IIRC this identical with the cmake in the msys subsystem of MSYS2. I will verify this later, on a Windows machine.