Build
This chapter consists of three parts:
- how to set up K2HASH for local development
- how to build K2HASH from the source code
- how to install K2HASH
1. Install prerequisites
K2HASH primarily depends on FULLOCK. FULLOCK and its header files are required to build K2HASH. We provide two ways to install them. You can select your favorite one.
- Use GitHub
Install fullock source code and the header files. You will build them and install them. - Use packagecloud.io
Install packages of fullock and its header files. You just install them. Libraries are already built.
1.1. Install fullock and its header files from GitHub
Read the following documents for details:
1.2. Install fullock and its header files from packagecloud.io
This section instructs how to install fullock and the header files from packagecloud.io - AntPickax stable repository.
Note: Skip reading this section if you have installed each dependent library and the header files from GitHub in the previous section.
K2HASH requires a SSL/TLS library and header files. Table1 shows Development packages to build the K2HASH.
Table1. Development packages to build the K2HASH:
SSL/TLS library | pkg |
---|---|
OpenSSL | libssl-dev(deb) / openssl-devel(rpm) |
GnuTLS (gcrypt) | libgcrypt20-dev(deb) |
GnuTLS (nettle) | nettle-dev(deb) |
Mozilla NSS | nss-devel(rpm) |
For recent Debian-based Linux distributions users, follow the steps below: You can replace libgcrypt20-dev
with the other SSL/TLS package your application requires:
$ sudo apt-get update -y
$ sudo apt-get install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh \
| sudo bash
$ sudo apt-get install autoconf autotools-dev gcc g++ make gdb libtool pkg-config \
libyaml-dev libfullock-dev libgcrypt20-dev -y
$ sudo apt-get install git -y
For users who use supported Fedora other than latest version, follow the steps below: You can replace nss-devel
with the other SSL/TLS package your application requires:
$ sudo dnf makecache
$ sudo dnf install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
| sudo bash
$ sudo dnf install autoconf automake gcc gcc-c++ gdb make libtool pkgconfig \
libyaml-devel libfullock-devel nss-devel -y
$ sudo dnf install git -y
For other recent RPM-based Linux distributions users, follow the steps below: You can replace nss-devel
with the other SSL/TLS package your application requires:
$ sudo yum makecache
$ sudo yum install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
| sudo bash
$ sudo yum install autoconf automake gcc gcc-c++ gdb make libtool pkgconfig \
libyaml-devel libfullock-devel nss-devel -y
$ sudo yum install git -y
2. Clone the source code from GitHub
Download the K2HASH’s source code from GitHub.
$ git clone https://github.com/yahoojapan/k2hash.git
3. Build and install
Just follow the steps below to build K2HASH and install it. We use GNU Automake to build K2HASH.
You need consider K2HASH also requires one SSL/TLS library. This means the K2HASH build option affects the CHMPX build option. Table1 shows possible configure options.
Table1. possible configure option:
SSL/TLS library | K2HASH configure options | CHMPX configure options |
---|---|---|
OpenSSL | ./configure –prefix=/usr –with-openssl | ./configure –prefix=/usr –with-openssl |
GnuTLS (gcrypt) | ./configure --prefix=/usr --with-gcrypt | ./configure --prefix=/usr --with-gnutls |
GnuTLS (nettle) | ./configure --prefix=/usr --with-nettle | ./configure --prefix=/usr --with-gnutls |
Mozilla NSS | ./configure --prefix=/usr --with-nss | ./configure --prefix=/usr --with-nss |
For recent Debian-based Linux distributions users, follow the steps below:
$ cd k2hash
$ sh autogen.sh
$ ./configure --prefix=/usr --with-gcrypt
$ make
$ sudo make install
For other recent RPM-based Linux distributions users, follow the steps below:
$ cd k2hash
$ sh autogen.sh
$ ./configure --prefix=/usr --with-nss
$ make
$ sudo make install
After successfully installing K2HASH, you will see the k2himport help text:
$ k2himport -h
usage:
k2himport inputfile outputfile [-mdbm]
k2himport -h