ubuntu14安装GoldenDict

这个软件可谓我目前安装过的最麻烦的软件(当然,我是ubuntu新手)

主要是需要自己编译呀,而且我之前没有相应的编译工具,所以我需要安装编译工具(qmake),qmake的安装也需要编译源码。昨天晚上折腾了好久,今天折腾一上午,终于解决了。

80%的时间花在安装qmake这个功能了,其实编译goldendict还挺快了。


1.下载软件

git clone git://github.com/goldendict/goldendict.git

下载方式2(上面的方式很慢,其实可以用浏览器进官网下载http://goldendict.org/download.php)


2.

cd goldendict
qmake

安装教程来自http://blog.csdn.net/Bsi_l4/article/details/49313845

执行./configure,提示:

To build the program, run qmake, then make.

The following dependency packages are required: libvorbis-dev, zlib1g-dev, libhunspell-dev, x11proto-record-dev, qt4-qmake, libqt4-dev, g++, libxtst-dev, libphonon-dev. They can be named slightly different in different distributions.

执行如下命令安装所需依赖,这里安装的版本都是Fedora-18-x86_64-DVD.iso自带的版本:
yum install libvorbis-devel zlib-devel hunspell-devel xorg-x11-proto-devel qt-devel qtwebkit-devel libXtst-devel phonon-devel

执行qmake-qt4,提示:

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Project MESSAGE: Failed to precisely describe the version via Git -- using the default version string

这是可能是Git需要联网下载更新失败而出现的错误,无视之。

执行make,出现如下错误信息:

processwrapper.cc: In static member function ‘static unsigned int ProcessWrapper::currentProcessId()’:
processwrapper.cc:99:19: error: ‘getpid’ was not declared in this scope
processwrapper.cc:100:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [build/processwrapper.o] Error 1

执行如下命令:
grep -r "getpid" *
输出信息如下:

processwrapper.cc:    returngetpid();

只找到了一个源文件中包含getpid,说明getpid是系统环境中的。

通过搜索"getpid was not declared in this scope",发现getpid在/usr/include/unistd.h这个头文件中,
于是通过分析processwrapper.cc,在这个源文件中的"#else"后添加"#include <unistd.h>"(注意添加到源文件中时不要带引号)。

再次执行make,又出现如下错误信息:

qtsingleapplication/src/qtlocalpeer.cpp: In constructor ‘QtLocalPeer::QtLocalPeer(QObject*, const QString&)’:
qtsingleapplication/src/qtlocalpeer.cpp:96:54: error: ‘::getuid’ has not been declared
qtsingleapplication/src/qtlocalpeer.cpp:96:54: note: suggested alternative:
In file included from qtsingleapplication/src/qtlockedfile_unix.cpp:42:0,
                 from qtsingleapplication/src/qtlocalpeer.cpp:60:
/usr/include/unistd.h:697:16: note:   ‘QtLP_Private::getuid’
make: *** [build/qtlocalpeer.o] Error 1

通过分析qtsingleapplication/src/qtlocalpeer.cpp,在这个源文件中的"#include <time.h>"后添加"#include <unistd.h>"(注意添加到源文件中时不要带引号)。

再执行make,编译通过了。

然后就是执行make install了。

安装完后,发现程序菜单中的GoldenDict没有图标,
执行vim /usr/local/share/applications/goldendict.desktop,
发现Icon=/usr/share/pixmaps/goldendict.png指定的png文件不存在,
执行ll /usr/local/share/pixmaps/goldendict.png,发现png文件原来在这,
于是修改为Icon=/usr/local/share/pixmaps/goldendict.png,
程序菜单中的GoldenDict就有图标了。

PS:不知道为什么GoldenDict使用词典需要执行权限,安装词典时,如果词典放在了/usr/local/share等非root用户有权限限制的地方,需要使用如下命令为词典文件添加执行权限:
chmod -R 755 dictionaries

命名行输入:goldendict



成功,然后就是导入词典喽

图形界面中点击,edit-dictionaries


添加词典文件的路径就可以了,我个人喜欢windows和linux共用软件(我是ubuntu14+win7的双系统),放在D盘

然后就可以愉快的用啦(词典文件下载,请自行百度或google)


为了在启动器中启动,将启动方式复制到/usr/share/applications/

sudo cp /usr/local/share/applications/goldendict.desktop  /usr/share/applications/

我导入了bgl的词典,发现音标乱码,在下面的网址找到了答案
http://www.cnblogs.com/F-32/p/4888387.html
其实,就是下载kingsoft-phonetic-unicode.ttf。把这个文件复制到 /usr/share/fonts/truetype 目录下,然后用chmod命令将这个字体文件权限修改为 644(其实默认就是这样的,不改页可以),然后重新打开goldendict就可以了。


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值