简体   繁体   English

如何将msys2安装到基本mingw目录中

[英]how to install msys2 into base mingw directory

I was wondering if there is a way in MSYS2 to specify the base MinGW/MinGW64 directory? 我想知道在MSYS2中是否有一种方法可以指定基本的MinGW / MinGW64目录?

In MSYS (ie, MSYS-1), after installing MSYS, it knows that the directory structure is, eg, /c/mingw/msys/... , and if you install a mingw package using mingw-get , the installed binary goes to /c/mingw/bin . 在MSYS(即MSYS-1)中,安装MSYS后,它知道目录结构为/c/mingw/msys/... ,并且如果使用mingw-get安装mingw软件包, /c/mingw/msys/...安装的二进制文件转到/c/mingw/bin I think this might be because there is /mingw mount in the default /etc/fsab . 我认为这可能是因为默认的/etc/fsab/mingw挂载。

Now, when I do a similar operation under MSYS2/MinGW64 with MSYS2 at /c/mingw/msys64 , the binary isn't installed the /c/mingw/bin anymore. 现在,当我在MSYS2 / MinGW64和MSYS2在/c/mingw/msys64下执行类似操作时,不再安装二进制文件/c/mingw/bin For example, if I install clang as follows: 例如,如果我按如下方式安装clang

pacman -S mingw-w64-x86_64-clang

the binary is installed to: 二进制文件安装到:

/c/mingw/msys64/mingw64/bin/clang.exe

as if MSYS2 were creating another mingw64 installation within itself (with bin/lib/etc/share ...). 就像MSYS2在自己内部创建另一个mingw64安装一样(使用bin / lib / etc / share ...)。 This confuses MinGW64, as it reports that clang cannot be found. 这使MinGW64感到困惑,因为它报告找不到cannot。 I know I can add another path, but it's rather weird to have one MinGW installation at the root, and another inside a subfolder of MSYS2. 我知道我可以添加另一条路径,但是在根目录中有一个MinGW安装,在MSYS2的子文件夹中有另一个安装,这很奇怪。 And I suspect this could cause inconsistency in the tool-chain in the future. 而且我怀疑这将来可能会导致工具链不一致。

My question is, is there a way to let MSYS2 install MinGW packages to the MinGW directory tree as with MSYS ? 我的问题是,有没有办法像MSYS一样让MSYS2将MinGW软件包安装到MinGW目录树中?

Thanks 谢谢

To say that you have "another mingw64 installation within itself" is the wrong way to think about it. 说您“自己内部还有另一个mingw64安装”是对它的错误思考方式。 MSYS2 is the system that is running the show, that you chose to put it in a folder called "C:/mingw" doesn't make that folder a mingw-w64 system in any way, you've just got an MSYS2 system rooted at "C:/mingw/msys64" MSYS2是正在运行节目的系统,您选择将其放置在名为“ C:/ mingw”的文件夹中不会以任何方式使该文件夹成为mingw-w64系统,而您只是植根了MSYS2系统在“ C:/ mingw / msys64”

I'm afraid that MSYS2 doesn't allow selection of root folders for any of its 3 repositories outside of selecting the global system root (ie the folder to which you install or unpack MSYS2). 恐怕MSYS2不允许在选择全局系统根目录(即安装或解压缩MSYS2的文件夹)之外为其3个存储库中的任何一个选择根文件夹。 The main reason for this is because we use pacman as our package manager and this facility doesn't exist there since it is a tool to manage the entire system and as such, all pacman packages are compressed with absolute folders (which are unpacked relative to the global system root). 造成这种情况的主要原因是因为我们使用pacman作为软件包管理器,但由于它是管理整个系统的工具,因此不存在该工具,因此,所有pacman软件包都使用绝对文件夹压缩(相对于全局系统根)。

Since MSYS2 (via Cygwin; credit for the core of MSYS2 lies with Cygwin) provides "/etc/fstab", you might think to use that to enable you to put "/mingw{32,64}" elsewhere, and to an extent you can get away with that, but I strongly urge you not to do this as it will just result in problems. 由于MSYS2(通过Cygwin; Mycrosoft MSYS2的核心在于Cygwin)提供了“ / etc / fstab”,因此您可能会考虑使用它来将“ / mingw {32,64}”放在其他位置,并在某种程度上您可以避免这种情况,但我强烈建议您不要这样做,因为这只会导致问题。 For example, Native Windows programs that expect to be able to use a relative path of "../" to get from "C:/msys64/mingw64" to "C:/msys64" will be sorely disappointed, and by that I mean will they will likely crash. 例如,期望能够使用相对路径“ ../”从“ C:/ msys64 / mingw64”到“ C:/ msys64”的本机Windows程序将非常失望,这意味着他们可能会崩溃。 For this reason I am not going to tell you how to achieve such a broken system. 因此,我不会告诉您如何实现这样一个损坏的系统。

You should try to think of your MSYS2 install as being a complete sub-system in its own right, where we've made some decisions (like the location of the "/", "/mingw32" and "/mingw64" folders) for you to improve compatibility and remove some variables that would make problems more frequent and difficult to diagnose and fix. 您应该尝试将MSYS2安装本身视为一个完整的子系统,在此我们已经做出了一些决定(例如,“ /”,“ / mingw32”和“ / mingw64”文件夹的位置)您可以提高兼容性并删除一些会使问题更加频繁且难以诊断和修复的变量。

I would also recommend installing MSYS2 to the root of a drive (any drive) due to Windows 260 MAXPATH limit. 由于Windows 260 MAXPATH的限制,我还建议将MSYS2安装到驱动器(任何驱动器)的根目录。 I know that with UNC paths the limit is much further out, but most MSYS2 and Windows software do not use UNC paths and have hardcoded C string arrays of size MAXPATH+1 all over the place. 我知道使用UNC路径的限制还远不止于此,但是大多数MSYS2和Windows软件都不使用UNC路径,并且到处都是大小为MAXPATH + 1的硬编码C字符串数组。 Doing this may also help you to think of the MinGW-w64 repositories as being sub-repositories of the overall MSYS2 system, rather than the other way around. 这样做还可以帮助您将MinGW-w64存储库视为整个MSYS2系统的子存储库,而不是相反。

For pacman reference, you should use these pages: 供pacman参考,您应该使用以下页面:

pacman.conf(5) Manual Page and pacman tips pacman.conf(5)手册页pacman技巧

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM