These are the base requirements to build and use qsfs from a source package (as described below):
- GNU Compiler Collection (GCC) 4.1.2 or later
- CMake v3.0 or later
qsfs is integrated with QingStor via the QingStor SDK for C++. qsfs uses glog for logging and gtest for unit testing. During the CMake build's configure, these dependencies will be downloaded from their github repo and get installed. So, basically you can just leave them alone.
qsfs is a fuse based filesystem, so you must have libfuse installed. QingStor SDK requires libcurl and libopenssl, so you also must have them installed. Typically, you'll find these packages in your system's package manager.
You also need to install git in order to clone the source code from GitHub.
To install these packages on Debian/Ubuntu-based systems:
$ [sudo] apt-get install gcc g++ git fuse libfuse-dev libcurl4-openssl-dev libssl-dev
To install these packages on Redhat/Fedora-based systems:
$ [sudo] yum install gcc gcc-c++ git fuse fuse-devel libcurl-devel openssl-devel
Clone the qsfs source from yunify/qsfs on GitHub:
$ git clone https://github.com/yunify/qsfs-fuse.git
Enter the project directory containing the package's source code:
$ cd qsfs
It is always a good idea to not pollute the source with build files, so create a directory in which to create your build files:
$ mkdir build
$ cd build
Run cmake to configure and install dependencies, NOTICE as we install dependencies (gtest, glog, gflags and QingStor SDK for CPP) in cmake configure step, the terminal will wait for you to type password in order to get root privileges. And notice the installation will install all static libraries to 'third_party/install' not to system default locations (/usr/local/lib and /usr/lib).
Notice, if you want to enable unit test, specfiy -DBUILD_TESTING=ON in cmake configure step;
$ cmake -DBUILD_TESTING=ON ..
Notice, it's very important to avoid the openssl version mismatch when your system has multiple OpenSSL
version. when run make to build, you may meet with some warning like below,
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /usr/local/lib/libcurl.so, may conflict with libcrypto.so.6
.
You need to specify the root installation of OpenSSL by -DOPENSSL_ROOT_DIR.
The reason causing OpenSSL mismatch version is due to curl and QingStor SDK both directly depeneded on OpenSSL, you need to ensure they link to the same OpenSSL version. As QingStor SDK also depended on curl, so at end you need to ensure you have linked to the same OpenssL version as curl depended on. For an example, if the OpenSSL, which curl depended on, is located at /usr/local/ssl/lib
, you can specify root installation of OpenSSL as following,
$ cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl/lib
Run make to build:
$ make
Run unit tests:
$ make test
or
$ ctest -R qsfs -V
Install the programs and any data files and documentation:
$ [sudo] make install
To remove all installed files:
$ [sudo] make uninstall
To clean the generated build files, just remove the folder of build:
$ rm -rf build
To clean program binaries, juse remove the folder of bin:
$ rm -rf bin