anna的安裝與安裝過程遇到的問題
anna地址:
https://github.com/ucbrise/anna
安裝步驟程式碼:
1.Install Clang and libc++, run:
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool curl make g++ unzip pkg-config wget clang-3.9
輸入命令過程中可能會出現以下錯誤:E: 無法獲得鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時不可用);解決方法:參考連線
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 1
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 1
sudo apt-get install -y libc++-dev libc++abi-dev libtbb-dev
2.安裝cmake
wget https://cmake.org/files/v3.9/cmake-3.9.4-Linux-x86_64.tar.gz tar xvzf cmake-3.9.4-Linux-x86_64.tar.gz sudo mv cmake-3.9.4-Linux-x86_64 /usr/bin/cmake export PATH=$PATH:/usr/bin/cmake/bin rm cmake-3.9.4-Linux-x86_64.tar.gz
3.Install protobuf: after cloning the protobuf repo, run:
sudo apt-get install autoconf automake libtool curl make g++ unzip git clone https://github.com/google/protobuf.git cd protobuf git submodule update --init --recursive ./autogen.sh ./configure CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' make make check sudo make install ldconfig
這裡的安裝問題可參考這裡
4.Build KVS, run:
git clone https://github.com/ucbrise/anna.git
cd anna
bash scripts/build_release.sh
(This command will build a KVS that provides last-writer-win consistency. Lattice composition for other consistency levels can be found in kvs/include)
出現了這個問題:
CMakeFiles/Makefile2:423: recipe for target 'kvs/CMakeFiles/kvs_server.dir/all' failed
make[1]: *** [kvs/CMakeFiles/kvs_server.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
解決方法如下:
- open file vendor/tbb/CMakeLists.txt
- for the last two cmake 'set' cmd in this file, which are using fixed value 'linux_intel64_clang_cc4.8_libc2.19_kernel3.13.0_release'. This is what you got in your error msg, and also the reason why you got this error msg.
- change this value to be the same as your env. For example, I am using clang 5.4.0, libc 2.23, kernel 4.4.0 , so I changed this value to 'linux_intel64_clang_cc5.4.0_libc2.23_kernel4.4.0_release' .
Tips: If you can't make sure what this value in your env should be, you can just run 'scripts/build_release.sh' for once. Yeah, the build will fail, but then you can check the generated folder by the build process, which is 'build/vendor/tbb/src/tbb/build'. Under this folder, you will find a sub folder, its name is just the value you need.(在anna檔案下有相關的配置屬性)
解決掉一個問題,又出現了一個問題:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
kvs/CMakeFiles/kvs_server.dir/build.make:181: recipe for target 'kvs/kvs_server' failed
make[2]: *** [kvs/kvs_server] Error 1
CMakeFiles/Makefile2:423: recipe for target 'kvs/CMakeFiles/kvs_server.dir/all' failed
make[1]: *** [kvs/CMakeFiles/kvs_server.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
解決方法:重新安裝protobuf,沒有安裝正確。
執行:bash scripts/build_release.sh
提示:scripts/build_debug.sh: 行 4: cmake: 未找到命令
make: *** 沒有指明目標並且找不到 makefile。 停止。
這個原因是環境變數沒有配置。
解決方法:可以使用臨時環境變數export PATH=$PATH:/usr/bin/cmake/bin
或者將環境變數寫入檔案中。
程式碼如下:
vim ~/.bashrc
新增環境變數
source ~/.bashrc
未完待續