Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download and manage internal copy of MSYS2 for ./configure-only libraries #241

Closed
ras0219-msft opened this issue Nov 2, 2016 · 7 comments
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@ras0219-msft
Copy link
Contributor

Since it's unfortunately common to require autoconf on Windows (ffmpeg, ipopt, ...), we probably need vcpkg to download and manage an internal copy of MSYS2 for just this reason.

It is possible to use MSYS2 without a global install (https://github.com/StephanTLavavej/mingw-distro), but those instructions require user interaction as written. I'm sure we can mimic whatever effects the msys2_shell.bat script is having and internally perform those.

Depending on the size/time cost of this, we may want to allow the user to provide their own MSYS2 (or autodetect a system-installed one).

Needed for: #233 #2

@ras0219-msft ras0219-msft added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Nov 2, 2016
@ras0219-msft ras0219-msft mentioned this issue Nov 2, 2016
@ras0219-msft ras0219-msft added category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed and removed category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist labels Nov 2, 2016
@kryptan
Copy link
Contributor

kryptan commented Nov 4, 2016

MSYS2 relies on its own package manager (pacman) which downloads binary packages. This will make one package manager (vcpkg) to depend on the other.

  1. This has security implications, if MSYS2 binary repository is compromised this will mean that vcpkg is also compromised.
  2. AFAIK pacman always installs the latest version of each package and there is no easy way to install specific version. This interferes with the reproducibility - an update in MSYS2 can potentially break something in vcpkg.

Maybe vcpkg should provide prebuilt versions of each required MSYS2 package and not rely on pacman at all?

Also I'm not sure if autoconf scripts can understand how to use msvc.

Since it's unfortunately common to require autoconf on Windows (ffmpeg, ipopt, ...)

ffmpeg doesn't use autoconf, there is a handwritten configure bash script. Still requires msys though.

@ras0219-msft ras0219-msft changed the title Download and manage internal copy of MSYS2 for autoconf-only libraries Download and manage internal copy of MSYS2 for ./configure-only libraries Nov 4, 2016
@ras0219-msft
Copy link
Contributor Author

ras0219-msft commented Nov 4, 2016

Thanks for bringing up the point about autoconf; I believe all the libraries above use bash ./configure scripts and not the full autotools chain.

  • This would indeed mean a dependence for those particular packages, however only to acquire the buildsystem tools. Once the build is complete, there would be no MSYS2 dependency. Users who don't need those packages would of course not need MSYS2.
  • (1) This is somewhat true for the packages that require MSYS2 dependence. We may be able to mitigate this by downloading and hash-checking the packages from http://repo.msys2.org/msys/x86_64/ directly before installing them with pacman -U.
  • (2) Unfortunately, I don't see a better option here. In combination with the answer to (1), we can give users a way to cache the specific version they used which would help reproducibility, but as long as libraries require MSYS2 as part of their build (and MSYS2 doesn't host packages indefinitely), we will be subject to this issue.

@weltling
Copy link
Member

weltling commented Nov 22, 2016

Just to give an example - MSYS2 doesn't require any user interaction. It is possible to compose a set of required tools, that can be provided. I'm currently working on the PHP Windows build toolkit, where we use many OSS tools like fe. bison, re2c, zip, etc. The actual PHP binaries and dependencies are produced with the conventional Visual Studio by standard. So we don't depend on the MSYS2 libraries for the compilation, but only on the tools, that MSYS2 provides or that are impossible to provide using the Windows toolchain.

What I'm literally doing, is picking the required tools and their dependencies, thus avoiding to have the whole MSYS2 tree, even avoiding to have the whole base tools package. Also, even if the original MSYS2 might not contain some tool - well, you can compile it with the toolchain provided by MSYS2. It'll have then same dependencies as the MSYS2 distribution, so can be shipped with it. Now, as i understand, the tools like autotools, maybe make and some others, are only what is needed for VCPKG as well. Otherwise, it could be done the other way round - take the MSYS2 distribution, but only leave the tools that can be useful and strip others out.

As mentioned, the big pluses of doing it this way are

  • smaller end size
  • control over the exact toolset (fe you don't have to add pacman)
  • no installation is required

Thanks.

@tkelman
Copy link

tkelman commented Dec 21, 2016

Does invoking msvc through a configure script work correctly in msys2? The way I've done that in the past, using the compile wrapper script from automake (roughly ./configure CC="$PWD/compile cl") doesn't work in msys2 last time I checked.

@codicodi
Copy link
Contributor

@tkelman I recently compiled libffi this way, so it's definitely possible. Here (also in comments) are some tips to get it to work.

@tkelman
Copy link

tkelman commented Dec 21, 2016

Don't think that --toolchain is a standard autoconf flag. If a project is using autoconf and automake in the conventional way, then the generated makefiles will try to invoke the compiler with unix cc-style flags that msvc won't handle.

Long term it's probably most worthwhile to translate and contribute cmake ports of various projects' build systems for them to support msvc in a predictable way.

@willyd willyd mentioned this issue Feb 20, 2017
@ras0219-msft
Copy link
Contributor Author

I've added initial support for a minimal internal msys with 2f8d8d8, which also demonstrates using it to build FFMPEG. Please open new issues or pull requests for improvements!

A notable issue at the moment: we do not hash check the msys2 packages. This means they can (and will) update underneath us, which could cause intermittent or unreproducible errors for users. We should try to improve this in the future, such as by individually downloading packages ourselves, checking them, then installing them with pacman -U.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

No branches or pull requests

5 participants