OpenCC: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
Install [https://github.com/BYVoid/OpenCC OpenCC] on Centos7. OpenCC is the project for "conversion between Traditional and Simplified Chinese".
Install [https://github.com/BYVoid/OpenCC OpenCC] on [https://www.centos.org/download/ Centos7] Linux. OpenCC is the project for "conversion between Traditional and Simplified Chinese".


== Installation ==
== Installation ==

Revision as of 18:45, 15 July 2019

Install OpenCC on Centos7 Linux. OpenCC is the project for "conversion between Traditional and Simplified Chinese".

Installation

Install OpenCC on Centos7

  1. git clone https://github.com/BYVoid/OpenCC.git --depth 1
  2. Install GCC from repository sudo yum -y install gcc[1]
    • Verify the version of gcc because gcc 4.6 is required. gcc --version
  3. Install CMake from repository sudo yum -y install cmake
    • Verify the installation of CMake: Input cmake--version Expected result are as the following:
      cmake version 2.8.12.2
  4. Install Make from repository sudo yum -y install make
    • Verify the installation of Make: Input make--version Expected result are as the following:
      GNU Make 3.82 ... 
  5. Install Doxygen from repository sudo yum -y install doxygen
    • Verify the installation of doxygen: Input doxygen--version Expected result are as the following:
      1.8.5
  6. cd OpenCC
  7. make
  8. sudo make install
  9. (optional) sudo ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2

Verify the installation of opencc:

  • Input opencc --version. Expected result are as the following:
Open Chinese Convert (OpenCC) Command Line Tool
Version: 1.0.5

Usage

See the details on the page: GitHub - BYVoid/OpenCC: A project for conversion between Traditional and Simplified Chinese

##  Simplified Chinese to Traditional Chinese (Taiwan Standard) with Taiwanese idiom
# echo "项目管理" | opencc -c s2twp
專案管理

## Traditional Chinese (Taiwan Standard) to Simplified Chinese with Mainland Chinese idiom
# echo "專案管理" | opencc -c tw2sp
项目管理

## Traditional Chinese (Taiwan Standard) to Simplified Chinese
# echo "專案管理" | opencc -c tw2s
专案管理

## Simplified Chinese to Traditional Chinese (Taiwan Standard) 
# echo "项目管理" | opencc -c s2tw
項目管理

Troubleshootings

cmake: command not found

Error message:

$ make
mkdir -p build/rel
(cd build/rel; cmake \
-DBUILD_DOCUMENTATION:BOOL=ON \
-DENABLE_GTEST:BOOL=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
../..)
/bin/sh: line 1: cmake: command not found
make: *** [build] Error 127

Solution:

  1. Install GCC from repository sudo yum -y install gcc
    • Verify the version of gcc because gcc 4.6 is required. gcc --version

Doxygen is needed to build the documentation

Error message:

$ make
mkdir -p build/rel
(cd build/rel; cmake \
-DBUILD_DOCUMENTATION:BOOL=ON \
-DENABLE_GTEST:BOOL=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
../..)
-- The CXX compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
CMake Error at doc/CMakeLists.txt:4 (message):
  Doxygen is needed to build the documentation.  Please install it correctly


-- Configuring incomplete, errors occurred!
See also "/home/user/build/rel/CMakeFiles/CMakeOutput.log".
make: *** [build] Error 1

Solution:

  1. Install Doxygen from repository sudo yum -y install doxygen

opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory

Error message:

$ opencc --version
opencc: error while loading shared libraries: libopencc.so.2: cannot open shared object file: No such file or directory

Solution:

  1. Keyin: sudo ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2[2]


References