OpenCC: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
Line 7: Line 7:
#* Verify the version of gcc because gcc 4.6 is required. {{kbd | key=<nowiki>gcc --version</nowiki>}}
#* Verify the version of gcc because gcc 4.6 is required. {{kbd | key=<nowiki>gcc --version</nowiki>}}
# Install [https://cmake.org/ CMake] from repository {{kbd | key=<nowiki>sudo yum -y install cmake</nowiki>}}
# Install [https://cmake.org/ CMake] from repository {{kbd | key=<nowiki>sudo yum -y install cmake</nowiki>}}
#* Verify the installation of CMake: Input {{kbd | key=<nowiki>cmake--version</nowiki>}} Expected result are as the following:<pre>cmake version 2.8.12.2</pre>
# Install [https://www.gnu.org/software/make/ Make] from repository {{kbd | key=<nowiki>sudo yum -y install make</nowiki>}}
# Install [https://www.gnu.org/software/make/ Make] from repository {{kbd | key=<nowiki>sudo yum -y install make</nowiki>}}
#* Verify the installation of Make: Input {{kbd | key=<nowiki>make--version</nowiki>}} Expected result are as the following:<pre>GNU Make 3.82 ... </pre>
# Install [http://www.doxygen.nl/ Doxygen] from repository {{kbd | key=<nowiki>sudo yum -y install doxygen</nowiki>}}
# Install [http://www.doxygen.nl/ Doxygen] from repository {{kbd | key=<nowiki>sudo yum -y install doxygen</nowiki>}}
#* Verify the installation of doxygen: Input {{kbd | key=<nowiki>doxygen--version</nowiki>}} Expected result are as the following:<pre>1.8.5</pre>
# {{kbd | key=<nowiki>cd OpenCC</nowiki>}}
# {{kbd | key=<nowiki>cd OpenCC</nowiki>}}
# {{kbd | key=<nowiki>make</nowiki>}}
# {{kbd | key=<nowiki>make</nowiki>}}
# {{kbd | key=<nowiki>sudo make install</nowiki>}}
# {{kbd | key=<nowiki>sudo make install</nowiki>}}


Verify the installation
Verify the installation of opencc:
# Input {{kbd | key=<nowiki>opencc --version</nowiki>}}. And the expected result are as the following:
* Input {{kbd | key=<nowiki>opencc --version</nowiki>}}. Expected result are as the following:
<pre>
<pre>
Open Chinese Convert (OpenCC) Command Line Tool
Open Chinese Convert (OpenCC) Command Line Tool

Revision as of 18:38, 15 July 2019

Install OpenCC on Centos7. 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

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

# echo "项目管理" | opencc -c s2twp
專案管理

# echo "專案管理" | opencc -c tw2sp
项目管理

# echo "專案管理" | opencc -c tw2s
专案管理

# 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