MSYS2环境使用记录

1. MSYS2官方网站

Wiki: https://sourceforge.net/p/msys2/wiki/Home/

Home: http://msys2.github.io/

Sourcefore Home: https://sourceforge.net/projects/msys2/

MSYS2-packages: https://github.com/Alexpux/MSYS2-packages

MINGW-packages: https://github.com/Alexpux/MINGW-packages

2. 国内源配置

使用MSYS2官方的源,在执行软件包的下载安装时通常非常的慢,经常链接被重置,如果有一个国内的安装镜像源的话,那么速度是非常快的.现在什么东西都有国内的镜像了,比如操作系统镜像,Eclipse镜像,就连Google的Andriod stdio IDE的更新都能找到国内的源....这说明我们国内的技术越来越注重基础环境的构建,这是一种良性的软件开发生态,非常高兴.

在MSYS2的官方网站上,没有找到所有的镜像源的所有记录,只能通过搜索引擎慢慢的查找, 首先是MSYS2-packages中带的一个pacman-mirrors, 路径为https://github.com/Alexpux/MSYS2-packages/tree/master/pacman-mirrors 这个目录中指向的三个文件也就是我们MSYS2默认使用的源.

https://gist.github.com/elvisw/cc00088e9c8fd1c83aca 中有几个源,目前在网络上搜索相似度比较高的也就是这几个. mirrorlist.mingw32

##
## 32-bit Mingw-w64 repository mirrorlist
## Changed on 2014-11-15
##
##中国科学技术大学开源软件镜像
Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MINGW/i686
##北京理工大学镜像
Server = http://mirror.bit.edu.cn/msys2/REPOS/MINGW/i686
##日本北陆先端科学技术大学院大学 sourceforge 镜像
Server = http://jaist.dl.sourceforge.net/project/msys2/REPOS/MINGW/i686
##The UK Mirror Service Sourceforge mirror
Server = http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/m/ms/msys2/REPOS/MINGW/i686
## Primary
Server = ftp://148.251.42.38/MINGW/i686
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686

mirrorlist.mingw64

##
## 64-bit Mingw-w64 repository mirrorlist
## Changed on 2014-11-15
##
##中国科学技术大学开源软件镜像
Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MINGW/x86_64
##北京理工大学镜像
Server = http://mirror.bit.edu.cn/msys2/REPOS/MINGW/x86_64
##日本北陆先端科学技术大学院大学 sourceforge 镜像
Server = http://jaist.dl.sourceforge.net/project/msys2/REPOS/MINGW/x86_64
##The UK Mirror Service Sourceforge mirror
Server = http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/m/ms/msys2/REPOS/MINGW/x86_64
## Primary
Server = ftp://148.251.42.38/MINGW/x86_64
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86_64

mirrorlist.msys

##
## MSYS2 repository mirrorlist
## Changed on 2014-11-15
##
##中国科学技术大学开源软件镜像
Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MSYS2/$arch
##北京理工大学镜像
Server = http://mirror.bit.edu.cn/msys2/REPOS/MSYS2/$arch
##日本北陆先端科学技术大学院大学 sourceforge 镜像
Server = http://jaist.dl.sourceforge.net/project/msys2/REPOS/MSYS2/$arch
##The UK Mirror Service Sourceforge mirror
Server = http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/m/ms/msys2/REPOS/MSYS2/$arch
## Primary
Server = ftp://148.251.42.38/MSYS2/$arch
## Sourceforge.net
Server = http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/$arch

而中国科学技术大学的镜像源配置说明在https://lug.ustc.edu.cn/wiki/mirrors/help/msys2 但是按照文章中的指示:

pacman 的配置

编辑 /etc/pacman.d/mirrorlist.mingw32 ,在文件开头添加:

  Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MINGW/i686
编辑 /etc/pacman.d/mirrorlist.mingw64 ,在文件开头添加:

  Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MINGW/x86_64
编辑 /etc/pacman.d/mirrorlist.msys ,在文件开头添加:

  Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MSYS2/$arch
然后执行 pacman -Sy 刷新软件包数据即可。

去配置镜像源,发现根本就不会起作用,一度让我认为这个源已经失效, 今天意外地发现,目前的镜像源应该配置为下面的内容才是合法有效的:

mingw32: Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686
mingw64: Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64
msys   : Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch

在这篇文章中提到如何搭建MSYS2的镜像源,摘录如下:

Hi,

  1. Where do I download "the repository"?

From http://repo.msys2.org/mingw using curl or wget for example

  1. What do I need to do to configure pacman to use my mirror rather than the main repo?

Edit /etc/pacman.conf and define a new repository as explained in pacman.conf manpage. The new repository can be local or remote depending on your needs.

For a remote server, just setup an HTTP server serving the content of the directory where you downloaded packages (step. 1).

Packages must be indexed using the tool repo-add, see the manpage again.

That's all!

3. configure.ac: error: possibly undefined macro: AC_MSG_ERROR

最近在MSYS2中的MINGW64环境中编译一个软件包的时候,遇到一个如下的错误:

$ ./autogen.sh
Running autoreconf --verbose --install --force
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:337: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Remember to add 'LT_INIT' to configure.ac.
configure.ac:337: warning: macro 'AM_PATH_LIBGCRYPT' not found in library
autoreconf: running: /usr/bin/autoconf --force
configure.ac:244: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:337: error: possibly undefined macro: AM_PATH_LIBGCRYPT
configure.ac:342: error: possibly undefined macro: AC_MSG_WARN
autoreconf: /usr/bin/autoconf failed with exit status: 1

一直在解决AC_MSG_ERROR这个问题,搜索了好多网站,都说是要安装pkg-config,网址记录有:

http://blog.csdn.net/kezhen/article/details/21727859

http://blog.csdn.net/w839687571/article/details/51810984

http://blog.csdn.net/yzyak47958/article/details/42002483

http://stackoverflow.com/questions/28570244/as-if-and-ac-msg-error-error-possibly-undefined-macro

https://www.bountysource.com/issues/34194377-configure-ac-113-error-possibly-undefined-macro-ac_msg_error

https://github.com/j4tools/j4status-plugins/issues/3

http://flummox-engineering.blogspot.com/2014/04/configure-possibly-undefined-macro.html

https://bugs.freedesktop.org/show_bug.cgi?id=87297

https://github.com/jgarzik/cpuminer/issues/34

https://issues.mediagoblin.org/ticket/755

https://issues.mediagoblin.org/attachment/ticket/755/755.patch

https://github.com/ioerror/tlsdate/issues/97

http://gnu-autoconf.7623.n7.nabble.com/Bug-quot-possibly-undefined-macro-AC-MSG-ERROR-quot-td16506.html

还有好多,基本上提到的方法都没有解决这个问题, 既然解决不了"ERROR",我想先把"WARN"解决了吧,更换关键字,搜索到[Buildroot] [PATCH 1/1] systemd: fix AM_PATH_LIBGCRYPT not found

This patch installs a copy of libgcrypt.m4 from the libgcrypt source tarball to systemd m4 directory.

Libgcrypt uses a custom m4 macro and not pkg-config to check if the development files are available. Though libgcrypt support is optional in systemd, this macro should be available whenever autoreconf is used, otherwise the re-configuration will fail with:

configure.ac:616: warning: macro 'AM_PATH_LIBGCRYPT' not found in library

The call to autoreconf is required, as it is needed by the patch which solves the ln --relative issue.

提示要安装libgcrypt,搜索libgcrypt

$ pacman -Sl | grep libgcrypt
mingw32 mingw-w64-i686-libgcrypt 1.7.3-1
mingw64 mingw-w64-x86_64-libgcrypt 1.7.3-1
msys libgcrypt 1.6.4-1 [已安装]
msys libgcrypt-devel 1.6.4-1

这里使用的MINGW64,所以安装mingw-w64的库

$ pacman -S mingw-w64-x86_64-libgcrypt

安装完成后,再次执行./autogen.sh

$ ./autogen.sh
Running autoreconf --verbose --install --force
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Remember to add 'LT_INIT' to configure.ac.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:36: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:36: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:189: installing './compile'
configure.ac:32: installing './config.guess'
configure.ac:32: installing './config.sub'
configure.ac:36: installing './install-sh'
configure.ac:36: installing './missing'
Makefile.am: installing './INSTALL'
libfuse-lite/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'

顺利通过,困扰在心中的烦恼终于消失,但是感觉对Linux的automake,autoconf,libtool,m4,autogen等工具了解还不是非常深入,导致遇到问题总是搜索啊搜索.

转载于:https://my.oschina.net/u/126042/blog/825229

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值