未找到编译器错误 -msgfmt 命令

我正在尝试从我的共享主机上更新 Git。为此,我遵循以下步骤:

  1. 下载最新的 Git 版本
  2. 解压后放到服务器上
  3. 配置并创建 Makefile-> ./configure --prefix=$HOME/dev/git/src --without-tcltk
  4. 构建包-> make然后 make install
  5. 更新 PATH. bash _ profile

我停留在点4。当我运行 make命令时,我得到以下结果:

user@ssh1:~/dev/git/src$ make
SUBDIR gitweb
SUBDIR ../
make[2]: ? GIT-VERSION-FILE ? est ? jour.
GEN git-instaweb
SUBDIR perl
SUBDIR git_remote_helpers
SUBDIR templates
MSGFMT po/build/locale/is/LC_MESSAGES/git.mo
/bin/sh: msgfmt: command not found
make: *** [po/build/locale/is/LC_MESSAGES/git.mo] Erreur 127

编译器抛出 msgfmt command not found错误。

我谷歌了一下,似乎和 gettext 包有关。

知道如何修复共享主机上的错误吗?

104613 次浏览

I had the same issue. Thanks to your work on finding it was related to gettext, a simple apt-get install gettext fixed it for me.

While building Git with Xcode (using Makefile), I had to define NO_GETTEXT = YesPlease in the Makefile to resolve this issue.

Try to add -i to your make command.

> make -i ...

make -i
make -i install

..worked flawlessy for this problem. Also if anyone's having trouble with http/https helper, during configure do not forget to add the following thing

./configure --with-curl --with-expat

On cygwin, you need to install the gettext-devel package as well. The gettext package alone is not enough to resolve this problem.

msgfmt is included in the gettext-devel cygwin package. Install that (via setup.exe or apt-cyg) and the error should go away.

You can install gettext in the same way you are installing git. By downloading, extracting, building and installing it to a given location in your home folder:

curl -O https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz
tar xvf gettext-0.20.1.tar.gz
cd gettext-0.20.1/
./configure --prefix=/home/$HOME/opt
make
make install

Set the prefix to the location you want for the installation.

xgettext, msgfmt and etc. belong to GNU gettext toolset. On macOS, you could use MacPort's port command to install these tools on your system:

port install gettext

On Mac Os, this worked for me:

brew install gettext
brew link gettext --force

In Debian 10 to me was missing package gettext. Solved as follow:

$ sudo apt install gettext

Then make commando worked fine.

There's one more option to obtain the software:

ipkg install gettext