microsoft / vcpkg

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

vcpkg under mingw #4418

Closed kreuzerkrieg closed 5 years ago

kreuzerkrieg commented 6 years ago

Is it feasible to bootstrap and run vcpkg under msys? I've altered the bootstrap script and some code, to make it work with std::filesystem, now I'm failing because the download.cpp somehow thinks that it should be compiled for windows.

/mingw64/bin/g++.exe -DDISABLE_METRICS=0 -I../include -std=c++1z -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg/base/downloads.cpp.o -c ../src/vcpkg/base/downloads.cpp ../src/vcpkg/base/downloads.cpp: In function 'void vcpkg::Downloads::winhttp_download_file(vcpkg::Files::Filesystem&, vcpkg::CStringView, vcpkg::CStringView, vcpkg::CStringView)': ../src/vcpkg/base/downloads.cpp:38:67: error: 'WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY' was not declared in this scope IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY

is it worth to try and to fix it or this task is too complicated?

ras0219-msft commented 6 years ago

I think this task is likely too complicated.

Note that the vcpkg tool doesn't need to be built with the same compiler as your project or libraries; building it with MSVC won't prevent you from using mingw to build the libraries.

However, we have not looked much into using mingw so far. If you have a functioning CMake toolchain file, you can follow our triplet documentation[1] to create a triplets/x64-windows-mingw.cmake file that will use that toolchain to build libraries.

[1] https://github.com/Microsoft/vcpkg/blob/master/docs/users/triplets.md

kreuzerkrieg commented 6 years ago

Thanks for the response. Triplets sounds like interesting direction which I will explore shortly.

On the other hand. Given following scenario: You have C++ code, Linux specific. Using CMake and vcpkg. I want to compile it on windows, using VS as CMake project, no remote Linux machine is available,

Is there any other option than mingw + vcpkg? I know that even if I can marry cmake with vcpkg it is not ensures I can compile my code, but...

degski commented 6 years ago

@kreuzerkrieg If you are already fluent on Linux, why not use WSL?

kreuzerkrieg commented 6 years ago

hm... Interesting question... for some unknown reason I wasnt considering WSL altogether. WSL + VS linux build on remote "machine"? Is WSL "SSH-able" from the hosting Win machine?

degski commented 6 years ago

@kreuzerkrieg Well, way over my pay-grade, didn't look at it [WSL] that much at all, but from this, it seems network access is totally possible.

kreuzerkrieg commented 6 years ago

Thanks for the idea, will check it too

ras0219-msft commented 5 years ago

We definitely recommend trying out WSL to build binaries for Linux on a Windows machine! :)

liao725636367 commented 5 years ago

If gotk3 can support vcpkg, maybe this problem can be solved.

alcroito commented 4 years ago

I think if https://github.com/microsoft/vcpkg/pull/9137 gets merged, this issues's status could be changed to fixed.

kreuzerkrieg commented 4 years ago

So, is it working now under MinGW?

alcroito commented 4 years ago

If the PR mentioned above gets merged, it should work with mingw NOT under msys. Afaik msys gcc had some issues with std::filesystem, and my colleague failed to build it under msys.