SDCV installation in CYGWIN

来源:互联网 发布:apache https 编辑:程序博客网 时间:2024/06/14 10:04

Software versions: Windows 8 Pro, Cygwin 1.7.17, gcc 3.4.4 (cygming special) and SDCV 0.4.2


SDCV [1] is the Command-line (Console) Version of StarDict dictionary. The installation procedures are listed below.


1. Downloading

Download the release from the SDCV Home Page [2]. Unpack the tarball,

tar -xvf sdcv-0.4.2.tar.bz2

See the INSTALL file for installation steps, which will be explained in detail next.


2. Configuration

Run the following scripts:

cd sdcv-0.4.2./configure

Missing libraries, such as zlib, pkg-config, and glib-2.0 should be installed in advance. It may be easier to use apt-cyg [3] than the setup.exe to perform the installation.

In the following source compiling step, one may find that the provided configuration file can lead to various errors. Troubleshootings are provided.


3. Compiling

Run "make" to compile the sources. During the compilation, some errors may occur.

(1) mapfile.hpp:28: error [4]

The error seems to be caused by the MMAP problem on Cywin [5]. The solution is to replace AC_FUNC_MMAP with AC_CHECK_FUNCS(mmap) in the "configure.ac" file.

After this modification, run "autoconf" and "make" again.

(2) locale.h:62: error: `libintl_setlocale' is not a member of `std' [6]

The error is because of incorrect orders of heading files in "src/sdcv.cpp". Just put C++ headers <string>, <vector>, and <memory> before the three glib headers, then problem solved.

(3) lib/libstardict.a(lib.o) problem [4]

"Seemly ar does not work on current cygwin" [4] [5]. The original command line is:

g++ -g -O2 -o sdcv.exe sdcv.o getopt.o getopt1.o libwrapper.o readline.o utils.o -lglib-2.0 -lintl -liconv -lpcre lib/libstardict.a -lz

Change the command line to:

cd sdcv-0.4.2/src/g++ -g -O2 -o sdcv.exe sdcv.o getopt.o getopt1.o libwrapper.o readline.o utils.o lib/*.o -lglib-2.0 -lintl -liconv -lpcre -lz

Then sdcv.exe is generated, and it works.

Run the self-tests optionally, by typing "make check"


4. Installation

Run the script below to install the programs, data files and documentation.

make install

The program sdcv.exe is installed in /usr/local/bin/.


5. Adding dictionary files

Download dictionary files from [8] [9] [10]. Unpack and put them into the stardict directory, where sdcv looks for dictionaries when invoked [11] [12].

mkdir /usr/share/stardict/dic/tar -xvjf downloaded.tar.bz2 -C /usr/share/stardict/dic(or tar -xvzf downloaded.tar.gz -C /usr/share/stardict/dic)

Some dictionaries are marked "recommended" on the website. Seems that there are some copyright issues though.


6. Using SDCV

sdcv [list of words]

Use "man sdcv" for more detailed user manual.


===========

References:

[1] http://en.wikipedia.org/wiki/Sdcv

[2] http://sdcv.sourceforge.net/

[3] http://blog.csdn.net/lllcfr1/article/details/8669885

[4] http://sourceforge.net/tracker/?func=detail&aid=1585638&group_id=122858&atid=694731

[5] http://nanjj.blogspot.hk/2007/03/sdcvcygwin.html

[6] http://sourceforge.net/tracker/?func=detail&aid=3276858&group_id=122858&atid=694728

[7] https://trac.macports.org/browser/trunk/dports/textproc/sdcv/files/patch-setlocale.diff?rev=85010

[8] http://www.stardict.org/

[9] http://code.google.com/p/stardict-3/wiki/DownloadDictionaries

[10] http://abloz.com/huzheng/stardict-dic/

[11] http://renwolang521.iteye.com/blog/1317789

[12] http://flossstuff.wordpress.com/2012/01/23/sdcv-command-line-based-dictionary-for-linux/


原创粉丝点击