Installation and Support of Toolchain on Linux
The Cangjie toolchain has been fully tested on the following Linux distributions:
- SUSE Linux Enterprise Server 12 SP5
- Ubuntu 18.04
- Ubuntu 20.04
Commands for Installing Cangjie Toolchain Dependencies on Various Linux Distributions
Note:
Some tools on which the Cangjie toolchain depends may not be directly installed through the default software source on certain Linux distributions. You can manually install them by referring to Compiling and Installing Dependency Tools.
SUSE Linux Enterprise Server 12 SP5
$ zypper install \
binutils \
glibc-devel \
gcc-c++
In addition, you need to install OpenSSL 3. For details about the installation method, see Compiling and Installing Dependency Tools.
Ubuntu 18.04
$ apt-get install \
binutils \
libc-dev \
libc++-dev \
libgcc-7-dev
In addition, you need to install OpenSSL 3. For details about the installation method, see Compiling and Installing Dependency Tools.
Ubuntu 20.04
$ apt-get install \
binutils \
libc-dev \
libc++-dev \
libgcc-9-dev
In addition, you need to install OpenSSL 3. For details about the installation method, see Compiling and Installing Dependency Tools.
Other Linux Distributions
Depending on the Linux distribution you use, you may need to refer to the preceding dependency installation commands and use your system package management tool to install the corresponding dependencies. If your system does not provide related software packages, you may need to install the link tool, C language development tool, C++ development tool, GCC compiler, and OpenSSL 3 to use the Cangjie toolchain.
Compiling and Installing Dependency Tools
Currently, some standard libraries (and some tools) in the Cangjie toolchain use OpenSSL 3. If the system package management tool does not provide OpenSSL 3, you may need to compile and install OpenSSL 3 using the source code. This section describes how to compile OpenSSL 3 using the source code.
OpenSSL 3
You can download the OpenSSL 3 source code from the following link:
- https://www.openssl.org/source/
- https://www.openssl.org/source/old/
OpenSSL 3.0.7 or later is recommended.
Note:
Before running the following compilation and installation commands, read the notes carefully and adjust the commands based on the actual situation. Incorrect configuration and installation may cause other software to be unavailable. If you encounter issues during the compilation and installation or you want to perform additional installation and configuration, see the
INSTALL
file in the OpenSSL source code or the OpenSSL FAQ.
Using OpenSSL 3.0.7 as an example, after downloading, run the following command to decompress the package:
$ tar xf openssl-3.0.7.tar.gz
Go to the directory after decompressing the package.
$ cd openssl-3.0.7
Compile OpenSSL.
Note:
If OpenSSL has been installed on your system, you are advised to use the
--prefix=<path>
option to specify a custom installation path, for example,--prefix=/usr/local/openssl-3.0.7
or your personal directory. If OpenSSL already exists in the system directory, running the following command to compile and install OpenSSL may overwrite OpenSSL and cause applications that depend on OpenSSL to be unavailable.
$ ./Configure --libdir=lib
$ make
Test OpenSSL.
$ make test
To install OpenSSL to the system directory (or the directory you specified in --prefix
), you may need to provide root permissions to successfully run the following command:
$ make install
Or
$ sudo make install
If the installation path is not set using --prefix
during OpenSSL compilation, the OpenSSL installation is complete. If you specified a custom installation path using --prefix
, you need to set the following variables so that the Cangjie toolchain can find OpenSSL 3.
Note:
If another version of OpenSSL exists in your system, the default OpenSSL version used by other compilation and development tools may also be affected in addition to the Cangjie toolchain after the following configuration. If OpenSSL incompatibility occurs when other compilation and development tools are used, configure the following variables only for the Cangjie development environment.
Replace <prefix>
with the custom installation path.
$ export LIBRARY_PATH=<prefix>/lib:$LIBRARY_PATH
$ export LD_LIBRARY_PATH=<prefix>/lib:$LD_LIBRARY_PATH
The environment variables configured using the preceding method are valid only in the current shell
session window. If you want the shell
to configure them automatically every time it starts, you can add the preceding commands to $HOME/.bashrc
, $HOME/.zshrc
, or other shell
configuration files (depending on the shell
type).
If you want the configuration to take effect for all users by default, run the following commands.
Replace <prefix>
with the custom installation path.
$ echo "export LIBRARY_PATH=<prefix>/lib:$LIBRARY_PATH" >> /etc/profile
$ echo "<prefix>/lib" >> /etc/ld.so.conf
$ ldconfig
After the execution is complete, open the shell
session window again for the modification to take effect.
OpenSSL 3 has been successfully installed. You can go back to the original section to continue reading or try to run the Cangjie compiler.