折腾了大半天,总算将spdk编译通过了。现将编译过程遇到的一些坑记录下来:环境是centos7.2
1、获取spdk 源码
git clone git@github.com:spdk/spdk.git
2、根据github上面的redme 进行如下操作:
sudo dnf install -y gcc gcc-c++ CUnit-devel libaio-devel openssl-devel
# Additional dependencies for NVMe over Fabrics:
sudo dnf install -y libibverbs-devel librdmacm-devel
yum install kernel-devel (kernel-devel 必须要安装,不然会报错make: *** /lib/modules/3.10.0-123.el7.x86_64/build: No such file or directory. Stop.)
3、安装和编译dpdk
1) cd /path/to/spdk
2) wget http://fast.dpdk.org/rel/dpdk-16.11.tar.xz
3) tar xf dpdk-16.11.tar.xz
4) cd dpdk-16.11 && make install T=x86_64-native-linuxapp-gcc DESTDIR=.
注意: 在kvm虚拟机上编译的时候,会报如下的错误:
In file included from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_common.h:289:0,
from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_memory.h:55,
from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_eal_memconfig.h:38,
from /home/develop/spdk/dpdk-16.04/lib/librte_eal/linuxapp/eal/eal_pci.c:39:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/emmintrin.h:700:1: note: expected ‘__m128i’ but argument is of type ‘int’
_mm_storeu_si128 (__m128i *__P, __m128i __B)
^
In file included from /home/develop/spdk/dpdk-16.04/lib/librte_eal/linuxapp/eal/eal_pci.c:42:0:
/home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_memcpy.h:870:2: error: incompatible type for argument 2 of ‘_mm_storeu_si128’
MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
^
In file included from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_common.h:289:0,
from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_memory.h:55,
from /home/develop/spdk/dpdk-16.04/x86_64-native-linuxapp-gcc/include/rte_eal_memconfig.h:38,
from /home/develop/spdk/dpdk-16.04/lib/librte_eal/linuxapp/eal/eal_pci.c:39:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/emmintrin.h:700:1: note: expected ‘__m128i’ but argument is of type ‘int’
_mm_storeu_si128 (__m128i *__P, __m128i __B)
转到物理机上就OK了
4、编译spdk
make DPDK_DIR=./dpdk-16.11/x86_64-native-linuxapp-gcc
我在我的机器上编译的时候会提示没有CUinit 头文件,因此需要安装CUnit, CUint通过源码安装
5、 安装和编译CUint
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++
1)git clone git@github.com:pi2p/CUnit.git
2) readme.md 里面的说明有错误, 按照下面的步骤进行编译和安装
sudo aclocal
sudo autoconf
sudo autoheader
sudo libtoolize
sudo automake --add-missing
sudo automake
sudo mkdir <install directory>
sudo ./configure --prefix <install directory>
sudo make
sudo make install
6、重新编译spdk, 通过