MSYS2環境使用記錄

1. MSYS2官方網站

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

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

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

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

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

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.mingw32ui

##
## 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.mingw64this

##
## 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等工具瞭解還不是很是深刻,致使遇到問題老是搜索啊搜索.

相關文章
相關標籤/搜索