DISCONTINUATION OF PROJECT
This project will no longer be maintained by Intel.
Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
Intel no longer accepts patches to this project.
NOTICE -- This repo is deprecated!
Please use https://github.com/daos-stack/daos/tree/master/src/control/lib/spdk instead.
![GoDoc](https://godoc.org/github.com/daos-stack/go-spdk/spdk?status.svg)
Go language bindings for the SPDK API
This is a Go interface for
SPDK which is also a work in progress. Building this requires a
local SPDK (version 18.07) build, so start there first.
To clone the 18.07 SPDK branch:
git clone --single-branch --branch v18.07.x git@github.com:spdk/spdk.git
Current Status
- Initial support will be for NVMe driver utilities.
How to Build
This is a Go
project, so the Go development tools are naturally required. We
recommend the most current Go release available. As of July 2018, the project has been built and tested with Go 1.9.
The following steps assume SPDK shared lib is installed in ${SPDK_REPO}/build/lib/libspdk.so
.
In order to use some of the SPDK API, please also follow Hugepages and Device Binding.
Clone the repo:
git clone git@github.com:daos-stack/go-spdk.git
export GOSPDK_REPO=${HOME}/go-spdk
Setup environment:
export GOPATH=${HOME}/go
export SPDK_REPO=${HOME}/spdk
export LD_LIBRARY_PATH=${HOME}/${SPDK_REPO}/build/lib:${HOME}/go-spdk/spdk:${LD_LIBRARY_PATH}
export CGO_CPPFLAGS="-I${SPDK_REPO}/include"
export CGO_LDFLAGS=-"-L${SPDK_REPO}/build/lib -lspdk"
Install go-task:
go get -u -v github.com/go-task/task/cmd/task
export PATH=${PATH}:${GOPATH}/bin/
Install [golint] (https://github.com/golang/lint):
go get -u -v golang.org/x/lint/golint
Install [goimport] (https://godoc.org/golang.org/x/tools/cmd/goimports)
go get -u -v golang.org/x/tools/cmd/goimports
Build with Taskfile
Run task:
task main-task
How to build manually (without Taskfile)
Build NVMe libs:
cd ${GOSPDK_REPO}/spdk
gcc ${CGO_LDFLAGS} ${CGO_CFLAGS} -Werror -g -Wshadow -Wall -Wno-missing-braces -c -fpic -Iinclude src/*.c -lspdk
gcc ${CGO_LDFLAGS} ${CGO_CFLAGS} -shared -o libnvme_control.so *.o
Build go spdk bindings:
cd ${GOSPDK_REPO}/spdk
sudo CGO_LDFLAGS=${CGO_LDFLAGS} CGO_CFLAGS=${CGO_CFLAGS} go build -v -i