终于好了。搞到转钟3点都没搞定,耽误不少时间.

执行sudo port install dpkg
 报错如下
Error: org.macports.build for port gmp returned: command execution failed

Error: Failed to install gmp

Please see the log file for port gmp for details:

/opt/local/var/macports/logs/_opt_local_var_macports_sources_www.macports.org_files_ports_devel_gmp/gmp/main.log

Error: The following dependencies were not installed: coreutils gmp gnutar help2man p5.16-locale-gettext perl5.16 gdbm perl5 xz zlib

To report a bug, follow the instructions in the guide:

http://guide.macports.org/#project.tickets

Error: Processing of port dpkg failed

提示的gmp安装失败,dpkg缺少后面这么多依赖没装。于是我就准备手动安装一个个依赖

查看dpkg包依赖

xiongwj:~ luojin$ sudo port deps dpkg

Full Name: dpkg @1.14.29_4

Build Dependencies:   gmake

Library Dependencies: gettext, libiconv, perl5, coreutils, bzip2, zlib

Runtime Dependencies: gnutar, xz

使用安装命令安装各个依赖包

顺利安装完gnutar , xz,perl5之后

coreutils依赖需要gmp,结果gmp安装失败。

找到问题根源就是gmp安装不了。

其实之前装dpkg的时候就已经报了gmp安装失败的提示,蛋疼 又绕回来了。

Error: org.macports.build for port gmp returned: command execution failed

Please see the log file for port gmp for details:

/opt/local/var/macports/logs/_opt_local_var_macports_sources_distfiles.macports.org_ports_devel_gmp/gmp/main.log

To report a bug, follow the instructions in the guide:

http://guide.macports.org/#project.tickets

Error: Processing of port gmp failed

查看日志main.log

:info:build /Volumes/Xcode 5.1/Xcode.app/Contents/Developer/usr/bin/make  all-recursive

:info:build make: /Volumes/Xcode: No such file or directory

:info:build make: *** [all] Error 1

:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_distfiles.macports.org_ports_devel_gmp/gmp/work/gmp-6.0.0'

:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_distfiles.macports.org_ports_devel_gmp/gmp/work/gmp-6.0.0" && /usr/bin/make -j4 -w all

:info:build Exit code: 2

:error:build org.macports.build for port gmp returned: command execution failed

:debug:build Error code: CHILDSTATUS 43636 2

:debug:build Backtrace: command execution failed

安装多个xcode的同学,选一个指定的xcode复制到Applications目录下,然后重新指定以下。

xcode-select -switch /Applications/Xcode.app/Contents/Developer

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

再然后开始sudo port install gmp

还是失败,

尝试了很多方法还是安装失败,后来谷歌百度搜索“gmp安装”找到如下安装教程

http://www.cnblogs.com/math-mao/archive/2013/05/15/3080181.html

首先,去libgmp官网下载最新的gmp包。(我下的是gmp-6.0.0)

然后gmp-6.0.0.tar.bz2。使用命令,也可以直接解压

tar -jvxf gmp-6.0.0.tar.bz2
 

进入gmp-6.0.0文件夹

cd gmp-6.0.0

接下来比较关键,在使用configure的时候要加上 --enable-cxx命令,否则不能使用c++库gmpxx.h

./configure --enable-cxx

然后

make
 
make check

最后

sudo make install

就安装完成了。

也就是下载代码,自己make编译,然后安装。成功。接下来安装dpkg

执行sudo port install dpkg
终于安装成功了。以前装的时候是那么的顺利,这次比较曲折,记录一下。

05-11 14:02