LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 5045|回复: 8

如何安装stardict命令行版

[复制链接]
发表于 2004-9-4 15:25:58 | 显示全部楼层 |阅读模式
我在机子上装了stardict窗口版。但在stardict的主页
http://stardict.sourceforge.net/index.php
上看到还有一个命令行版。下载解压后就有这么几个文件:
BUGS          dictziplib.h  libcore.cpp  lib.h     test       utils.hpp
COPYING       distance.cpp  libcore.hpp  main.cpp  TODO
dictziplib.c  distance.h    lib.cpp      Makefile  utils.cpp
使用make命令报告错误:
make
g++ -c -g -Wall -O0 -ansi `pkg-config --cflags glib-2.0` -DSTARDICT_DATA_DIR=\""/usr/share/stardict"\" -DHAVE_MMAP -o main.o  main.cpp
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
In file included from main.cpp:18:
libcore.hpp:4:18: glib.h: 没有那个文件或目录
In file included from libcore.hpp:9,
                 from main.cpp:18:
lib.h:11:18: glib.h: 没有那个文件或目录
In file included from libcore.hpp:9,
                 from main.cpp:18:
lib.h:15: error: 'glong' is used as a type, but is not defined as a type.
lib.h:16: error: syntax error before `*' token
lib.h:29: error: syntax error before `*' token
lib.h:31: error: syntax error before `*' token
lib.h:36: error: 'gint' is used as a type, but is not defined as a type.
lib.h:42: error: 'glong' is used as a type, but is not defined as a type.
lib.h:43: error: syntax error before `*' token
lib.h:48: error: syntax error before `*' token
lib.h:49: error: syntax error before `*' token
In file included from libcore.hpp:9,
                 from main.cpp:18:
lib.h:58: error: syntax error before `*' token
lib.h:59: error: 'glong' is used as a type, but is not defined as a type.
In file included from libcore.hpp:9,
                 from main.cpp:18:
lib.h:62: error: parse error before `[' token
lib.h:63: error: 'glong' is used as a type, but is not defined as a type.
lib.h:64: error: 'glong' is used as a type, but is not defined as a type.
lib.h:66: error: parse error before `char'
lib.h:69: error: parse error before `char'
lib.h:73: error: parse error before `char'
lib.h:74: error: ISO C++ forbids declaration of `glong' with no type
lib.h:74: error: `glong' declared as an `inline' field
lib.h:74: error: parse error before `(' token
lib.h:75: error: ISO C++ forbids defining types within return type
lib.h:75: error: syntax error before `*' token
lib.h:76: error: parse error before `char'
lib.h:77: error: `GPatternSpec' was not declared in this scope
lib.h:77: error: `pspec' was not declared in this scope
lib.h:77: error: `glong' was not declared in this scope
lib.h:77: error: `aIndex' was not declared in this scope
lib.h:77: error: parse error before `)' token
lib.h:78: error: syntax error before `*' token
lib.h:79: error: syntax error before `*' token
lib.h:87: error: 'gint' is used as a type, but is not defined as a type.
lib.h:89: error: `gchar' was not declared in this scope
lib.h:89: error: `dirname' was not declared in this scope
lib.h:89: error: invalid data member initialization
lib.h:89: error: (use `=' to initialize static data members)
lib.h:89: error: variable or field `LoadDir' declared void
lib.h:94: error: parse error before `)' token
lib.h:95: error: syntax error before `*' token
lib.h:96: error: ISO C++ forbids declaration of `gint' with no type
lib.h:96: error: `gint' declared as an `inline' field
lib.h:96: error: parse error before `(' token
lib.h:97: error: ISO C++ forbids defining types within return type
lib.h:97: error: syntax error before `*' token
lib.h:98: error: syntax error before `*' token
lib.h:99: error: syntax error before `*' token
lib.h:100: error: syntax error before `*' token
lib.h:101: error: syntax error before `*' token
lib.h:102: error: parse error before `*' token
lib.h:103: error: parse error before `*' token
lib.h:104: error: parse error before `*' token
lib.h:105: error: `GPatternSpec' was not declared in this scope
lib.h:105: error: `pspec' was not declared in this scope
lib.h:105: error: `glong' was not declared in this scope
lib.h:105: error: `aiIndexes' was not declared in this scope
lib.h:105: error: parse error before `,' token
lib.h:108: error: syntax error before `(' token
In file included from main.cpp:18:
libcore.hpp:41: error: parse error before `*' token
libcore.hpp:44: error: syntax error before `*' token
libcore.hpp:52: error: parse error before `*' token
libcore.hpp:53: error: parse error before `*' token
libcore.hpp:55: error: `gchar' was not declared in this scope
libcore.hpp:55: error: `word' was not declared in this scope
libcore.hpp:55: error: `gchar' was not declared in this scope
libcore.hpp:55: error: `data' was not declared in this scope
libcore.hpp:55: error: parse error before `*' token
In file included from main.cpp:24:
utils.hpp:4:18: glib.h: 没有那个文件或目录
In file included from main.cpp:24:
utils.hpp:6: error: syntax error before `(' token
utils.hpp:7: error: syntax error before `(' token
utils.hpp:8: error: syntax error before `*' token
main.cpp: In function `std:stream& operator<<(std:stream&, PrintUTF8)':
main.cpp:35: error: `gsize' undeclared (first use this function)
main.cpp:35: error: (Each undeclared identifier is reported only once for each
   function it appears in.)
main.cpp:35: error: parse error before `,' token
main.cpp:36: error: `GError' undeclared (first use this function)
main.cpp:36: error: `err' undeclared (first use this function)
main.cpp:38: error: `gchar' undeclared (first use this function)
main.cpp:38: error: `res' undeclared (first use this function)
main.cpp:38: error: `bytes_read' undeclared (first use this function)
main.cpp:38: error: `bytes_written' undeclared (first use this function)
main.cpp:38: error: `g_locale_from_utf8' undeclared (first use this function)
main.cpp:41: error: `g_error_free' undeclared (first use this function)
main.cpp:46: error: `g_free' undeclared (first use this function)
main.cpp: In function `void process_phrase(const char*, LibCore&)':
main.cpp:54: error: parse error before `;' token
main.cpp:57: error: `g_locale_to_utf8' undeclared (first use this function)
main.cpp:60: error: `g_error_free' undeclared (first use this function)
main.cpp:68: warning: cannot pass objects of non-POD type `class
   std::vector<LibCore::SearchResult, std::allocator<LibCore::SearchResult> >'
   through `...'; call will abort at runtime
main.cpp:71: warning: cannot pass objects of non-POD type `class
   std::vector<LibCore::SearchResult, std::allocator<LibCore::SearchResult> >'
   through `...'; call will abort at runtime
main.cpp:75: warning: cannot pass objects of non-POD type `class
   std::vector<LibCore::SearchResult, std::allocator<LibCore::SearchResult> >'
   through `...'; call will abort at runtime
main.cpp:105: error: `g_free' undeclared (first use this function)
make: *** [main.o] 错误 1

不知哪位朋友安装过命令行版的stardict,希望您帮我解决这个安装问题。
谢谢
发表于 2004-9-6 09:37:54 | 显示全部楼层
发表于 2004-9-6 09:54:03 | 显示全部楼层
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
 楼主| 发表于 2004-9-6 23:20:06 | 显示全部楼层
谢谢各位的回复。我现在装上了。
用的是kwokts兄弟的方法。
我用apt-get install glib2.0.pc or
apt-cache search glib2.0
找不到glib这个东西,然后就下载了kwokts兄弟的rpm包
然后 alien --to-deb xxx.rpm
发表于 2005-1-14 06:26:15 | 显示全部楼层
ft! 真是相见恨晚啊!
刚刚摸索很久装了这东西. 方法如下:
[1]:同样遇到了PKG_CONFIG_PATH的问题(我(mdk9.2+gnome)倒是有glib,不过不满足>=2.4.5的要求), 于是到官方主页下载了glib-2.6.0.tar.gz. 解压缩后进入glib-2.6.0目录, 指定目录(胆小,所以专门新建了一个try_glib-2.6)安装, 即先"./configure --prefix=/usr/include/try_glib-2.6",再"make",再"make install"(需root身份).
[2]:转到sdcv0.3.4目录下,指定PKG_CONFIG_PATH来装. 即先"./configure PKG_CONFIG_PATH=/usr/include/try_glib-2.6/lib/pkgconfig",再"make",再"make install"(需root身份).
[3]:sdcv装好后默认路径不对,不知道怎么改,暂时用命令"sdcv --data-dir /usr/share/stardict"凑合着--好烦啊,哪位给指导一下?
[4]:不知道stardict有没有纯英-英词典--若没有的话,这个自负界面的sdcv是不是非要装一个cce一类的中文支持来配合呢?--俺觉得找个纯英语词典应该没这么困难吧......可哪里有呢??? :ask
回复 支持 反对

使用道具 举报

发表于 2005-1-14 08:33:22 | 显示全部楼层
找到了! 给字符界面的stardict(sdcv)用的纯英译英词典. 精选前三名(个人观点)如下:

[1]--neat and clear and adequate:
stardict-dictd_www.dict.org_wn-2.4.2.tar.bz2

[2]--old and vast:
stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2 (including Webster_1913)

[3]--also adequate, but in html, ugly in text-mode:
quick_foldoc.* in stardict-quick_eng_eng-2.4.2.tar.bz2
回复 支持 反对

使用道具 举报

发表于 2005-1-14 21:35:24 | 显示全部楼层
Post by cycloid
找到了! 给字符界面的stardict(sdcv)用的纯英译英词典. 精选前三名(个人观点)如下:

[1]--neat and clear and adequate:
stardict-dictd_www.dict.org_wn-2.4.2.tar.bz2

[2]--old and vast:
stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2 (including Webster_1913)

[3]--also adequate, but in html, ugly in text-mode:
quick_foldoc.* in stardict-quick_eng_eng-2.4.2.tar.bz2



非常感谢提供字典!!
回复 支持 反对

使用道具 举报

发表于 2005-3-6 01:13:43 | 显示全部楼层
后来又学了学shell,把这个字符界面字典小封装了一下. 现在可以选择不同的字典来查,而且输出的结果交给less命令可以上下滚屏,感觉好用多了. 下面是俺写的shell,与大家分享,并请老鸟指教
[注: 其中DataDir设了/home/cycloid/Dictionary/Big和/home/cycloid/Dictionary/Mini两个值,sdcv会到DataDir/dic/目录中(注意要在里面建个dic目录才行)去找相应的字典文件,你可以根据自己的字典分类和存放路径修改这些值.]
------------------------------------------------------------------------------------

  1. #!/bin/bash
  2. function selectdict
  3. {
  4.         echo -e "Select dictionary--mini(m) or big(b)? \c"
  5.         read dictionary
  6.         if [[ $dictionary == [Bb]* ]]
  7.         then
  8.                 DataDir="/home/cycloid/Dictionary/Big"
  9.         else
  10.                 DataDir="/home/cycloid/Dictionary/Mini"
  11.         fi
  12.         echo "Dictionary data dir [$DataDir] selected."
  13. }
  14. function lookup
  15. {
  16.         sdcv --data-dir=$DataDir -n $word | less
  17. }

  18. #main program start:
  19. selectdict
  20. while [ 1 == 1 ]
  21. do
  22.         echo "Look up word:             (Q/q to quit, S/s to select other dictionary)"
  23.         read word
  24.        
  25.         if [[ $word == [Ss] ]]
  26.         then
  27.                 selectdict
  28.         elif [[ $word == [Qq] ]]
  29.         then
  30.                 exit 0
  31.         else
  32.                 lookup
  33.         fi
  34. done
复制代码
回复 支持 反对

使用道具 举报

发表于 2008-1-9 10:28:25 | 显示全部楼层
sudo apt-get install sdcv
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表