linux源码编译安装全功能版stardict(星际译王)+gucharmap+espeak+festival

作者:帅得不敢出门    C++哈哈堂     31843264  转载请保留此信息

 

很惭愧,工作以后一直抽不出空来写blog,这玩意我折腾了整整一个工作日,不容易,希望能为开源世界尽点动动手的小力,在此感谢我的老板(他现在暂时不知道我工作时间写blog这事)给了我充分的信任与充分的写作时间,感谢我还没出生的女朋友,感谢我的家人,感谢你百忙中来观望此贴,下面是正题:

下载源码:http://stardict.sourceforge.net/other.php

我下的是Source code package stardict-3.0.1.tar.bz2 1964K

解压编译

 tar -xvf stardict-3.0.1.tar.bz2
 cd stardict-3.0.1/
  ./autogen.sh

出错

checking for GUCHARMAP... no
configure: error: Gucharmap library not found or too old. Use --disable-gucharmap to build without gucharmap plugin.
这个gucharmap是何许人?,不怕我们搜索,找到它的主页

http://gucharmap.sourceforge.net/

gucharmap is a Unicode character map. It uses the gtk+ toolkit and runs on any platform that gtk+ supports.

download

Download gucharmap from GNOME ftp .

 

我们从gnome ftp上下,注意此版本的stardict只能对应下gucharmap-1.x x为任意数字,下2.0及以上版本,则无法编译,因为还是会出现

configure: error: Gucharmap library not found or too old. Use --disable-gucharmap to build without gucharmap plugin.
这个是configure文件中pkg-config检测时的问题,不深究

我下的是1.x最高版本

tar -xvf gucharmap-1.10.2.tar.bz2
 cd gucharmap-1.10.2/
 ./configure
 make;sudo make install

然后进入stardict-3.0.1目录
./autogen.sh

出错

checking festival.h... not found
configure: error: Festival library not found. Use --disable-festival to build without festival plugin.


这玩意是啥就不介绍了,下了源码安装就是 其主页 :http://www.cstr.ed.ac.uk/projects/festival/

下载页面:http://www.cstr.ed.ac.uk/projects/festival/download.html

下载

speech_tools-2.0.95-beta.tar.gz

festival-2.0.95-beta.tar.gz

为了编译libfestival.so 我们要下一个patch festival-2.0.95-alt-shared-lib-support-in-install.patch

 

编译安装:

tar -xvf speech_tools-2.0.95-beta.tar.gz
 cd speech_tools/

修改其下config/config.in文件

#SHARED=2改成SHARED=2就是去掉#

 ./configure
 make

sudo mkdir /usr/include/festival

sudo cp include/* /usr/include/festival/ -a

sudo cp lib/lib*.so* /usr/local/lib/

 

tar -xvf festival-2.0.95-beta.tar.gz
 cd festival/
 ./configure
 make

sudo cp src/include/* /usr/include/festival/ -a

cd ./src/arch/festival

gcc -shared -o libFestival.so *.o 

注意上面这个命令生成的并不是标准的libFestival.so,标准的还会把其源码下的module下的.o包括进去,用它编译festival是会报错的

我只是为了编译stardict才出此下策,要生成真正的libFestival.so靠你了,希望有人出个patch或者生成的方法,到时后希望拿出来跟我与大家分享

sudo cp libFestival.so    /usr/lib/

 

此时configure还会出错:

checking speak_lib.h... not found
configure: error: Espeak library not found. Use --disable-espeak to build without espeak plugin.

http://espeak.sourceforge.net/

下载页面:http://espeak.sourceforge.net/download.html

unzip espeak-1.44.05-source.zip
 cd espeak-1.44.05-source/
 cd src/
 make
出错:

/usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lportaudio
collect2: ld returned 1 exit status

 

http://www.portaudio.com/

下载页面:http://www.portaudio.com/download.html

最好还是下载pa_snapshot_v18.tgz    如果用v19编译安装再编译espeak时就会出现wavegen.cpp:(.text+0x3b9): undefined reference to `Pa_StreamActive' 的错误

 tar -xvf pa_snapshot_v18.tgz
 cd portaudio/
 ./configure
 make ; sudo make install

此时回到espeak-1.44.05-source/src目录再

make ; sudo make install 就可以了

 

回到stardict-3.0.1

./configure

过了  欣喜

make

又出错: 郁闷

In file included from signal.cc:20:0:
../../src/sigc++/signal.h:1675:26: error: declaration of ‘typedef struct sigc::signal0<T_return, T_accumulator>::slot_list_type sigc::signal0<T_return, T_accumulator>::slot_list’

.....................


data.cpp:40:18: error: ‘fclose’ was not declared in this scope
data.cpp: In member function ‘gchar* DictBase::GetWordData(guint32, guint32)’:
data.cpp:50:43: error: ‘fseek’ was not declared in this scope

解决方法:

下载补丁:

http://blogimg.chinaunix.net/blog/upfile2/101018154252.zip

将其挎贝到stardict-3.0.1中

进入startdict-3.0.1目录

patch -p1 < stardict.diff

./configure CXXFLAGS="-I/usr/include/festival"
make

终于编译成功

sudo make install 

stardict成功显示星际译王的界面

 

大喜,结果一看,没法朗读

 stardict -g输出如下:

Load /usr/local/lib/stardict/plugins/stardict_gucharmap.so failed!
Load /usr/local/lib/stardict/plugins/stardict_espeak.so failed!
拼写检查插件加载成功。
XDXF数据解析插件加载成功。
Load /usr/local/lib/stardict/plugins/stardict_festival.so failed!

但是这几个.so文件都是存在的

解决方法:

sudo mv /usr/local/lib/stardict/plugins/stardict_gucharmap.so{,.bak}
 sudo mv /usr/local/lib/stardict/plugins/stardict_espeak.so{,.bak}
 sudo mv /usr/local/lib/stardict/plugins/stardict_festival.so{,.bak}

但是还是无法朗读

首选项-音效-使用TTS程序--espeak %s &

这样朗读的按钮就从灰色变亮并且可按了

结果出现:

espeak: error while loading shared libraries: libportaudio.so: cannot open shared object file: No such file or directory
而libportaudio.so明明存在/usr/local/lib下的

解决方法有多个

1。比较直接简单, 把libportaudio.so  libportaudio.so.0.0.18 挎贝或者移动或者安装到/usr/lib下

2。修改LD_LIBRARY_PATH

 

词典安装可以到http://reciteword.cosoft.org.cn/stardict-iso/stardict-dic/ 下

比如下的是 stardict-langdao-ec-gb-2.4.2.tar.bz2
首先你确认下stardict是安装在哪个目录,我们这样默认是在/usr/local/下

安装方法:tar -xvf  stardict-langdao-ec-gb-2.4.2.tar.bz2 -C /usr/local/shared/stardict/dic

 

现在,我们可以宣布  全功能版的星际译王(应该是全功能了吧,算了吧,我只测了翻译与朗读,其他的大家发现吧) 终于编译成功了

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值